Skip to content

fix: suppress tsam 3.3.0 ClusterConfig.weights deprecation#666

Closed
FBumann wants to merge 1 commit intomainfrom
fix/tsam-deprecation-warning
Closed

fix: suppress tsam 3.3.0 ClusterConfig.weights deprecation#666
FBumann wants to merge 1 commit intomainfrom
fix/tsam-deprecation-warning

Conversation

@FBumann
Copy link
Copy Markdown
Member

@FBumann FBumann commented Apr 16, 2026

Summary

Test plan

  • python -W error::DeprecationWarning clustering call completes without error
  • All clustering tests pass (244 passed, 4 pre-existing failures unrelated)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated tsam dependency minimum version requirement to 3.3.0 for the full installation profile.

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>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 16, 2026

📝 Walkthrough

Walkthrough

These 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

Cohort / File(s) Summary
Dependency Update
pyproject.toml
Updated minimum tsam version from 3.1.2 to 3.3.0 in the full optional dependencies.
Warning Suppression
flixopt/transform_accessor.py
Extended warning filter in cluster() method to suppress DeprecationWarning matching pattern .*Passing weights via ClusterConfig.* alongside existing UserWarning suppression.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • flixopt#622: Updates the tsam version constraint in pyproject.toml, directly related to this PR's dependency upgrade.

Poem

🐰 A tiny hop to tsam's new ground,
Deprecation warnings gently drowned,
With version bumps and filters bright,
The clustering flows just right! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: suppressing a deprecation warning from tsam 3.3.0 related to ClusterConfig.weights.
Description check ✅ Passed The description covers the key context (CI failure, deprecation warning suppression), includes a test plan with concrete verification steps, and explains the temporary nature of the fix.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tsam-deprecation-warning

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
flixopt/transform_accessor.py (1)

1788-1790: Scope the deprecation filter to tsam for safer suppression.

At lines 1788–1790, the message-based filter works, but adding a module regex 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

📥 Commits

Reviewing files that changed from the base of the PR and between 89a146f and e3bbf99.

📒 Files selected for processing (2)
  • flixopt/transform_accessor.py
  • pyproject.toml

@FBumann FBumann closed this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant