fix: make PEP 604 union annotations import-safe on Python 3.9#12
Merged
Conversation
CI (matrix incl. 3.9; requires-python >=3.9) failed collecting test_norgate_provider.py: `dict | None` in norgate.get_symbol_metadata is evaluated at import time and only works on 3.10+. cftc._download_year had the same latent `Path | None`. Add `from __future__ import annotations` to both provider modules so all annotations are lazy strings, never evaluated at runtime. No behaviour change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Fixes the red CI on
mainafter the volume-reconstruction feature landed (#11).Failure
dict | None(PEP 604) is evaluated at import time and only works on Python 3.10+. The CI matrix includes 3.9 (requires-python = ">=3.9"), so collectingtest_norgate_provider.py— which imports thenorgateprovider — fails.cftc._download_yearhad the same latentPath | None.Fix
Add
from __future__ import annotationsto both provider modules, so every annotation is a lazy string and never evaluated at runtime. No behaviour change, and it future-proofs any further annotations in these files.Verified
'dict | None','Path | None') → import-safe on 3.9.src/for any other PEP 604 unions — the only two are the ones fixed here.🤖 Generated with Claude Code