From e3bbf99a8dac3d4e69022e1cf3374bad4788b003 Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Thu, 16 Apr 2026 13:28:27 +0200 Subject: [PATCH] fix: suppress tsam 3.3.0 ClusterConfig.weights deprecation warning 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) --- flixopt/transform_accessor.py | 7 ++++++- pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/flixopt/transform_accessor.py b/flixopt/transform_accessor.py index f7a3698cc..b8cdb8020 100644 --- a/flixopt/transform_accessor.py +++ b/flixopt/transform_accessor.py @@ -1780,9 +1780,14 @@ def to_clean_key(period_label, scenario_label) -> tuple: if selector: logger.info(f'Clustering {", ".join(f"{k}={v}" for k, v in selector.items())}...') - # Suppress tsam warning about minimal value constraints (informational, not actionable) + # Suppress tsam warnings: + # - minimal value constraints (informational, not actionable) + # - ClusterConfig.weights deprecation (will be addressed in clustering refactor) with warnings.catch_warnings(): warnings.filterwarnings('ignore', category=UserWarning, message='.*minimal value.*exceeds.*') + warnings.filterwarnings( + 'ignore', category=DeprecationWarning, message='.*Passing weights via ClusterConfig.*' + ) # Build ClusterConfig with auto-calculated weights, filtered to available columns clustering_weights = self._calculate_clustering_weights(ds_slice) diff --git a/pyproject.toml b/pyproject.toml index 0038c7481..d8c83b24f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,7 +63,7 @@ network_viz = [ # Full feature set (everything except dev tools) full = [ - "tsam >= 3.1.2, < 4", # Time series aggregation for clustering (3.0.0 and 3.1.0 yanked) + "tsam >= 3.3.0, < 4", # Time series aggregation for clustering (3.0.0 and 3.1.0 yanked) "pyvis==0.3.2", # Visualizing FlowSystem Network "scipy >= 1.15.1, < 2", # Used by tsam. Prior versions have conflict with highspy. See https://github.com/scipy/scipy/issues/22257 "gurobipy >= 10.0.0, < 14; python_version < '3.14'", # No Python 3.14 wheels yet (expected Q1 2026)