Skip to content

🔧 Add sphinx-needs 8.0.0 compatibility#133

Merged
patdhlk merged 12 commits into
useblocks:masterfrom
cpolzer:master
May 8, 2026
Merged

🔧 Add sphinx-needs 8.0.0 compatibility#133
patdhlk merged 12 commits into
useblocks:masterfrom
cpolzer:master

Conversation

@cpolzer
Copy link
Copy Markdown
Contributor

@cpolzer cpolzer commented Mar 23, 2026

Summary

  • 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
  • Add sphinx-needs 8.0.0 to the CI matrix and nox test matrix
  • Fix warning checks in tests to inspect stderr (where Sphinx actually writes warnings, not stdout)
  • Add test_test_file_renders_need_with_counts to catch regressions where int kwargs to add_need() are rejected

Test plan

  • Run nox -s "tests-3.12(sphinx='8.1.3', sphinx_needs='8.0.0')" and verify all tests pass
  • Run against an older sphinx-needs version (e.g. 6.3.0) to confirm backwards compatibility

Reason:

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. "

~chrstian polzer and others added 6 commits March 23, 2026 15:19
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
Copy link
Copy Markdown
Collaborator

@patdhlk patdhlk left a comment

Choose a reason for hiding this comment

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

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

Comment thread sphinxcontrib/test_reports/test_reports.py Outdated
Comment thread docs/conf.py
Comment thread tests/test_test_file.py
Comment thread tests/test_test_file.py Outdated
Christian Polzer and others added 5 commits April 13, 2026 22:12
# 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)
@patdhlk
Copy link
Copy Markdown
Collaborator

patdhlk commented May 6, 2026

@cpolzer only one ci issue then we are ready to go

Comment thread docs/changelog.rst
@patdhlk patdhlk self-requested a review May 8, 2026 09:59
@patdhlk patdhlk merged commit 947e58f into useblocks:master May 8, 2026
25 checks passed
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.

2 participants