Drop Python 3.8 support and modernize type hints#31
Merged
Conversation
The project requires Python >=3.14, where PEP 649 defers annotation evaluation by default, so `from __future__ import annotations` is redundant. Remove it from all modules (forward references such as the `Effect` alias and `_no_effect` in state.py keep working under deferred evaluation). Additional modernizations: - CardType now subclasses enum.StrEnum instead of Enum. - ACTION_TYPES is annotated with the existing `Action` type alias (`dict[str, type[Action]]`) instead of respelling the union. All tests, ruff, ruff format, mypy --strict, and ty pass on 3.14. https://claude.ai/code/session_01Sntsy7nFtkxGJAHMVZAwGf
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #31 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 11 11
Lines 521 496 -25
Branches 26 26
=========================================
- Hits 521 496 -25 ☔ View full report in Codecov by Sentry. |
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 modernizes the codebase by removing support for Python 3.8 and leveraging features available in Python 3.9+.
Summary
Removes
from __future__ import annotationsstatements across the codebase and updates enum usage to useStrEnuminstead ofEnum, which are now available as standard library features in Python 3.9+.Key Changes
from __future__ import annotationsfrom 11 files (no longer needed in Python 3.9+)CardTypefromEnumtoStrEnumfor cleaner string-based enum handlingACTION_TYPEStype annotation fromdict[str, type[PlayCard | CastInstant | PassPriority]]to the more maintainabledict[str, type[Action]]Implementation Details
The removal of
from __future__ import annotationsis safe because:The switch to
StrEnumprovides better type safety for string-based enums and is more idiomatic for Python 3.11+.https://claude.ai/code/session_01Sntsy7nFtkxGJAHMVZAwGf