Fix Python 3.8/3.9 compatibility: replace pipe union syntax with typing.Optional #115
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 of Changes
Fixed Python 3.8/3.9 compatibility by replacing Python 3.10+ type union syntax (
X | Y) withtyping.Optional. Added missinghypothesistest dependency and configured linting rules appropriately for test files.Core Issue:
Files Modified:
pymars/_forward.py,pymars/_pruning.py: Replaced pipe union syntax withOptional(6 occurrences)tox.ini: Addedhypothesisdependency, added[gh-actions]Python version mappingpyproject.toml: Excluded S101 (asserts) and E501 (line length) from test filesmypy.ini: Updatedpython_version = 3.9(mypy dropped 3.8 support)Type of Change
Testing
All 107 tests pass locally on Python 3.12. CodeQL security scan: 0 alerts.
Checklist
Related Issues
Fixes #114
Additional Context
Changes are minimal and surgical—only type annotations and configuration. No public API changes. Ready for CI validation across Python 3.8-3.12 matrix.
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.