Skip to content

DOC: Intersphinx references to common items break on latest docs #64028

@casblaauw

Description

@casblaauw

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/pandas-docs/stable/objects.inv

Documentation problem

Since the release of pandas 3.0.0, our documentation-building CI (using sphinx autodoc) stopped recognising simple classes like pd.DataFrame and pd.Index as valid targets in the pandas documentation, which broke the automatically generated class links (documented in aertslab/CREsted#181).

<unknown>:1: WARNING: py:class reference target not found: pandas.core.indexes.base.Index [ref.class]
<unknown>:1: WARNING: py:class reference target not found: pandas.core.frame.DataFrame [ref.class]
<unknown>:1: WARNING: py:class reference target not found: pandas.core.frame.DataFrame [ref.class]
<unknown>:1: WARNING: py:class reference target not found: pandas.core.frame.DataFrame [ref.class]
<unknown>:1: WARNING: py:class reference target not found: pandas.core.frame.DataFrame [ref.class]
<unknown>:1: WARNING: py:class reference target not found: pandas.core.frame.DataFrame [ref.class]

(In our case, since we build the docs strictly, this even prevents from building them altogether.) These warnings are from type hints (to normal pd.DataFrame/pd.Index) that would normally be turned into links to the pd.DataFrame/pd.Index docs, and indeed worked fine up to 2 weeks ago.

This seems to be related to the change of the __module__ attribute. As shown in the warnings above, on pandas 2.x, pd.DataFrame's __module__ is used, and it's automatically expanded to pandas.core.frame.DataFrame. This is then requested to the pandas docs, which previously resolved this back to pandas.DataFrame. See for example the DataFrame link here. However, since the release of 3.0.0, this is no longer available in the stable (or dev) docs:

> uvx sphobjinv suggest -u https://pandas.pydata.org/pandas-docs/stable/objects.inv pandas.core.frame.DataFrame
Project: pandas
Version: 3.0.0
No results found with score at/above current threshold of 75.

> uvx sphobjinv suggest -u https://pandas.pydata.org/pandas-docs/version/2.3/objects.inv pandas.core.frame.DataFrame
Project: pandas
Version: 2.3.3
1 result found at/above current threshold of 75.
:py:class:`pandas.core.frame.DataFrame`

That means any sphinx documentation building that isn't already running on pandas 3.0.0 will automatically resolve pd.DataFrame to pandas.core.frame.DataFrame, and their link to the pandas documentation will break.
We can fix this problem locally by changing the pandas docs location from https://pandas.pydata.org/pandas-docs/stable/ to https://pandas.pydata.org/pandas-docs/version/2.3/, but this keeps the references always pointing to outdated pandas docs, which I don't think is a preferable situation.

Suggested fix for documentation

Is it possible to add aliases to pandas' sphinx objects list to accept the old definition paths and point them to the new public-facing names?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Closing CandidateMay be closeable, needs more eyeballsDocsNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions