From c766e9af8b133fcfa0a4d849f755b7bdd172fe07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Mon, 6 Feb 2023 13:41:03 -0500 Subject: [PATCH 1/2] ENH: Add `readthedocs` config file Add `readthedocs` config file. Specifically: - Set the Python version to 3.8, as the default version `readthedocs` is curreently using is 3.7, whose EOL is only 4 months away. - List the dependencies to be able to build the documentation in the `pyproject.toml` file. - Read the package version in the documentation configuration `conf.py` file using `pkg_resources`. --- .readthedocs.yaml | 19 +++++++++++++++++++ doc/conf.py | 5 ++--- pyproject.toml | 5 +++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 .readthedocs.yaml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..ffdd1d6 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,19 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.8" + +python: + install: + - method: pip + path: . + extra_requirements: + - doc diff --git a/doc/conf.py b/doc/conf.py index 5f5bac6..03a425e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -11,9 +11,8 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # import os -# import sys import tomli -from importlib.metadata import version +import pkg_resources from datetime import datetime # sys.path.insert(0, os.path.abspath('.')) @@ -30,7 +29,7 @@ copyright = f"2022-{datetime.now().year}, {_author}s <{_email}s>" author = f"{_author}s" -_version = version(project) +_version = pkg_resources.require(project)[0].version # The full version, including alpha/beta/rc tags release = _version diff --git a/pyproject.toml b/pyproject.toml index e279ffd..2417bae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,6 +68,11 @@ dev = [ "isort == 5.8.0", "pre-commit >= 2.9.0", ] +doc = [ + "sphinx", + "sphinx-rtd-theme", + "tomli", +] [project.scripts] ae_bundle_streamlines = "scripts:ae_bundle_streamlines.main" From 7637a1b257ac1319be6febf8b0891fb76dd62bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Tue, 7 Feb 2023 11:58:48 -0500 Subject: [PATCH 2/2] ENH: Add the `numpydoc` extension to process the docstrings Add the `numpydoc` extension to process the docstrings, which are written according to the `Numpy` convention. --- doc/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/conf.py b/doc/conf.py index 03a425e..7456920 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -41,6 +41,7 @@ # ones. extensions = [ "sphinx.ext.autodoc", + "numpydoc", ] # Add any paths that contain templates here, relative to this directory.