diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml index 4975272c3f..80496a45a3 100644 --- a/.github/workflows/pages.yaml +++ b/.github/workflows/pages.yaml @@ -9,6 +9,7 @@ concurrency: on: push: + pull_request: jobs: @@ -35,7 +36,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install poetry --user - python -m poetry install + python -m poetry install --only=docs,main - name: "Build documentation with Sphinx" run: | diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 9f2df6b969..9a254f21dc 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -6,6 +6,10 @@ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details +# This uses custom commands, because we need to install dependencies +# from both Conda and Poetry. + + version: 2 build: @@ -13,14 +17,12 @@ build: os: "ubuntu-22.04" tools: - python: "3.8" + python: "mambaforge-22.9" commands: - - "asdf plugin add poetry" - - "asdf install poetry latest" - - "asdf global poetry latest" - - "poetry install --only docs" - - "poetry run sphinx-build -T -E -b html -c ./docs/ ./docs/source/ ${READTHEDOCS_OUTPUT}/html/" + - "mamba env create --file conda-environment-dev.yml" + - "mamba run --name mxcubecore poetry install --only=docs,main" + - "mamba run --name mxcubecore poetry run sphinx-build -T -E -b html -c ./docs/ ./docs/source/ ${READTHEDOCS_OUTPUT}/html/" ... # EOF diff --git a/conda-environment-dev.yml b/conda-environment-dev.yml index f4e8c8d56a..116ee08caa 100644 --- a/conda-environment-dev.yml +++ b/conda-environment-dev.yml @@ -3,12 +3,17 @@ channels: - conda-forge dependencies: - python >=3.8,<3.11 + # Run-time - openldap - python-ldap=3.4.0 + # Dev - pip - - pytest - - coverage - - flake8 + - poetry + # Format, lint - black + - flake8 + # Test + - coverage + - pytest - pytest-cov - pytest-mock diff --git a/docs/conf.py b/docs/conf.py index 16fda67e63..83870b104e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -57,4 +57,56 @@ } +# -- Extensions -------------------------------------------------------------- + + +# -- Options for sphinx.ext.autodoc +# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html + +extensions.append("sphinx.ext.autodoc") + +autodoc_default_options = { + "inherited-members": True, + "members": True, + "show-inheritance": True, +} + +autodoc_typehints = "both" + + +# -- Options for sphinx.ext.autosummary +# https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html + +extensions.append("sphinx.ext.autosummary") + +autosummary_generate = True + + +# -- Options for sphinx.ext.intersphinx +# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html + +extensions.append("sphinx.ext.intersphinx") + +intersphinx_mapping = { + "python": ("https://docs.python.org/3/", None), +} + + +# -- Options for sphinx.ext.napoleon +# https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html + +# We use Google style docstrings +# https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings + +extensions.append("sphinx.ext.napoleon") + +napoleon_numpy_docstring = False + + +# -- Options for sphinx.ext.viewcode +# https://www.sphinx-doc.org/en/master/usage/extensions/viewcode.html + +extensions.append("sphinx.ext.viewcode") + + # EOF diff --git a/docs/source/dev/api.rst b/docs/source/dev/api.rst new file mode 100644 index 0000000000..40493823d0 --- /dev/null +++ b/docs/source/dev/api.rst @@ -0,0 +1,15 @@ +.. + + +*** +API +*** + +.. autosummary:: + :toctree: autosummary + :recursive: + + mxcubecore + + +.. EOF diff --git a/docs/source/dev/autosummary/.gitignore b/docs/source/dev/autosummary/.gitignore new file mode 100644 index 0000000000..6976c6bf7a --- /dev/null +++ b/docs/source/dev/autosummary/.gitignore @@ -0,0 +1,7 @@ +# + + +* + + +# EOF