Skip to content

fix(inventory): fix RemovedInSphinx10Warning#1079

Closed
lucascolley wants to merge 7 commits intoexecutablebooks:masterfrom
lucascolley:patch-1
Closed

fix(inventory): fix RemovedInSphinx10Warning#1079
lucascolley wants to merge 7 commits intoexecutablebooks:masterfrom
lucascolley:patch-1

Conversation

@lucascolley
Copy link
Copy Markdown

@lucascolley lucascolley commented Dec 16, 2025

closes gh-1078

Comment thread myst_parser/inventory.py Outdated
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll need to update uses as well

@bmunkholm
Copy link
Copy Markdown

@AA-Turner @lucascolley Do you intend to get this in any time soon? Our logs are severely flooded with thousands of these warnings :-).

@AA-Turner
Copy link
Copy Markdown
Contributor

Neither of us have commit privileges.

A

@bsipocz
Copy link
Copy Markdown
Member

bsipocz commented Mar 6, 2026

@chrisjsewell - could we please get this through the finish line and into a release? I hear lots of downstream asking for it.

chrisjsewell added a commit that referenced this pull request May 7, 2026
Fixes the deprecation warning from Sphinx >= 8.2:

```
RemovedInSphinx10Warning: The iter() interface for _InventoryItem objects is deprecated.
Please access the `project_name`, `project_version`, `uri`, and `displayname` attributes directly.
```

The previous code unpacked `_InventoryItem` as a tuple (`project,
version, loc, text = data[target]`), which triggers the warning.

This uses `hasattr` to detect whether the new attribute-based API is
available and falls back to tuple unpacking for older Sphinx versions.
This approach is more robust than version checking (cf. #1079 which used
`sphinx.__version_info__` — an attribute that doesn't exist; the correct
attribute is `sphinx.version_info`).

Note: the correct attribute name on `_InventoryItem` is `display_name`
(with underscore), despite the warning message saying `displayname`.
@chrisjsewell
Copy link
Copy Markdown
Member

Fixed in #1129

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sphinx 8.2 deprecation warning _InventoryItem.__iter__

5 participants