Skip to content

Use immutable mappings and other cleanups#213

Merged
hmgaudecker merged 16 commits intomainfrom
fix-136
Jan 22, 2026
Merged

Use immutable mappings and other cleanups#213
hmgaudecker merged 16 commits intomainfrom
fix-136

Conversation

@hmgaudecker
Copy link
Member

@hmgaudecker hmgaudecker commented Jan 18, 2026

Fixes #136

  • Replace dict by MappingProxyType, use Mapping for annotations. Note: These changes require dags #67
  • Remove the name field from Regime. We now just pass regimes={"alive": regime_a, "dead": regime_b}. In the initialisation of Model, we make sure its keys and the fields of regime_id_class line up. Then do everything based on a mapping of regime_names_to_ids. Gets rid of the awkward typing we had before.
  • Remove if TYPE_CHECKING entirely -- too much developer time is being spent on this in Python 3.14 at essentially no runtime gain

@hmgaudecker hmgaudecker requested a review from timmens January 19, 2026 14:41
Copy link
Member

@timmens timmens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice actually! Thanks a lot 🎉

No showstoppers, the only thing I noticed is that the CLAUDE.md file seems to be outdated with regard to some of the API changes.

@hmgaudecker hmgaudecker changed the title Use immutable mappings Use immutable mappings and other cleanups Jan 22, 2026
@hmgaudecker hmgaudecker merged commit 8a582e3 into main Jan 22, 2026
8 checks passed
@hmgaudecker hmgaudecker deleted the fix-136 branch January 22, 2026 16:31
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.

ENH: Use immutable dictionaries to store state / action data

2 participants