fix: suppress tsam 3.3.0 ClusterConfig.weights deprecation#666
fix: suppress tsam 3.3.0 ClusterConfig.weights deprecation#666
Conversation
The tsam 3.3.0 bump (#662) introduced a DeprecationWarning when passing weights via ClusterConfig, which breaks notebook execution in CI (warnings-as-errors). Suppress it until the clustering refactor (#654) migrates to the new top-level weights API. Also bumps the tsam minimum to >= 3.3.0 to match the pinned version. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThese changes update the tsam dependency requirement from >=3.1.2 to >=3.3.0 and add suppression for a DeprecationWarning in the clustering method that arises when passing weights through ClusterConfig with newer tsam versions. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
flixopt/transform_accessor.py (1)
1788-1790: Scope the deprecation filter totsamfor safer suppression.At lines 1788–1790, the message-based filter works, but adding a
moduleregex reduces accidental suppression of similarly-worded deprecations from other modules.Proposed hardening diff
- warnings.filterwarnings( - 'ignore', category=DeprecationWarning, message='.*Passing weights via ClusterConfig.*' - ) + warnings.filterwarnings( + 'ignore', + category=DeprecationWarning, + message=r'.*Passing weights via ClusterConfig.*', + module=r'^tsam(\.|$)', + )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@flixopt/transform_accessor.py` around lines 1788 - 1790, The current warnings.filterwarnings call that ignores DeprecationWarning matching '.*Passing weights via ClusterConfig.*' should be hardened to scope suppression to the tsam package only; update the warnings.filterwarnings invocation (the call site in transform_accessor.py) to include a module regex that targets tsam (e.g. '^tsam(\\.|$)') so only deprecations originating from tsam are suppressed while other modules' similar messages still appear.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@flixopt/transform_accessor.py`:
- Around line 1788-1790: The current warnings.filterwarnings call that ignores
DeprecationWarning matching '.*Passing weights via ClusterConfig.*' should be
hardened to scope suppression to the tsam package only; update the
warnings.filterwarnings invocation (the call site in transform_accessor.py) to
include a module regex that targets tsam (e.g. '^tsam(\\.|$)') so only
deprecations originating from tsam are suppressed while other modules' similar
messages still appear.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 062bac3f-196a-4d68-b53d-bb660ca9e728
📒 Files selected for processing (2)
flixopt/transform_accessor.pypyproject.toml
Summary
DeprecationWarningfrom tsam 3.3.0 when passingweightsviaClusterConfig— this broke doc deployment CI (run)>= 3.1.2to>= 3.3.0to match pinned versionweightsAPITest plan
python -W error::DeprecationWarningclustering call completes without error🤖 Generated with Claude Code
Summary by CodeRabbit