Skip to content

8.2.0 regression: sphinx.ext.autosummary.get_documenter and sphinx-automodapiΒ #13347

@neutrinoceros

Description

@neutrinoceros

Describe the bug

Sphinx 8.2.0rc1 appears to crash on aImportError when trying to build astropy's documentation.
xref astropy/astropy#17785

Output
Extension error (sphinx_automodapi.automodsumm)!

Versions
========

* Platform:         linux; (Linux-5.19.0-1028-aws-x86_64-with-glibc2.35)
* Python version:   3.13.2 (CPython)
* Sphinx version:   8.2.0rc1
* Docutils version: 0.21.2
* Jinja2 version:   3.1.5
* Pygments version: 2.19.1

Last Messages
=============

None.

Loaded Extensions
=================

None.

Traceback
=========

    Traceback (most recent call last):
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17785/lib/python3.13/site-packages/sphinx/events.py", line 404, in emit
        results.append(listener.handler(self.app, *args))
                       ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17785/lib/python3.13/site-packages/sphinx_automodapi/automodsumm.py", line 308, in process_automodsumm_generation
        generate_automodsumm_docs(
        ~~~~~~~~~~~~~~~~~~~~~~~~~^
            lines, sfn, app=app, builder=app.builder,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            base_path=app.srcdir,
            ^^^^^^^^^^^^^^^^^^^^^
            inherited_members=app.config.automodsumm_inherited_members,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            included_members=app.config.automodsumm_included_members)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17785/lib/python3.13/site-packages/sphinx_automodapi/automodsumm.py", line 463, in generate_automodsumm_docs
        from sphinx.ext.autosummary import import_by_name, get_documenter
    ImportError: cannot import name 'get_documenter' from 'sphinx.ext.autosummary' (/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17785/lib/python3.13/site-packages/sphinx/ext/autosummary/__init__.py)
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17785/lib/python3.13/site-packages/sphinx/cmd/build.py", line 414, in build_main
        app = Sphinx(
            srcdir=args.sourcedir,
        ...<14 lines>...
            exception_on_warning=args.exception_on_warning,
        )
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17785/lib/python3.13/site-packages/sphinx/application.py", line 332, in __init__
        self._init_builder()
        ~~~~~~~~~~~~~~~~~~^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17785/lib/python3.13/site-packages/sphinx/application.py", line 414, in _init_builder
        self.events.emit('builder-inited')
        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
      File "/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17785/lib/python3.13/site-packages/sphinx/events.py", line 415, in emit
        raise ExtensionError(
        ...<4 lines>...
        ) from exc
    sphinx.errors.ExtensionError: Handler <function process_automodsumm_generation at 0x7f85786839c0> for event 'builder-inited' threw an exception (exception: cannot import name 'get_documenter' from 'sphinx.ext.autosummary' (/home/docs/checkouts/readthedocs.org/user_builds/astropy/conda/17785/lib/python3.13/site-packages/sphinx/ext/autosummary/__init__.py))


The full traceback has been saved in:
/tmp/sphinx-err-rzl_w6qg.log

To report this error to the developers, please open an issue at <https://github.com/sphinx-doc/sphinx/issues/>. Thanks!
Please also report this if it was a user error, so that a better error message can be provided next time.

This looks to me like this happens because f3e0de1 madesphinx.ext.autosummary.get_documenter private, breaking sphinx-automodapi in the process.

How to Reproduce

short of a minimal reproducer (at least do now), I confirm that I'm able to reproduce the error see on ReadTheDocs locally:

git clone https://github.com/astropy/astropy
cd astropy
python -m pip install ".[docs, all]"
cd docs
python -m sphinx -T -W --keep-going -b html -d _build/doctrees -D language=en . docs-build/html

Environment Information

Platform:              darwin; (macOS-15.3-arm64-arm-64bit-Mach-O)
Python version:        3.13.2 (main, Feb  5 2025, 18:58:04) [Clang 19.1.6 ])
Python implementation: CPython
Sphinx version:        8.2.0rc1
Docutils version:      0.21.2
Jinja2 version:        3.1.5
Pygments version:      2.19.1

Sphinx extensions

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions