feat(configurator): convert ConfigMulti and ConfigEntsoe to dataclasses#342
Merged
Conversation
@DataClass with field(default_factory=...) for the mutable/Timedelta defaults and __post_init__ -> validate_config(). _PARAM_NAMES is now derived from dataclasses.fields() instead of a hand-maintained tuple, removing the field-vs-param drift hazard. get_params()/set_params() surface (periods__* deep notation, ValueError on unknown params, round-trip stability) unchanged; only __eq__/__repr__ are newly auto-generated -> minor bump. Regenerated config reference pages. Refs: GitLab #4 / Option 3 (RunState migration ADR) Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Summary
Step 4 / final item of the RunState migration ADR (GitLab #4, Option 3): convert
ConfigMultiandConfigEntsoeto@dataclasses, removing the hand-maintained_PARAM_NAMESdrift hazard.@dataclassauto-generates__init__/__repr__/__eq__; the 66/67 params become field declarations in the same order (preservesget_paramskey order).periods,lags_consider,train_size,delta_val; +retrain_max_agefor ENTSO-E) usefield(default_factory=...).validate_config(self)moved into__post_init__._PARAM_NAMESis now derived fromdataclasses.fields()(kept as a class attribute for the ~15 tests that read it) — it can no longer drift from the fields.Non-breaking → minor bump
Public surface unchanged: keyword constructor, all defaults,
get_params/set_paramsincl.periods__*deep notation (15 keys),ValueErroron unknown params. Only__eq__/__repr__become value-based (auto-generated) — nothing hashes a config or relies on identity equality.feat:→ 19.1.0.Verification
{python}cells execute)Refs: GitLab #4 / Option 3 (RunState migration ADR)