Skip to content

Commit

Permalink
Merge pull request #25 from thecaligarmo/develop
Browse files Browse the repository at this point in the history
Merge in Develop
  • Loading branch information
thecaligarmo authored Feb 9, 2024
2 parents cb82ba1 + 00b28d7 commit b811aec
Show file tree
Hide file tree
Showing 30 changed files with 1,037 additions and 825 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/py-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Install relint
run: pip install tox relint
- name: Lint using relint
run: tox -e relint -- src/sage/
run: tox -e relint -- oriented_matroids
lint-rst:
name: Validate docstring markup as RST
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@ ENV/

# Rope project settings
.ropeproject

# vim stuff
*.swp
63 changes: 63 additions & 0 deletions .relint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# From https://github.com/sagemath/sage-patchbot/blob/master/sage_patchbot/plugins.py
# (simple pattern-exclusion plugins)
# The patterns have been edited slightly because relint tests the regexp to the whole file,
# whereas the patchbots tests them line by line.

- name: 'python3: Python3 incompatible code'
hint: |
# ifilter, imap, izip # __metaclass__
# update raise statements # except Exception, var
# six is no longer allowed
pattern: '(import.*[, ]ifilter|import.*[, ]imap|import.*[, ]izip|^\s*raise\s*[A-Za-z]*Error\s*,|__metaclass__|except\s*[A-Za-z]\s*,|import six|from six import)'
filePattern: .*[.](py|pyx|rst)

- name: 'foreign_latex: foreign commands in LaTeX'
hint: |
use equivalent LaTeX commands instead of plain TeX commands such as \over, \choose, etc.
pattern: '(\\choose|\\atop|\\above|\\overwithdelims|\\atopwithdelims|\\abovewithdelims)'
# \over appears in bad latex code coming from Fricas and Maxima

- name: 'blocks: wrong syntax for blocks (INPUT, OUTPUT, EXAMPLES, NOTE, etc.)'
hint: |
# the correct syntax is .. SEEALSO::
# TESTS and EXAMPLES should be plural, NOTE singular
# no :: after INPUT, OUTPUT, REFERENCE blocks
# no " :" at the end of lines
pattern: '(\.\.SEE|SEE ALSO|SEEALSO:($|[^:])|^\s*TEST:|^\s*EXAMPLE:|^\s*NOTES:|^\s*[A-Z]*PUT::|^\s*REFERENCES?::$)'

- name: 'trac_links: bad trac link'
hint: |
the correct syntax for trac roles is :trac:`NUMBER`, note the initial colon
pattern: '[^:]trac:`[0-9]'

- name: 'triple_colon: triple colon (::: or : ::)'
pattern: ':[ ]*::$'

# From various typo tickets

# https://github.com/sagemath/sage/issues/30585
- name: 'typo "homogenous" detected'
hint: |
in mathematics it should be "homogeneous"
pattern: 'homogenous'

# Modularization anti-patterns

- name: 'namespace_pkg_all_import: import from .all of a namespace package'
hint: |
Sage library code should not import from sage.PAC.KAGE.all when sage.PAC.KAGE is an implicit
namespace package. Type import_statements("SOME_IDENTIFIER") to find a more specific import,
or use 'sage --fiximports' to fix automatically in the source file.
# Keep in sync with SAGE_ROOT/src/sage/misc/replace_dot_all.py
pattern: 'from\s+sage(|[.](arith|categories|combinat|crypto|databases|data_structures|dynamics|ext|game_theory|games|graphs|groups|interfaces|manifolds|matrix|matroids|misc|modules|monoids|numerical|probability|quadratic_forms|quivers|rings|sat|schemes|sets|stats|symbolic|tensor)[a-z0-9_.]*|[.]libs)[.]all\s+import'
# imports from .all are allowed in all.py; also allow in some modules that need sage.all
filePattern: '(.*/|)(?!(all|benchmark|dev_tools|parsing|sage_eval))[^/.]*[.](py|pyx|pxi)$'

# Magic doctest comments

