From 5d6235fc7fa39b885f772186da5606e51fd3d3c0 Mon Sep 17 00:00:00 2001 From: Jacob Wilkins Date: Tue, 5 Mar 2024 16:12:16 +0000 Subject: [PATCH] Remove sphinx-apidoc generation from docs build - Reorder docs - Make clean ignore missing folder --- docs/Makefile | 2 +- docs/source/apidoc/janus_core.rst | 20 +++++++------- docs/source/conf.py | 45 ------------------------------- 3 files changed, 11 insertions(+), 56 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index 9f28c262..e36ec9e4 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -29,7 +29,7 @@ customdefault: all: html clean: - rm -r $(BUILDDIR) + rm -rf $(BUILDDIR) html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html diff --git a/docs/source/apidoc/janus_core.rst b/docs/source/apidoc/janus_core.rst index 984bd207..8c13ff2a 100644 --- a/docs/source/apidoc/janus_core.rst +++ b/docs/source/apidoc/janus_core.rst @@ -1,6 +1,16 @@ janus\_core package =================== +Module contents +--------------- + +.. automodule:: janus_core + :members: + :special-members: + :private-members: + :undoc-members: + :show-inheritance: + Submodules ---------- @@ -43,13 +53,3 @@ janus\_core.single\_point module :private-members: :undoc-members: :show-inheritance: - -Module contents ---------------- - -.. automodule:: janus_core - :members: - :special-members: - :private-members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/conf.py b/docs/source/conf.py index 842354f8..b8024981 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -186,48 +186,3 @@ nitpick_ignore = [ ("py:class", "Logger"), ] - - -def run_apidoc(_): - """Runs sphinx-apidoc when building the documentation. - - Needs to be done in conf.py in order to include the APIdoc in the - build on readthedocs. - - See also https://github.com/rtfd/readthedocs.org/issues/1139 - """ - source_dir = os.path.abspath(os.path.dirname(__file__)) - apidoc_dir = os.path.join(source_dir, "apidoc") - package_dir = os.path.join(source_dir, os.pardir, os.pardir, "janus_core") - - # In #1139, they suggest the route below, but this ended up - # calling sphinx-build, not sphinx-apidoc - # from sphinx.apidoc import main - # main([None, '-e', '-o', apidoc_dir, package_dir, '--force']) - - import subprocess - - cmd_path = "sphinx-apidoc" - if hasattr(sys, "real_prefix"): # Check to see if we are in a virtualenv - # If we are, assemble the path manually - cmd_path = os.path.abspath(os.path.join(sys.prefix, "bin", "sphinx-apidoc")) - - options = [ - "-o", - apidoc_dir, - package_dir, - "--private", - "--force", - "--no-toc", - ] - - # See https://stackoverflow.com/a/30144019 - env = os.environ.copy() - env["SPHINX_APIDOC_OPTIONS"] = ( - "members,special-members,private-members,undoc-members,show-inheritance" - ) - subprocess.check_call([cmd_path] + options, env=env) - - -def setup(app): - app.connect("builder-inited", run_apidoc)