You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Builds have to be run from one specific directory, making it impossible to support both python -m sphinx -T -b html -d _build/doctrees -D language=en . $output from docs/source as well as make html from docs folder
Details
Currently, I am building my docs with something like this:
This works fine, as the ../mypackage/cli.py path is relative to the docs dir which is used as a build dir by make.
The Problem
However, when running a readthedocs build, this does not work fine, as the build is created there using: cd docs/source python -m sphinx -T -b html -d _build/doctrees -D language=en . $OUTPUTDIR
which starts the build from the source folder directly.
So we need to change :filename: ../mypackage/cli.py to :filename: ../../mypackage/cli.py to fix this.
This would probably have the drawback, that sphinx-argparse should move to a "argparse is relative to the .rst file - not to the build dir of the docs" approach which would break existing configs..?
The text was updated successfully, but these errors were encountered:
maurerle
added a commit
to assume-framework/assume
that referenced
this issue
Aug 7, 2024
Summary
Builds have to be run from one specific directory, making it impossible to support both
python -m sphinx -T -b html -d _build/doctrees -D language=en . $output
from docs/source as well asmake html
from docs folderDetails
Currently, I am building my docs with something like this:
make -C docs html
This works with a directory structure like:
and the cli.rst contains:
This works fine, as the
../mypackage/cli.py
path is relative to the docs dir which is used as a build dir by make.The Problem
However, when running a readthedocs build, this does not work fine, as the build is created there using:
cd docs/source
python -m sphinx -T -b html -d _build/doctrees -D language=en . $OUTPUTDIR
which starts the build from the source folder directly.
So we need to change
:filename: ../mypackage/cli.py
to:filename: ../../mypackage/cli.py
to fix this.Solution
I checked how nbsphinx-link is doing this - as this project does work in both ways:
https://github.com/vidartf/nbsphinx-link/blob/f1682a8b5bfd884bfed7ef7dfaf0810c6ae8a543/nbsphinx_link/__init__.py
I found that there is a
doc2path
api in sphinx which might correctly translate the pathes to be relative to the calling file in both ways:https://www.sphinx-doc.org/en/master/extdev/envapi.html
This would probably have the drawback, that sphinx-argparse should move to a "argparse is relative to the .rst file - not to the build dir of the docs" approach which would break existing configs..?
The text was updated successfully, but these errors were encountered: