Unpin polars v2#12627
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12627 +/- ##
==========================================
- Coverage 90.66% 90.65% -0.02%
==========================================
Files 433 433
Lines 30193 30197 +4
==========================================
Hits 27375 27375
- Misses 2818 2822 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Pull request overview
This PR removes the upper bound constraint on the polars dependency (previously pinned to <1.35), allowing the project to use polars v2. The changes include necessary API migrations and refactoring to maintain compatibility with the newer polars version.
Changes:
- Unpinned polars version constraint in pyproject.toml (from
>=1.32.3, <1.35to>=1.32.3) - Migrated deprecated polars APIs (
map_elementsto expression-based operations andmap_batches) - Vectorized distribution transform functions to handle both scalar and array inputs using numpy operations
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Removed upper bound constraint on polars dependency |
| uv.lock | Updated lock file with polars 1.37.1 and polars-runtime-32 1.37.1, jupyterlab 4.5.2 |
| tests/ert/unit_tests/config/test_gen_kw_config.py | Added warning filter for expected numpy overflow warning in lognormal test |
| tests/ert/ui_tests/cli/test_field_parameter.py | Migrated from map_elements to expression-based polars operations (pl.when, pl.sum_horizontal, pl.max_horizontal); added column reordering logic for robust DataFrame comparison |
| tests/ert/ui_tests/cli/snapshots/test_field_parameter/.../enif_heat_snapshot.csv | Updated snapshot data reflecting polars v2 behavior |
| src/ert/storage/local_ensemble.py | Migrated map_elements to map_batches with proper Series-to-numpy conversion; improved isinstance check for numpy integers |
| src/ert/config/rft_config.py | Added empty array check to prevent DataFrame construction issues |
| src/ert/config/parameter_config.py | Updated type hints for transform_data() to support FloatOrArray |
| src/ert/config/gen_kw_config.py | Updated type hints and imports for FloatOrArray support |
| src/ert/config/distribution.py | Vectorized all transform functions to support both scalar and array inputs using numpy operations; changed from math module to numpy for consistency |
|
Is this ready for review? |
9bd9179 to
235ffb8
Compare
235ffb8 to
3688fa1
Compare
Issue
Resolves #my_issue
Approach
Short description of the approach
(Screenshot of new behavior in GUI if applicable)
git rebase -i main --exec 'just rapid-tests')When applicable