Repository navigation
DM-56680: Stop using the tuple interface of intersphinx inventory items in autotypes - #557
Merged
Merged
Conversation
Sphinx 8.2 deprecated the tuple interface of intersphinx inventory items and Sphinx 10 removes it. Read the item's uri attribute when it has one, and index it as a tuple only on Sphinx 8.0 and 8.1, where inventory items are still plain tuples.
Documentation preview
Build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
documenteer.ext.autotypes.xrefsread an intersphinx inventory item's URI asentries[name][2]in two places (_resolve_intersphinxand_intersphinx_terminal_index). Sphinx 8.2 deprecated that tuple interface (RemovedInSphinx10Warning) and Sphinx 10 removes it._inventory_item_urihelper, which reads the item'suriattribute and falls back toitem[2]only when the item has none.pyproject.tomlallowsSphinx>=8: I checked Sphinx 8.0.2 and 8.1.3, and there inventory items are still plain tuples with nouriattribute (_InventoryItemfirst appears in 8.2.0). Keeping the fallback avoids raising the Sphinx floor.cast("str", ...)wrappers and the now-unusedcastimport are gone.Validation steps
nox -s "test-3.13(sphinx='8')","test-3.13(sphinx='9')", and"test-3.13(sphinx='dev')": 1182 passed on each.test_autotypes_inherited_docstring_linksnow asserts the build emits no "tuple interface" warning, and two unit tests cover the helper for a plain tuple and for an attribute-style item.RemovedInSphinx10Warningfrom any source, which covers the issue's "grep before widening to Sphinx 10" item for the current test suite.typing-3.13on Sphinx 8 and 9, andnox -s lint, pass.Not run: the test suite against Sphinx 8.0 or 8.1 (the nox
sphinx='8'session resolves a later 8.x); the tuple fallback for those versions is covered by the unit test only.References
Closes #556