Repository navigation
Fix generate_figures crashing with polars 2 - #224
Closed
CodyCBakerPhD wants to merge 3 commits into
Closed
CodyCBakerPhD wants to merge 3 commits into
CodyCBakerPhD wants to merge 3 commits into
Conversation
`nwb_benchmarks generate_figures` stopped partway through with `ArgumentRemovedError` when polars 2 is installed: the environment preprocessing labels each environment with its timepoint through `Expr.replace(mapping, default=None)`, and polars 2.0 removed the `default` argument of `replace`. polars is unpinned, so a fresh install gets 2.x. The figures that #221 added are written before that point, but the run then crashes in `plot_performance_across_versions`. `Expr.replace_strict(mapping, default=None)` does the same mapping (environments without a timepoint become null) and exists since polars 1.0, so this works with both 1.x and 2.x. Adds a test for the timepoint labeling, which fails with the old call under polars 2. Package version 0.4.2 -> 0.4.3 (patch). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019XGZPsK77kY9cukQuY4a7R
Collaborator
Author
|
with #227 do we actually need this? |
#227 released 0.4.3 on main, so after merging main this branch carried the same version and the version check failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019XGZPsK77kY9cukQuY4a7R
Collaborator
Author
|
Not for now. With #227, anyone who installs the This PR only matters in two cases:
So either close this and keep the pin, or merge it and drop the pin in the same PR. I'd lean towards the second, but it's your call. Generated by Claude Code Generated by Claude Code |
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
Follow-up to #221. On a fresh install,
nwb_benchmarks generate_figurescrashes partway through:#227 has since pinned
polars<2in thedatabasegroup to avoid the crash. This PR fixes the call itself, so the code also works under polars 2. With this merged, the pin is no longer needed for this call. This PR leaves the pin and its comment inpyproject.tomlas they are.Change
_preprocess_environmentsusesExpr.replace_strict(mapping, default=None). It does the same mapping: environments without a timepoint become null. It has existed since polars 1.0, so it works on both 1.x and 2.x.tests/test_environment_timepoints.pychecks that a known environment ID gets its timepoint and an unknown one gets null. Under polars 2 it fails with the error above on the old line and passes with the fix.DATABASE_VERSIONis unchanged.Testing
dev@5733241. The run finishes and writes every figure, the summary tables, bothperformance_over_time_*figures andskipped_outputs.txt. Before the fix it crashed at the line above. This run predates the merge ofmain(Included the re-hashed Python 3.13 environment in the 2026-10-07 timepoint #225, Pinned polars below 2 for the database group #227) into this branch.main:tests/test_environment_timepoints.py,tests/test_incremental_visualization.pyand Included the re-hashed Python 3.13 environment in the 2026-10-07 timepoint #225'stests/test_equivalent_environments.pypass, 9 tests, under both polars 2.1.0 and 1.44.2.tests/needs the full benchmark stack. CI covers it.Generated by Claude Code