Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@ jobs:
- name: Test with pytest
run: pytest

mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Run mypy
# Informational only for now: the type-hinting pass surfaced a
# baseline of pre-existing design tensions (Liskov-incompatible
# overrides, embedded-graph invariants not visible to the type
# checker) that are tracked separately, not fixed here. Don't fail
# the build on them yet.
continue-on-error: true
run: mypy src/pgraph/PGraph.py

codecov:
needs: unittest
runs-on: ubuntu-latest
Expand Down Expand Up @@ -62,7 +83,6 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install .[docs]
pip install git+https://github.com/petercorke/sphinx-autorun.git
sudo apt-get update
sudo apt-get install -y graphviz
- name: Build docs
Expand Down
2 changes: 1 addition & 1 deletion docs/source/PGraph.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PGraph module
=============

.. automodule:: PGraph
.. automodule:: pgraph.PGraph
:members:
:undoc-members:
:show-inheritance:
20 changes: 20 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,33 @@
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx.ext.mathjax",
"sphinx.ext.coverage",
"sphinx.ext.intersphinx",
"sphinx.ext.inheritance_diagram",
"sphinx_autodoc_typehints",
"sphinx_copybutton",
"sphinx_pyrunblock",
"sphinx_codeautolink",
]

autosummary_generate = True

# copybutton configuration: strip >>> and ... prompts when copying
copybutton_prompt_text = r">>> |\.\.\. "
copybutton_prompt_is_regexp = True

# sphinx_codeautolink: link names in code blocks to their API docs
codeautolink_autodoc_inject = False

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable/", None),
}

html_theme_options = {
"logo_only": False,
"display_version": True,
Expand Down
2 changes: 1 addition & 1 deletion docs/source/dgraph.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Directed graph
--------------


.. autoclass:: PGraph.DGraph
.. autoclass:: pgraph.PGraph.DGraph
:undoc-members:
:show-inheritance:
:inherited-members:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/dvertex.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Directed graph vertex
---------------------

.. autoclass:: PGraph.DVertex
.. autoclass:: pgraph.PGraph.DVertex
:undoc-members:
:show-inheritance:
:inherited-members:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/edge.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Edge
----

.. autoclass:: PGraph.Edge
.. autoclass:: pgraph.PGraph.Edge
:undoc-members:
:show-inheritance:
:inherited-members:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/matrices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ Convert graph to matrix form

These methods convert a graph to a matrix representation .

.. autoclass:: PGraph.PGraph
.. autoclass:: pgraph.PGraph.PGraph
:members: distance, adjacency, degree, incidence, Laplacian
2 changes: 1 addition & 1 deletion docs/source/planning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ Path planning

These methods find optimal paths from a start vertex to a goal vertex.

.. autoclass:: PGraph.PGraph
.. autoclass:: pgraph.PGraph.PGraph
:members: path_BFS, path_UCS, path_Astar
2 changes: 1 addition & 1 deletion docs/source/ugraph.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Undirected graph
----------------


.. autoclass:: PGraph.UGraph
.. autoclass:: pgraph.PGraph.UGraph
:undoc-members:
:show-inheritance:
:inherited-members:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/uvertex.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Undirected graph vertex
-----------------------

.. autoclass:: PGraph.UVertex
.. autoclass:: pgraph.PGraph.UVertex
:undoc-members:
:show-inheritance:
:inherited-members:
Expand Down
18 changes: 13 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.6.4"
authors = [{ name = "Peter Corke", email = "rvc@petercorke.com" }]
description = "Mathematical graphs for Python"
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.9"
classifiers = [
"Development Status :: 5 - Production/Stable",
# Indicate who your project is intended for
Expand Down Expand Up @@ -32,7 +32,7 @@ keywords = [
"optimal path",
]

dependencies = ["spatialmath-python", "numpy>=1.18.0", "scipy", "matplotlib"]
dependencies = ["spatialmath-python", "numpy>=2.0", "scipy", "matplotlib"]

[project.urls]

Expand All @@ -45,14 +45,16 @@ dependencies = ["spatialmath-python", "numpy>=1.18.0", "scipy", "matplotlib"]

[project.optional-dependencies]

dev = ["pytest", "pytest-cov"]
dev = ["pytest", "pytest-cov", "mypy"]

docs = [
"sphinx",
"recommonmark",
"sphinx-rtd-theme",
"sphinx-autorun",
"sphinx-favicon",
"sphinx-autodoc-typehints",
"sphinx-copybutton",
"sphinx-pyrunblock",
"sphinx-codeautolink",
]

[tool.pytest.ini_options]
Expand All @@ -72,3 +74,9 @@ target-version = ['py311']

[tool.coverage.run]
omit = []

[tool.mypy]
python_version = "3.9"
ignore_missing_imports = true
warn_unused_ignores = true
warn_redundant_casts = true
Loading