fix: support tsam_xarray 0.6.5 by using cluster_counts - #755
Merged
Conversation
Contributor
📝 WalkthroughWalkthroughThe reduced flow-system builder now sources cluster weights from aggregation cluster counts. Optional and development dependency requirements are updated to tsam_xarray 0.6.5. ChangesReduced clustering weights
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
tsam_xarray 0.6.5 renamed AggregationResult.cluster_weights to cluster_counts, keeping the old name as a deprecated property. Because the test suite promotes warnings to errors, the resulting FutureWarning fails 254 of 286 clustering tests on any environment that resolves to 0.6.5 -- which the current `full` floor of >= 0.6.1 already permits. cluster_counts does not exist before 0.6.5, so the floor moves with the rename rather than merely allowing the new version. 0.6.5 also vectorises unsegmented disaggregation, which makes expand() ~3.6x faster with no changes on our side: 0.262s -> 0.073s on a 3-year, 40-cluster, 84-variable system (min of 10 runs). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
FBumann
force-pushed
the
chore/tsam-xarray-0.6.5
branch
from
July 27, 2026 12:48
7220a64 to
0bdedf8
Compare
This was referenced Jul 27, 2026
FBumann
added a commit
that referenced
this pull request
Jul 27, 2026
tsam_xarray 0.6.5 renamed AggregationResult.cluster_weights to cluster_counts, keeping the old name as a deprecated property. The `full` extra allows >= 0.6.1, so a fresh install resolves to 0.6.5 and every cluster() call emits a FutureWarning -- and fails outright under -W error, which is how the test suite runs: 254 of 286 clustering tests failed on 0.6.5 before this change. cluster_counts does not exist before 0.6.5, so the floor moves with the rename rather than merely allowing the new version. This shipped in neither 8.0.0 nor its predecessor: #755 carried the same change but was retargeted onto an intermediate branch that merged into main first, so it landed on that branch instead of main. Co-authored-by: Claude Opus 5 (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.
Problem
tsam_xarray0.6.5 renamedAggregationResult.cluster_weightstocluster_counts, keeping the old name as a deprecated property. Since our pytest config promotes warnings to errors (pyproject.toml:214), the resultingFutureWarningfails almost the entire clustering suite on any environment that resolves to 0.6.5 — and thefullextra's current floor of>= 0.6.1, < 1already permits it, so a fresh install hits this today.tests/test_clusteringonmain:mainEvery one of the 254 failures is the same
FutureWarning: AggregationResult.cluster_weights is deprecated; use cluster_counts instead.Change
transform_accessor.py—cluster_weights→cluster_countsinbuild_cluster_weightspyproject.toml—full:>= 0.6.1→>= 0.6.5;dev:==0.6.1→==0.6.5cluster_countsdoes not exist before 0.6.5, so the floor has to move with the rename rather than merely allowing the new version. The two changes are coupled and can't land separately.Bonus: expand() gets ~3.6x faster
0.6.5 also vectorises unsegmented disaggregation, which speeds up
expand()with no changes on our side. Measured on a 3-year, 40-cluster, 84-variable system, min of 10 runs:expand()cluster()is unaffected (0.096 s vs 0.095 s, within noise). Users on thefullextra already resolved to 0.6.5 and have this; the exact pin indevwas holding CI and development environments on the slow path.Note for #748
This touches
build_cluster_weights, which #748 (reapply #739) also rewrites. Whoever lands that should keepcluster_counts— the rename is independent of the dim-naming work and is required for 0.6.5 either way.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Chores