-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Describe the bug
We are using Sphinx to generate API documentation for our project MCFpy/mcf
, deployed with GitHub Actions and hosted on GitHub Pages.
After renaming one of the main API modules (mcf_functions
→ mcf_main
), the API pages still build and display classes/methods correctly, but the docstrings no longer appear. For example:
On our API page
, the class mcf_main.ModifiedCausalForest
and its methods (train
, predict
, analyse
, sensitivity
) are listed, but the associated docstrings are missing.
Other documentation pages (user guide, algorithm reference, etc.) update correctly. This issue seems specific to sphinx.ext.autodoc / sphinx.ext.autosummary after the module rename.
Expected behaviour:
The docstrings of classes and methods (e.g., ModifiedCausalForest.train) should be displayed under the autosummary/autodoc directives after rebuilding, regardless of the module rename.
Actual behaviour:
The page builds, the class and method appear, but docstrings are missing.
How to Reproduce
- documentation (1).yml
- conf.py
- Python module with docstrings: mcf_main.py
api.rst:
Python API
==========
Overview of classes
-------------------
..
If you add a '~' before a reference like `mymodule.MyClass.mymethod`, the
link text will then only show 'mymethod' which is often desirable.
.. autosummary::
~mcf_main.ModifiedCausalForest
Modified Causal Forest
----------------------
.. currentmodule:: mcf_main
.. autoclass:: ModifiedCausalForest
Methods
^^^^^^^
..
HACK -- Also list the methods in the "commented out" paragraph below. The
point here is that we don't want this to appear in the output, but the
autosummary below will, even when commented out, generate the separate
documentation page that can be cross-referenced.
.. autosummary::
:toctree:
ModifiedCausalForest.train
ModifiedCausalForest.predict
ModifiedCausalForest.analyse
ModifiedCausalForest.sensitivity
.. autosummary::
~ModifiedCausalForest.train
~ModifiedCausalForest.predict
~ModifiedCausalForest.analyse
~ModifiedCausalForest.sensitivity
Environment Information
Extension error (sphinx.ext.autosummary):
Handler <function process_generate_options at 0x7f0bdc333550> for event 'builder-inited' threw an exception (exception: no module named mcf_main.ModifiedCausalForest)
make: *** [Makefile:20: html] Error 2
[sphinx-action] Starting sphinx-action build.
Running:
====================================
Building docs in docs/
====================================
[sphinx-action] Running: ['make', 'html', '-e']
[sphinx-action] Build failed with 0 warnings
Traceback (most recent call last):
File "/entrypoint.py", line 22, in <module>
action.build_all_docs(github_env, [os.environ.get("INPUT_DOCS-FOLDER")])
File "/sphinx_action/action.py", line 167, in build_all_docs
raise RuntimeError("Build failed")
RuntimeError: Build failed
Sphinx extensions
Extension error (sphinx.ext.autosummary)
Additional context
The project if hosted here: