Closed munircontractor closed 1 month ago
Hi @munircontractor, have you tried
suppress_warnings = [
'autosummary.import_cycle',
]
in your conf.py
?
See https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-warning-control
A
Oh, thanks for that. I could not find it when searching for a fix for this.
hi @AA-Turner and cheers for that sight! I believe adding the ignore in conf.py
is a bit of a workaround, what is the actual fix, and will it be done in Sphinx or is it the user's responsibility? Cheers :beer:
+1
Please see #12609, which addresses the underlying issue. I'd be grateful for any testing.
A
I have released Sphinx 7.4.6 with a fix.
A
I am using 7.4.6 and am still hitting this issue, see this build which just used 7.4.6:
WARNING: Summarised items should not include the current module. Replace 'mne_bids.BIDSPath' with 'BIDSPath'.
WARNING: Summarised items should not include the current module. Replace 'mne_bids.BIDSPath' with 'BIDSPath'.
WARNING: Summarised items should not include the current module. Replace 'mne_bids.BIDSPath' with 'BIDSPath'.
WARNING: Summarised items should not include the current module. Replace 'mne_bids.BIDSPath' with 'BIDSPath'.
WARNING: Summarised items should not include the current module. Replace 'mne_bids.write_raw_bids' with 'write_raw_bids'.
WARNING: Summarised items should not include the current module. Replace 'mne_bids.write_raw_bids' with 'write_raw_bids'.
WARNING: Summarised items should not include the current module. Replace 'mne_bids.BIDSPath.fpath.exists()' with 'BIDSPath.fpath.exists()'.
WARNING: Summarised items should not include the current module. Replace 'mne_bids.BIDSPath' with 'BIDSPath'.
WARNING: Summarised items should not include the current module. Replace 'mne_bids.get_anat_landmarks' with 'get_anat_landmarks'.
WARNING: Summarised items should not include the current module. Replace 'mne_bids.BIDSPath' with 'BIDSPath'.
WARNING: Summarised items should not include the current module. Replace 'mne_bids.BIDSPath' with 'BIDSPath'.
WARNING: Summarised items should not include the current module. Replace 'mne_bids.copyfiles' with 'copyfiles'.
Maybe it wasn't caught by this fix because of the autolink
default role in https://github.com/mne-tools/mne-bids/blob/3c020d9c6b734d8f8f13a293bd11b175192a7ae1/doc/conf.py#L77 ? Not sure. It only happens on refs like
blah `mne_bids.BIDSPATH` blah
Refs with explicit prefixes like :class:
are fine.
Hi @larsoner, are you able to provide a reproducer please? I'll reopen the issue.
A
Not minimal by any means but something like this:
git clone git@github.com:/mne-tools/mne-bids.git
cd mne-bids
git checkout 3c020d9c6b734d8f8f13a293bd11b175192a7ae1 # a commit before a workaround
pip install -ve .[doc]
cd doc
make clean && time make html SPHINXOPTS="-nWT --keep-going -Dsphinx_gallery_conf.filename_pattern=aaa"
should show the
WARNING: Summarised items should not include the current module. Replace 'mne_bids.BIDSPath' with 'BIDSPath'.
in about 20s.
@larsoner
Maybe it wasn't caught by this fix because of the
autolink
default role (...) Not sure. It only happens on refs like
I have to agree with the comment in the line of code you linked, namely:
default_role = "autolink" # XXX silently allows bad syntax, someone should fix
That's why I never use default_role
, when something goes wrong I don't have to second guess those default roles.
Updated my comment since mne-bids has since in main
it now has some workarounds (e.g., explicit roles) and pins, so checking out 3c020d9c6b734d8f8f13a293bd11b175192a7ae1
shows more relevant errors.
If I replace default_role = "autolink"
with default_role = "py:obj"
, the "Summarised items should not include the current module" warnings go away (and a new set of resolution errors appear), which indicates that the problem is indeed with autolink.
A
Sphinx 7.4.7 has been released with a fix.
A
Thanks for looking into this issue. I'm however still seeing it with sphinx 7.4.7:
git clone https://github.com/abey79/vpype
cd vpype
git checkout 383b03b6be2161bc27f818711df1f2473e80245a
just install # poetry install -E all --with docs,dev
just docs-clean # rm -rf docs/_build docs/api
just docs-build # sphinx-build -b html docs docs/_build
(requires poetry, pipx install poetry
is fine)
The commit comes from this dependabot PR: https://github.com/abey79/vpype/pull/754 Previously using 7.3.7 with no issue.
We are also still seeing this for 7.4.7 on scikit-image's side, https://github.com/scikit-image/scikit-image/issues/7485.
NetworkX is still seeing this as well with sphinx 7.4.7. FWIW networkx's docs are configured with obj
as the default role.
A minimal reproducer would be really helpful -- there are a lot of moving parts in autosummary
, so reducing the problem domain does help a lot.
A
NetworkX is still seeing this as well with sphinx 7.4.7. FWIW networkx's docs are configured with obj as the default role.
In NetworkX's case it turns out this was the warning working as intended. There were indeed autosummary directives that specified the redundant parent module in file where the .. currentmodule
had already been set (xref networkx/networkx#7599). I only noticed this after a bit of grepping the doc source, as my first pass through the sphinx build log didn't give any indication where the warnings originated. Apologies for the noise!
Describe the bug
As of release 7.4.4, a new warning was added in
autosummary
in the line https://github.com/sphinx-doc/sphinx/blob/1e1356506ddd510df1e8d1a3c35f68a07752d784/sphinx/ext/autosummary/__init__.py#L644.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:The warnings are emitted because the generated documentation uses
autosummary
directive inside anautomodule
directive. This is a snippet from the generated documentation.How to Reproduce
conf.py
index.rst
Create the pkg with
Run sphinx with
It emits warnings and fails build with
-W
.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 withinautosummary
need to be updated to not include the package name when documenting it?Environment Information
Sphinx extensions
Additional context
No response