Skip to content

Drop Python 3.8 support and modernize type hints#31

Merged
shenanigansd merged 1 commit into
mainfrom
claude/determined-hawking-Lm3XK
May 31, 2026
Merged

Drop Python 3.8 support and modernize type hints#31
shenanigansd merged 1 commit into
mainfrom
claude/determined-hawking-Lm3XK

Conversation

@shenanigansd
Copy link
Copy Markdown
Member

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 annotations statements across the codebase and updates enum usage to use StrEnum instead of Enum, which are now available as standard library features in Python 3.9+.

Key Changes

  • Removed from __future__ import annotations from 11 files (no longer needed in Python 3.9+)
  • Changed CardType from Enum to StrEnum for cleaner string-based enum handling
  • Updated ACTION_TYPES type annotation from dict[str, type[PlayCard | CastInstant | PassPriority]] to the more maintainable dict[str, type[Action]]

Implementation Details

The removal of from __future__ import annotations is safe because:

  • PEP 563 (postponed evaluation of annotations) is now the default behavior in Python 3.10+
  • For Python 3.9, the codebase doesn't rely on forward references that would require the future import
  • This simplifies imports and reduces boilerplate

The switch to StrEnum provides better type safety for string-based enums and is more idiomatic for Python 3.11+.

https://claude.ai/code/session_01Sntsy7nFtkxGJAHMVZAwGf

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
Copy link
Copy Markdown

codecov Bot commented May 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (02cd5fa) to head (8f56a6d).
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

@shenanigansd shenanigansd merged commit bdece94 into main May 31, 2026
14 checks passed
@shenanigansd shenanigansd deleted the claude/determined-hawking-Lm3XK branch May 31, 2026 17:21
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