From f29fd2e871506141d365fd4eb13866a7764dfc99 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 26 Nov 2023 04:54:27 -0600 Subject: [PATCH 1/6] build(deps[docs]): Add sphinx-autodoc2 See also: - https://github.com/sphinx-extensions2/sphinx-autodoc2 - https://sphinx-autodoc2.readthedocs.io/ --- poetry.lock | 38 +++++++++++++++++++++++++++++++++++++- pyproject.toml | 1 + 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index c85071488..7741ecc5c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -11,6 +11,20 @@ files = [ {file = "alabaster-0.7.13.tar.gz", hash = "sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2"}, ] +[[package]] +name = "astroid" +version = "3.0.2" +description = "An abstract syntax tree for Python with inference support." +optional = false +python-versions = ">=3.8.0" +files = [ + {file = "astroid-3.0.2-py3-none-any.whl", hash = "sha256:d6e62862355f60e716164082d6b4b041d38e2a8cf1c7cd953ded5108bac8ff5c"}, + {file = "astroid-3.0.2.tar.gz", hash = "sha256:4a61cf0a59097c7bb52689b0fd63717cd2a8a14dc9f1eee97b82d814881c8c91"}, +] + +[package.dependencies] +typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.11\""} + [[package]] name = "babel" version = "2.14.0" @@ -948,6 +962,28 @@ docs = ["furo (>=2023.7.26)", "sphinx (>=7.1.2)"] numpy = ["nptyping (>=2.5)"] testing = ["covdefaults (>=2.3)", "coverage (>=7.3)", "diff-cover (>=7.7)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "sphobjinv (>=2.3.1)", "typing-extensions (>=4.7.1)"] +[[package]] +name = "sphinx-autodoc2" +version = "0.5.0" +description = "Analyse a python project and create documentation for it." +optional = false +python-versions = ">=3.8" +files = [ + {file = "sphinx_autodoc2-0.5.0-py3-none-any.whl", hash = "sha256:e867013b1512f9d6d7e6f6799f8b537d6884462acd118ef361f3f619a60b5c9e"}, + {file = "sphinx_autodoc2-0.5.0.tar.gz", hash = "sha256:7d76044aa81d6af74447080182b6868c7eb066874edc835e8ddf810735b6565a"}, +] + +[package.dependencies] +astroid = ">=2.7,<4" +tomli = {version = "*", markers = "python_version < \"3.11\""} +typing-extensions = "*" + +[package.extras] +cli = ["typer[all]"] +docs = ["furo", "myst-parser", "sphinx (>=4.0.0)"] +sphinx = ["sphinx (>=4.0.0)"] +testing = ["pytest", "pytest-cov", "pytest-regressions", "sphinx (>=4.0.0,<7)"] + [[package]] name = "sphinx-basic-ng" version = "1.0.0b2" @@ -1233,4 +1269,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "1bd8bf7d9202bea15325eb94e8a9038bb0fb711590fccfdcfe9afa3ae64068cf" +content-hash = "7e030cfc90d5848dbcfbcc0aa73f7b59688b2ac12707c68f34db59ba570a929d" diff --git a/pyproject.toml b/pyproject.toml index 649621281..b551d9d2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,6 +61,7 @@ sphinx-copybutton = "*" sphinxext-rediraffe = "*" myst_parser = ">=0.18.1" docutils = "*" +sphinx-autodoc2 = "*" [tool.poetry.group.test.dependencies] ### Testing ### From 33e06b5bd725f56576864e0f5db8ecc93e7505cb Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 26 Nov 2023 05:37:31 -0600 Subject: [PATCH 2/6] docs(conf): Initial sphinx-autodoc2 --- docs/conf.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index fbc808157..e28a0aa56 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,9 +26,10 @@ exec(fp.read(), about) extensions = [ - "sphinx.ext.autodoc", + "autodoc2", "sphinx.ext.intersphinx", - "sphinx_autodoc_typehints", + "sphinx.ext.autodoc", + # "sphinx_autodoc_typehints", "sphinx.ext.todo", "sphinx.ext.linkcode", "sphinx.ext.napoleon", @@ -109,6 +110,9 @@ autodoc_member_order = "bysource" toc_object_entries_show_parents = "hide" +# autodoc2 +autodoc2_hidden_objects = ["dunder", "private", "inherited"] + # sphinx-copybutton copybutton_prompt_text = ( r">>> |\.\.\. |> |\$ |\# | In \[\d*\]: | {2,5}\.\.\.: | {5,8}: " From b2d5f4194899b8778c95d7c4d46c495150d6fdac Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 23 Dec 2023 07:00:32 -0600 Subject: [PATCH 3/6] docs(.gitignore): Ignore apidocs/ --- docs/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/.gitignore diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 000000000..999ea03b0 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +apidocs/ From 21f0926fa16db911cbde8ef8a40dfb09af81bdc8 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 23 Dec 2023 07:11:59 -0600 Subject: [PATCH 4/6] docs(Makefile): Clean apidocs, ignore apidocs and _buld in sphinx-autobuild --- docs/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index d0f8ec310..0657c51fa 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -41,7 +41,7 @@ help: @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: - -rm -rf $(BUILDDIR)/* + -rm -rf $(BUILDDIR)/* apidocs html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @@ -181,7 +181,7 @@ dev: $(MAKE) -j watch serve start: - poetry run sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) --port ${HTTP_PORT} $(O) + poetry run sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) --port ${HTTP_PORT} --ignore "apidocs/*" --ignore "_build/*" $(O) design: # This adds additional watch directories (for _static file changes) and disable incremental builds From 081efb3c9da4b451f1da73ff5fe88286bd5e9ac4 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 23 Dec 2023 07:16:11 -0600 Subject: [PATCH 5/6] docs(conf): Add autodoc2_packages --- docs/conf.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index e28a0aa56..2c4756c7e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -111,6 +111,12 @@ toc_object_entries_show_parents = "hide" # autodoc2 +autodoc2_packages = [ + { + "path": "../src/libtmux", + } +] +# autodoc2_render_plugin = "autodoc2.render.myst_.MystRenderer" autodoc2_hidden_objects = ["dunder", "private", "inherited"] # sphinx-copybutton From e45a901c030bbd780eb5c4c4475038ae66b623f0 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 23 Dec 2023 07:16:19 -0600 Subject: [PATCH 6/6] docs(index): Add apidocs/index --- docs/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/index.md b/docs/index.md index a43882111..6a035a225 100644 --- a/docs/index.md +++ b/docs/index.md @@ -20,6 +20,7 @@ about topics/traversal reference/index pytest-plugin/index +apidocs/index ``` ```{toctree}