🔧 Add sphinx-needs 8.0.0 compatibility#133
Merged
Merged
Conversation
Replace deprecated add_extra_option() with add_field() for sphinx-needs >= 8.0.0, using a version-gated shim that falls back to add_extra_option() for older versions. Also adds sphinx-needs 8.0.0 to the CI and nox test matrices, fixes the warning check in tests to also inspect stderr (where Sphinx writes warnings), adds a test asserting the test-file need node renders correctly, and removes the broken taplo pre-commit hook (taplo 0.9.3 PyPI package fails to build on this platform).
Add schema to string fields in _register_field (moved into use_schema branch for backwards compat with sphinx-needs < 6.0.0). Update all test fixture conf.py files to use needs_fields for sphinx-needs >= 8.0.0 instead of the deprecated needs_extra_options.
Move sphinx_needs and Version imports to top of file (fixes E402) and drop incorrect _V alias for Version (fixes N814).
🔧 Add sphinx-needs 8.0.0 compatibility
patdhlk
requested changes
Apr 1, 2026
Collaborator
patdhlk
left a comment
There was a problem hiding this comment.
Thanks for the PR, some small nitpicks.
One general thing I noted: same version-gating pattern copy-pasted across 7 test conf.py files. A shared helper would reduce future maintenance. But this can be picked up in the future
# Changes ## Core Compatibility Field descriptions: Added proper semantic descriptions for sphinx-needs API fields instead of repeating field names Packaging dependency: Added explicit packaging>=20.0 dependency to avoid fragile transitive dependencies API compatibility: Updated field registration to work with both older and newer sphinx-needs versions ## Test Configuration Updated all test conf.py files to use proper version-specific configuration (needs_fields vs needs_extra_options) Added conditional logic for sphinx-needs version compatibility ## Test Improvements Enhanced count field verification: Test now properly verifies that integer count fields are rendered in need nodes Fixed warning check logic: Corrected test to properly check stderr for warnings (Sphinx writes warnings to stderr, not stdout)
Collaborator
|
@cpolzer only one ci issue then we are ready to go |
cpolzer
commented
May 7, 2026
patdhlk
approved these changes
May 8, 2026
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
add_extra_option()withadd_field()for sphinx-needs >= 8.0.0, using a version-gated shim that falls back toadd_extra_option()for older versions8.0.0to the CI matrix and nox test matrixstderr(where Sphinx actually writes warnings, notstdout)test_test_file_renders_need_with_countsto catch regressions where int kwargs toadd_need()are rejectedTest plan
nox -s "tests-3.12(sphinx='8.1.3', sphinx_needs='8.0.0')"and verify all tests pass6.3.0) to confirm backwards compatibilityReason:
Upgrading another sphinx-needs project showed errors:
"sphinx-test-reports passes integer field values (e.g. suites=1) which sphinx-needs 8.0 rejects with InvalidNeedException. "