Remove pydantic setting use_enum_values=True#12464
Conversation
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12464 +/- ##
==========================================
- Coverage 90.60% 90.58% -0.02%
==========================================
Files 433 433
Lines 29486 29492 +6
==========================================
Hits 26716 26716
- Misses 2770 2776 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
9524851 to
c81802e
Compare
c81802e to
22456f8
Compare
There was a problem hiding this comment.
Pull request overview
This PR removes the pydantic use_enum_values=True configuration setting, reverting to pydantic's default behavior where enum fields are represented as enum instances rather than their string values. This change ensures that type hints accurately reflect runtime behavior, particularly for the QueueConfig.queue_system field which should be a QueueSystem enum instance, not a string.
Key Changes:
- Removed
use_enum_values=TruefromQueueOptionsbase model configuration - Added StrEnum representer to handle YAML serialization of enum instances in Everest config dumping
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/ert/config/queue_config.py |
Removes use_enum_values=True from QueueOptions model config, ensuring enum fields remain as enum instances |
src/everest/config/everest_config.py |
Adds StrEnum representer for YAML serialization and necessary imports to properly serialize enum instances when dumping config to YAML |
CodSpeed Performance ReportMerging #12464 will not alter performanceComparing Summary
|
d931010 to
9e79a35
Compare
|
Todo: Check all yaml.dump in the Everest codebase and make it into a common function. |
f619077 to
a2ad5f3
Compare
Reverting back to pydantic default behaviour. This implies at least that the queue_system member of QueueConfig is always of type QueueSystem, and never just a `str`, which breaks what the type hints say.
a2ad5f3 to
c31a1a0
Compare
Will this be verification for this PR, or a separate issue? |
This has now been fixed in this PR. |
Reverting back to pydantic default behaviour. This implies at least that the queue_system member of QueueConfig is always of type QueueSystem, and never just a
str, which breaks what the type hints say.Issue
Related to #12462
Approach
Modify ruamel instead.
git rebase -i main --exec 'just rapid-tests')When applicable