- name: 'multiline_doctest_comment: magic comment on a continuation line'
hint: |
magic doctest comments should appear on the "sage:" line, not "....:" lines
# see optional_regex in src/sage/doctest/parsing.py
# "indirect doctest" is from src/bin/sage-coverage
pattern: '^[ ]*[.][.][.][.]:.*#.*(arb216|arb218|py2|py3|long time|not implemented|not tested|known bug|optional|indirect doctest)'
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

All notable changes will be made in this file.

## [0.1.0] - 2024-02-09

### Added

- (#18) Implemented Cocircuits and covectors.
- (#14) Added some additional examples to ensure tests catch potential errors.

### Changed

- (#22) Updated the documentation to be more complete.
- (#12) Altered it so that the `to_xxx()` functions are encapsulated in the function `change_type()`.
- (#2) Updated package to fit into up to date methods for making packages.
- (#1) Restructed the OrientedMatroids class. In particular:
- Removed the category implementation and structured based off the matroid implementation.
- There is now an `AbstractOrientedMatroid` class which handles the abstract methods and everything pulls from here.

### Fixed

- (#15) Fixed the groundset error bug.


## [0.0.2] - 2020-12-15

### Added
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Dockerfile for binder
# Reference: https://mybinder.readthedocs.io/en/latest/dockerfile.html#preparing-your-dockerfile

FROM sagemath/sagemath:9.2
FROM sagemath/sagemath:10.0

# Copy the contents of the repo in ${HOME}
COPY --chown=sage:sage . ${HOME}
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include README.md
include VERSION
57 changes: 47 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,64 @@ This package contains an oriented matroid implementation for sagemath.

## Current version

**NOTE:** This package currently does not work. If you would like to help with the development, please let Aram know.
The current version is 0.1.0 and is compatible/has been tested with sagemath 10.0, 10.1 and 10.2. It is in beta and is open for testing from others.

**NOTE:** This package will be integrating into SageMath directly. If you see any errors while using this please, open an issue and let us know so we can correct it.

The current version is 0.0.2 and is compatible with sagemath 9.2.

## Installation

### Installation from Pypi
Use `pip` to install the package:

```
$ sage -pip install oriented_matroids
```

### Local install from source
Download the source from the git repository:

`$ git clone https://github.com/thecaligarmo/oriented_matroids.git`
```
$ git clone https://github.com/thecaligarmo/oriented_matroids.git
```

Change to the root directory and run:
```
$ sage -pip install .
```

For convenience this package contains a makefile with this and other often used commands. This file neds updating to your sage installation directory before running.

`$ sage -pip install .`
```
$ make install
```

For convenience this package contains a makefile with this and other often used commands. Should you wish too, you can use the shorthand:
### Common errors

`$ make install`
1. If you get "SSL" errors, try the fixes found on: [ask sagemath](https://ask.sagemath.org/question/51130/ssl-error-using-sage-pip-install-to-download-a-package/)
2. If `make` didn't work, make sure you updated where your sage directory is in the make file.

Note that you might need to alter the make file in order for this to run properly if your sage is located in another directory.

### Common errors
## Using the package after install
After install, you can start sage and run the following command to have all methods available:
```
from oriented_matroids import *
```

## Uninstall
To uninstall the package you can run the following command
```
$ sage -pip uninstall oriented_matroids
```

Alternatively, if you installed locally and want to uninstall using `make`, you can run:
```
$ make uninstall
```

## Documentation
To make the documentation, you can use `make`:
```
$ make doc
```

If you get "SSL" errors, try the fixes found on: [ask sagemath](https://ask.sagemath.org/question/51130/ssl-error-using-sage-pip-install-to-download-a-package/)
To refresh the doc, I would recommend first cleaning it using `make clean` before running `make doc` again, just in case.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.2
0.1.0
16 changes: 7 additions & 9 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
except ImportError:
raise RuntimeError("to build the documentation you need to be inside a Sage shell (run first the command 'sage -sh' in a shell")



# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand All @@ -47,7 +45,8 @@
# ones.
extensions = [
#'sphinx.ext.autodoc',
'sage_autodoc',
#'sage_autodoc',
'sage_docbuild.ext.sage_autodoc',
'sage_package.sphinx',
'sphinx.ext.doctest',
'sphinx.ext.coverage',
Expand All @@ -66,8 +65,6 @@
# The master toctree document.
master_doc = 'index'



# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
Expand Down Expand Up @@ -232,7 +229,7 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', package_name + '.tex', u'Documentation of ' + unicode(package_name),
('index', package_name + '.tex', u'Documentation of ' + str(package_name),
authors, 'manual'),
]

Expand Down Expand Up @@ -262,7 +259,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', package_name, unicode(package_name) + u" documentation",
('index', package_name, str(package_name) + u" documentation",
[authors], 1)
]

Expand All @@ -276,7 +273,7 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', package_name, unicode(package_name) + u" documentation",
('index', package_name, str(package_name) + u" documentation",
authors, package_name, project,
'Miscellaneous'),
]
Expand Down Expand Up @@ -322,13 +319,14 @@
exclude_patterns=['**/'+os.path.join(mathjax_relative, i) for i in ('docs', 'README*', 'test',
'unpacked', 'LICENSE')]
else:
extensions.append('sphinx.ext.pngmath')
extensions.append('sphinx.ext.imgmath')

# This is to make the verbatim font smaller;
# Verbatim environment is not breaking long lines
from sphinx.highlighting import PygmentsBridge
from pygments.formatters.latex import LatexFormatter


class CustomLatexFormatter(LatexFormatter):
def __init__(self, **options):
super(CustomLatexFormatter, self).__init__(**options)
Expand Down
5 changes: 2 additions & 3 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Oriented Matroids
:maxdepth: 1

oriented_matroids/oriented_matroid
oriented_matroids/oriented_matroids_category
oriented_matroids/abstract_oriented_matroid

Representations
---------------
Expand All @@ -22,7 +22,7 @@ Representations

oriented_matroids/circuit_oriented_matroid
oriented_matroids/covector_oriented_matroid
oriented_matroids/hyperplane_arrangement_oriented_matroid
oriented_matroids/real_hyperplane_arrangement_oriented_matroid
oriented_matroids/vector_oriented_matroid

Elements
Expand All @@ -32,7 +32,6 @@ Elements
:maxdepth: 1

oriented_matroids/signed_subset_element
oriented_matroids/signed_vector_element

Indices and Tables
==================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.. nodoctest
Oriented Matroids Category
Abstract Oriented Matroids
==========================

.. automodule:: oriented_matroids.oriented_matroids_category
.. automodule:: oriented_matroids.abstract_oriented_matroid
:members:
:undoc-members:
:show-inheritance:

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. nodoctest
Real Hyperplane Arrangement Oriented Matroids
=============================================

.. automodule:: oriented_matroids.real_hyperplane_arrangement_oriented_matroid
:members:
:undoc-members:
:show-inheritance:
9 changes: 0 additions & 9 deletions docs/source/oriented_matroids/signed_vector_element.rst

This file was deleted.

2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SAGE = /sage/sage/sage
all: install test

install:
$(SAGE) -pip install --upgrade --no-index -v .
$(SAGE) -pip install --upgrade --no-index --no-build-isolation -v .

uninstall:
$(SAGE) -pip uninstall $(PACKAGE)
Expand Down
8 changes: 4 additions & 4 deletions oriented_matroids/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import absolute_import
from .oriented_matroid import OrientedMatroid
from .oriented_matroids_category import OrientedMatroids
from .abstract_oriented_matroid import AbstractOrientedMatroid

from sage.misc.lazy_import import lazy_import
lazy_import('sage.matroids.oriented_matroids',
'oriented_matroids_catalog', 'oriented_matroids')
# from sage.misc.lazy_import import lazy_import
# lazy_import('sage.matroids.oriented_matroids',
# 'oriented_matroids_catalog', 'oriented_matroids')
Loading

0 comments on commit b811aec

Please sign in to comment.