sphinx-doc / sphinx-doc/sphinx

`sphinx.ext.autosummary` does not process a subpackage, even though it imports without errors

Open
#12,264 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extensions:autosummary type:bug
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

I'm trying to generate API documentation from this repository using sphinx.ext.autosummary. However, the contents of libretro.driver are not being processed.

Here are some more details:

  • Each package has an __init__.py that consists solely of from .subpackage import * statements.
  • All modules list their public symbols in __all__.
  • Sphinx does not emit any errors, as far as I can tell.
  • The package's entire public API is exposed through the libretro namespace, and calling from libretro import * imports everything successfully.
  • Here's a screenshot illustrating the issue:

Screenshot 2024-04-10 215544

How to Reproduce
  1. Clone the aforementioned repository
  2. Check out the jtg/sphinx-bug branch
  3. Set up a venv with the Sphinx and sphinx-autobuild packages installed
  4. Activate the venv and run this command: sphinx-autobuild -j auto --ignore "./docs/libretro/*" --keep-going -T docs build/docs
  5. Open the docs in-browser and look for documentation for a class named ArrayAudioDriver. You won't find it.

conf.py is defined here, and index.rst is defined here.

Environment Information
Platform:              win32; (Windows-10-10.0.19045-SP0)
Python version:        3.12.3 (tags/v3.12.3:f6650f9, Apr  9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)])
Python implementation: CPython
Sphinx version:        7.2.6
Docutils version:      0.20.1
Jinja2 version:        3.1.3
Pygments version:      2.17.2
Sphinx extensions
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
]

The most recent commit in my repo has sphinx.ext.doctest and sphinx.ext.duration, but the issue occurs even when those are excluded.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked libretro.py reproduction, especially docs/conf.py and docs/index.rst, and run the provided sphinx-autobuild command with sphinx.ext.autodoc and sphinx.ext.autosummary enabled. Trace why the libretro.driver subpackage is skipped despite imports and all, then verify that the generated documentation includes ArrayAudioDriver without errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.