Skip to content

New warning in version 7.4 from autosummary causing automated builds to fail #12589

@mun1r0b0t

Description

@mun1r0b0t

Describe the bug

As of release 7.4.4, a new warning was added in autosummary in the line

msg = __('Summarised items should not include the current module. '
.

I run Sphinx builds in CI and on readthedocs.org with -W --keep-going flags to ensure that documents are properly built. The pipelines have started failing for the new release with no changes to the documentation itself.

The builds use autosummary for the entire package recursively:

.. autosummary::
   :toctree: python/<package_name>
   :recursive:
   
   <package_name>

The warnings are emitted because the generated documentation uses autosummary directive inside an automodule directive. This is a snippet from the generated documentation.

.. automodule:: <package_name>

   .. autosummary::
      :toctree:
      :recursive:
   
      <package_name>.<module0>
      <package_name>.<module1>

How to Reproduce

conf.py

from pathlib import Path
import sys

__this_dir = Path(__file__).absolute().parent
sys.path.append(__this_dir)

project = "foo"

extensions = [
    "sphinx.ext.autosummary",
]

# Python configuration
autodoc_default_options = {"members": True}

index.rst

.. autosummary::
   :toctree: docs/pkg
   :recursive:

   pkg

Create the pkg with

mkdir -p pkg/mod0 pkg/mod1
touch pkg/__init__.py pkg/mod0/__init__.py pkg/mod1/__init__.py

Run sphinx with

PYTHONPATH=. sphinx-build . _build/

It emits warnings and fails build with -W.

WARNING: Summarised items should not include the current module. Replace 'pkg.mod0' with 'mod0'.
WARNING: Summarised items should not include the current module. Replace 'pkg.mod1' with 'mod1'.

There doesn't seem to be a way to ignore only certain warnings in Sphinx, so I would like to keep the -W flag in my builds. Is there a way to avoid the warning or does something within autosummary need to be updated to not include the package name when documenting it?

Environment Information

Please paste all output below into the bug report template



Platform:              linux; (Linux-6.9.9-arch1-1-x86_64-with-glibc2.39)
Python version:        3.12.4 (main, Jun  7 2024, 06:33:07) [GCC 14.1.1 20240522])
Python implementation: CPython
Sphinx version:        7.4.4
Docutils version:      0.21.2
Jinja2 version:        3.1.4
Pygments version:      2.18.0

Sphinx extensions

`["sphinx.ext.autosummary"]`

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions