Skip to content

Fix sphinx-doc__sphinx-9711#14383

Closed
piyushhhxyz wants to merge 2 commits intosphinx-doc:masterfrom
piyushhhxyz:fix-sphinx-doc__sphinx-9711
Closed

Fix sphinx-doc__sphinx-9711#14383
piyushhhxyz wants to merge 2 commits intosphinx-doc:masterfrom
piyushhhxyz:fix-sphinx-doc__sphinx-9711

Conversation

@piyushhhxyz
Copy link
Copy Markdown

Fix: needs_extensions checks versions using strings

Problem

The needs_extensions check in sphinx/extension.py compared version strings lexicographically (e.g., '0.6' > '0.10' evaluates to True), which incorrectly rejects valid newer versions like 0.10.0 when the minimum required is 0.6.0.

Solution

Changed the version comparison to use packaging.version.parse() for proper semantic version comparison. Sphinx already depends on packaging, so no new dependencies are needed.

Changes

  • sphinx/extension.py: Import parse from packaging.version and use it to compare versions in verify_needs_extensions()

Fixes #9711

The needs_extensions check was comparing version strings lexicographically,
which incorrectly treats '0.6' > '0.10'. This changes the comparison to use
packaging.version.parse() for proper semantic version comparison.

Fixes sphinx-doc#9711
The needs_extensions check was comparing version strings using plain string
comparison (reqversion > extension.version), which incorrectly treats '0.6'
as greater than '0.10' because string comparison is character-by-character.

This fix uses packaging.version.parse() for proper semantic version comparison,
so that '0.10.0' is correctly recognized as newer than '0.6.0'.

Fixes sphinx-doc#9711
@piyushhhxyz piyushhhxyz deleted the fix-sphinx-doc__sphinx-9711 branch April 10, 2026 11:12
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.

1 participant