Merged
Conversation
- Update sphinx dependency to allow version 9 (`sphinx>=7,<10`) - Add Sphinx 9.0 to CI test matrix (Ubuntu and Windows) - Bump myst-parser dependency to `>=4,<6` - Fix test compatibility with docutils 0.22+ boolean attribute serialization (normalizes `"1"`/`"0"` back to `"True"`/`"False"` in XML output)
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Pull request overview
This PR adds support for Sphinx 9.x while maintaining backward compatibility with Sphinx 7.x and 8.x. The changes address a breaking change in docutils 0.22+ regarding boolean attribute serialization in XML output.
Changes:
- Updated dependency version constraints to support Sphinx 9 and myst-parser 4-5
- Added Sphinx 9.0 to the CI test matrix for Ubuntu and Windows environments
- Introduced XML normalization fixture to handle docutils 0.22+ boolean serialization changes
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pyproject.toml | Updated version constraints for sphinx (<10) and myst-parser (>=4,<6) dependencies |
| .github/workflows/ci.yml | Added Sphinx 9.0 testing to CI matrix for Ubuntu and Windows |
| tests/conftest.py | Added normalize_doctree_xml fixture to normalize boolean attributes across docutils versions |
| tests/test_snippets.py | Updated test functions to use the new normalize_doctree_xml fixture |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was
linked to
issues
Jan 19, 2026
Closed
amotl
reviewed
Jan 20, 2026
Comment on lines
+98
to
+128
| @pytest.fixture | ||
| def normalize_doctree_xml(): | ||
| """Normalize docutils XML output for cross-version compatibility. | ||
|
|
||
| In docutils 0.22+, boolean attributes are serialized as "1"/"0" | ||
| instead of "True"/"False". This function normalizes to the old format | ||
| for consistent test fixtures. | ||
| """ | ||
|
|
||
| def _normalize(text: str) -> str: | ||
| if DOCUTILS_0_22_PLUS: | ||
| # Normalize new format (1/0) to old format (1/0) | ||
| # Only replace when it's clearly a boolean attribute value | ||
| # Pattern: attribute="1" or attribute="0" | ||
| attrs = [ | ||
| "checked", | ||
| "force", | ||
| "has_title", | ||
| "internal", | ||
| "is_div", | ||
| "linenos", | ||
| "opened", | ||
| "refexplicit", | ||
| "refwarn", | ||
| "selected", | ||
| ] | ||
| text = re.sub(rf' ({"|".join(attrs)})="1"', r' \1="True"', text) | ||
| text = re.sub(rf' ({"|".join(attrs)})="0"', r' \1="False"', text) | ||
| return text | ||
|
|
||
| return _normalize |
There was a problem hiding this comment.
We could also use that in downstream projects. Maybe relocate to sphinx_design_elements.testing, to be able to ship it with the package?
This was referenced Jan 20, 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.
This PR adds support for Sphinx 9.x while maintaining backward compatibility with Sphinx 7.x and 8.x. The changes address a breaking change in docutils 0.22+ regarding boolean attribute serialization in XML output.
Changes: