Q about use sphinx with sphinx.ext.autodoc`๐
kloczek opened this issue ยท 3 comments
Disclaimer:
This ticket is not the issue report. It is just humble question ๐
I'm packaging as rpm packages python modules for some distribution. Already I've done almost 900 such packages. Part of the packaging goals is include sphinx based documentation as man pages if sphinx based documentation is provided. Such goal needs usually needs only small modyfications and at the moment I have almost 600 of all modules which have ocumentation in such form .. however I'm struggling in most of the cases when module source code needs to be scanned usually by autodoc sphinx extension.
Usually what is missing is path to the module code. Usually such path is provided by lines like below in copy.py:
import sys
import os
sys.path.append(os.path.abspath('../../src'))
I just found that your module does not need typical modyfication in copy.py and all works (almost) flawlessly ๐
+ /usr/bin/sphinx-build -n -T -b man doc/source build/sphinx/man
Running Sphinx v4.5.0
making output directory... done
loading intersphinx inventory from https://docs.python.org/3/objects.inv...
loading intersphinx inventory from https://www.sphinx-doc.org/en/master/objects.inv...
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 24 added, 0 changed, 0 removed
reading sources... [100%] syntax
WARNING: Unexpected return code 1 from command Command(command=('sphobjinv', 'suggest', '-u', 'https://sphobjinv.readthedocs.io/en/v2.0rc1/cmdline.html', 'compress'), shell=False, hide_standard_error=False, working_directory='/home/tkloczko/rpmbuild/BUILD/sphobjinv-2.2.2/tests/resource') (output=' \nNo inventory at provided URL.\nAttempting "https://sphobjinv.readthedocs.io/en/v2.0rc1/cmdline.html/objects.inv" ...\nAttempting "https://sphobjinv.readthedocs.io/en/v2.0rc1/objects.inv" ...\nAttempting "https://sphobjinv.readthedocs.io/en/objects.inv" ...\nAttempting "https://sphobjinv.readthedocs.io/objects.inv" ...\n \nNo inventory found!')
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... python-sphobjinv.3 { cli/index cli/convert cli/suggest api_usage customfile levenshtein syntax api/index api/data api/enum api/error api/fileops api/inventory api/re api/schema api/zlib cli/implementation/index cli/implementation/core cli/implementation/load cli/implementation/parser cli/implementation/paths cli/implementation/ui cli/implementation/write } done
build succeeded, 1 warning.
I cannot find find in your copy.py any traces of setting up path to the module and to be honest I'm puzzled a bit.
May I ask for explaination how it is done? I'm asking because your solution seems does not need running sphinx-build in tox venv or does not need to heve module already installed or alter $PYTHONPATH.
Looks like your module contains something whcih could be spread across all other modules, and I may try to spread simillar solution to other modules. ๐
Thx ..
Closing .. I just found that accidentally I had installed sphobjinv
in build env and this is why it was working :(
Yep, the dev workflow for the project involves a pip install -e .
. Without that, I would also need to patch sys.path
in conf.py
.
Sorry, no magic here! ๐ซค
Yep, the dev workflow for the project involves a
pip install -e .
. Without that, I would also need to patchsys.path
inconf.py
.
pep517 build which I'm executing before generate documentation alredy adds to the tree module metadata so that step is not needed and without alter sys.path
in conf.py
build-sphinx does not work.