From 6b16f20e5c965406b841790ca0d7ae56925860ac Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 29 Apr 2024 14:12:22 +0200 Subject: Add sphinx documentation generator To generate the documentation run $ make -C docs html --- docs/Makefile | 20 ++++++++++++++++++++ docs/conf.py | 34 ++++++++++++++++++++++++++++++++++ docs/index.rst | 22 ++++++++++++++++++++++ docs/make.bat | 35 +++++++++++++++++++++++++++++++++++ docs/reference.rst | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 2 ++ 6 files changed, 167 insertions(+) create mode 100644 docs/Makefile create mode 100644 docs/conf.py create mode 100644 docs/index.rst create mode 100644 docs/make.bat create mode 100644 docs/reference.rst diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..2e293f4 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,34 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +# Add path of polymatrix code +import os +import sys +sys.path.insert(0, os.path.abspath("..")) + +project = 'polymatrix' +copyright = '2024, Michael Schneeberger' +author = 'Michael Schneeberger' +release = '0.0.1' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary'] +autosummary_generate = True + +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'python_docs_theme' +html_static_path = ['_static'] diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..8389b3a --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,22 @@ +.. polymatrix documentation master file, created by + sphinx-quickstart on Wed Apr 24 15:20:48 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to polymatrix's documentation! +====================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + reference + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..32bb245 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/reference.rst b/docs/reference.rst new file mode 100644 index 0000000..fa0ef3c --- /dev/null +++ b/docs/reference.rst @@ -0,0 +1,54 @@ +Package Contents +================ + +.. automodule:: polymatrix + :members: + :undoc-members: + :show-inheritance: + + +PolyMatrix Module +================= + +.. automodule:: polymatrix.polymatrix + :members: + :undoc-members: + :show-inheritance: + +Abstract Base Classes +--------------------- + +.. automodule:: polymatrix.polymatrix.abc + :members: + :undoc-members: + :show-inheritance: + +Mixins +------ + +.. automodule:: polymatrix.polymatrix.mixins + :members: + :undoc-members: + :show-inheritance: + +Index Types +----------- + +.. automodule:: polymatrix.polymatrix.typing + :members: + :undoc-members: + :show-inheritance: + +.. + Mixin implementations + --------------------- + + .. automodule:: polymatrix.polymatrix.impl + :members: + :undoc-members: + :show-inheritance: + + .. automodule:: polymatrix.polymatrix.init + :members: + :undoc-members: + :show-inheritance: diff --git a/pyproject.toml b/pyproject.toml index 6d78727..74c6c59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,8 @@ sympy = ">=1.12" numpy = ">=1.26.4" dataclass-abc = ">=0.0.8" scipy = "^1.12.0" +sphinx = "^7.3.7" +python-docs-theme = "^2024.4" [tool.poetry.group.notebook.dependencies] -- cgit v1.2.1