diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 9f41cca..f268e43 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -31,7 +31,7 @@ jobs: python -m pytest - name: Sphinx documentation build run: | - sphinx-build -M html docs/source/ docs/build/ + make docs - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} diff --git a/.gitignore b/.gitignore index 24deab3..5decde7 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,7 @@ __pypackages__/ .DS_Store .qtmlib/ *.venv/ + +# autogenerated by sphinx-napoleon +docs/source/modules.rst +docs/source/pytemplate.rst diff --git a/Makefile b/Makefile index ee5350f..5b9b5a0 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ lint: pre-commit run --all-files docs: + sphinx-apidoc -f -o docs/source/ pytemplate sphinx-build -M html docs/source/ docs/build/ clean: diff --git a/docs/source/conf.py b/docs/source/conf.py index 05c6438..30b08a8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -3,6 +3,13 @@ # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. +import pathlib +import sys + +sys.path.insert(0, pathlib.Path(__file__).parents[2].resolve().as_posix()) + # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information @@ -14,7 +21,12 @@ # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration -extensions = [] +extensions = [ + "sphinx.ext.doctest", + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.napoleon", +] exclude_patterns = [] diff --git a/docs/source/index.rst b/docs/source/index.rst index b3bfb1b..3828c39 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,10 +1,16 @@ qtmlib ====== +Demo Sphinx site for the `CQCL pytemplate `_ project. + +---- + .. toctree:: :maxdepth: 2 :caption: Contents: + modules + Installation ------------ @@ -41,4 +47,5 @@ Indices and tables ================== * :ref:`genindex` +* :ref:`modindex` * :ref:`search`