Skip to content

Commit 60a3e65

Browse files
committed
Removed all deprecated items
1 parent 30c4a68 commit 60a3e65

14 files changed

Lines changed: 75 additions & 758 deletions

CHANGELOG.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ If upgrading from v2.x, see the [v3.0.0 release notes](https://github.com/flixOp
5151
5252
## [Unreleased] - ????-??-??
5353
54-
**Summary**: Renamed OnOff terminology to Status terminology for better alignment with PyPSA and unit commitment standards.
54+
**Summary**: Renamed OnOff terminology to Status terminology for better alignment with PyPSA and unit commitment standards. **All deprecated items from v4.x have been removed.**
5555
5656
### ✨ Added
5757
@@ -127,6 +127,44 @@ A partial backwards compatibility wrapper would be misleading, so we opted for a
127127
128128
### 🔥 Removed
129129
130+
**Modules removed:**
131+
- `calculation.py` module - Use `optimization.py` instead
132+
133+
**Classes removed:**
134+
- `Calculation`, `FullCalculation` → Use `Optimization`
135+
- `AggregatedCalculation` → Use `ClusteredOptimization`
136+
- `SegmentedCalculation` → Use `SegmentedOptimization`
137+
- `Aggregation` → Use `Clustering`
138+
- `AggregationParameters` → Use `ClusteringParameters`
139+
- `AggregationModel` → Use `ClusteringModel`
140+
- `CalculationResults` → Use `Results`
141+
- `SegmentedCalculationResults` → Use `SegmentedResults`
142+
143+
**Functions removed:**
144+
- `change_logging_level()` → Use `CONFIG.Logging.enable_console()`
145+
146+
**Methods removed:**
147+
- `Optimization._perform_aggregation()` → Use `_perform_clustering()`
148+
- `Optimization.calculate_aggregation_weights()` → Use `calculate_clustering_weights()`
149+
150+
**Parameters removed:**
151+
- `Optimization.active_timesteps` → Use `flow_system.sel(time=...)` or `flow_system.isel(time=...)`
152+
- `TimeSeriesData.from_dataarray()`: `aggregation_group` → Use `clustering_group`
153+
- `TimeSeriesData.from_dataarray()`: `aggregation_weight` → Use `clustering_weight`
154+
- `FlowSystem.weights` → Use `scenario_weights`
155+
- `Results.__init__()`: `flow_system` → Use `flow_system_data`
156+
- `Results` plotting methods: `indexer` → Use `select`
157+
- `Results.plot_heatmap()`: `heatmap_timeframes`, `heatmap_timesteps_per_frame` → Use `reshape_time`
158+
- `Results.plot_heatmap()`: `color_map` → Use `colors`
159+
160+
**Properties removed:**
161+
- `FlowSystem.all_elements` → Use dict-like interface (`flow_system['label']`, `.keys()`, `.values()`, `.items()`)
162+
- `FlowSystem.weights` → Use `scenario_weights`
163+
164+
**Features removed:**
165+
- Passing `Bus` objects directly to `Flow` → Pass bus label string instead and add Bus to FlowSystem
166+
- Using `Effect` objects in `EffectValues` → Use effect label strings instead
167+
130168
**Deprecated parameters removed** (all were deprecated in v4.0.0 or earlier):
131169
132170
**TimeSeriesData:**

flixopt/__init__.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414

1515
# Import commonly used classes and functions
1616
from . import linear_converters, plotting, results, solvers
17-
18-
# Import old Calculation classes for backwards compatibility (deprecated)
19-
from .calculation import AggregatedCalculation, FullCalculation, SegmentedCalculation
20-
from .clustering import AggregationParameters, ClusteringParameters # AggregationParameters is deprecated
17+
from .clustering import ClusteringParameters
2118
from .components import (
2219
LinearConverter,
2320
Sink,
@@ -26,20 +23,17 @@
2623
Storage,
2724
Transmission,
2825
)
29-
from .config import CONFIG, change_logging_level
26+
from .config import CONFIG
3027
from .core import TimeSeriesData
3128
from .effects import PENALTY_EFFECT_LABEL, Effect
3229
from .elements import Bus, Flow
3330
from .flow_system import FlowSystem
3431
from .interface import InvestParameters, Piece, Piecewise, PiecewiseConversion, PiecewiseEffects, StatusParameters
35-
36-
# Import new Optimization classes
3732
from .optimization import ClusteredOptimization, Optimization, SegmentedOptimization
3833

3934
__all__ = [
4035
'TimeSeriesData',
4136
'CONFIG',
42-
'change_logging_level',
4337
'Flow',
4438
'Bus',
4539
'Effect',
@@ -51,22 +45,16 @@
5145
'LinearConverter',
5246
'Transmission',
5347
'FlowSystem',
54-
# New Optimization classes (preferred)
5548
'Optimization',
5649
'ClusteredOptimization',
5750
'SegmentedOptimization',
58-
# Old Calculation classes (deprecated, for backwards compatibility)
59-
'FullCalculation',
60-
'AggregatedCalculation',
61-
'SegmentedCalculation',
6251
'InvestParameters',
6352
'StatusParameters',
6453
'Piece',
6554
'Piecewise',
6655
'PiecewiseConversion',
6756
'PiecewiseEffects',
6857
'ClusteringParameters',
69-
'AggregationParameters', # Deprecated, use ClusteringParameters
7058
'plotting',
7159
'results',
7260
'linear_converters',

flixopt/calculation.py

Lines changed: 0 additions & 177 deletions
This file was deleted.

flixopt/clustering.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@
99
import logging
1010
import pathlib
1111
import timeit
12-
import warnings as _warnings
1312
from typing import TYPE_CHECKING
1413

1514
import numpy as np
1615

17-
from .config import DEPRECATION_REMOVAL_VERSION
18-
1916
try:
2017
import tsam.timeseriesaggregation as tsam
2118

@@ -401,39 +398,3 @@ def _equate_indices(self, variable: linopy.Variable, indices: tuple[np.ndarray,
401398
var_k0.sum(dim='time') + var_k1.sum(dim='time') <= limit,
402399
short_name=f'limit_corrections|{variable.name}',
403400
)
404-
405-
406-
# ===== Deprecated aliases for backward compatibility =====
407-
408-
409-
def _create_deprecation_warning(old_name: str, new_name: str):
410-
"""Helper to create a deprecation warning"""
411-
_warnings.warn(
412-
f"'{old_name}' is deprecated and will be removed in v{DEPRECATION_REMOVAL_VERSION}. Use '{new_name}' instead.",
413-
DeprecationWarning,
414-
stacklevel=3,
415-
)
416-
417-
418-
class Aggregation(Clustering):
419-
"""Deprecated: Use Clustering instead."""
420-
421-
def __init__(self, *args, **kwargs):
422-
_create_deprecation_warning('Aggregation', 'Clustering')
423-
super().__init__(*args, **kwargs)
424-
425-
426-
class AggregationParameters(ClusteringParameters):
427-
"""Deprecated: Use ClusteringParameters instead."""
428-
429-
def __init__(self, *args, **kwargs):
430-
_create_deprecation_warning('AggregationParameters', 'ClusteringParameters')
431-
super().__init__(*args, **kwargs)
432-
433-
434-
class AggregationModel(ClusteringModel):
435-
"""Deprecated: Use ClusteringModel instead."""
436-
437-
def __init__(self, *args, **kwargs):
438-
_create_deprecation_warning('AggregationModel', 'ClusteringModel')
439-
super().__init__(*args, **kwargs)

flixopt/config.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
COLORLOG_AVAILABLE = False
2121
escape_codes = None
2222

23-
__all__ = ['CONFIG', 'change_logging_level', 'MultilineFormatter', 'SUCCESS_LEVEL']
23+
__all__ = ['CONFIG', 'MultilineFormatter', 'SUCCESS_LEVEL']
2424

2525
if COLORLOG_AVAILABLE:
2626
__all__.append('ColoredMultilineFormatter')
@@ -30,7 +30,7 @@
3030
logging.addLevelName(SUCCESS_LEVEL, 'SUCCESS')
3131

3232
# Deprecation removal version - update this when planning the next major version
33-
DEPRECATION_REMOVAL_VERSION = '5.0.0'
33+
DEPRECATION_REMOVAL_VERSION = '6.0.0'
3434

3535

3636
class MultilineFormatter(logging.Formatter):
@@ -808,23 +808,3 @@ def _apply_config_dict(cls, config_dict: dict) -> None:
808808
elif hasattr(cls, key) and key != 'logging':
809809
# Skip 'logging' as it requires special handling via CONFIG.Logging methods
810810
setattr(cls, key, value)
811-
812-
813-
def change_logging_level(level_name: str | int) -> None:
814-
"""Change the logging level for the flixopt logger.
815-
816-
Args:
817-
level_name: The logging level to set (DEBUG, INFO, WARNING, ERROR, CRITICAL or logging constant).
818-
819-
Examples:
820-
>>> change_logging_level('DEBUG') # deprecated
821-
>>> # Use this instead:
822-
>>> CONFIG.Logging.enable_console('DEBUG')
823-
"""
824-
warnings.warn(
825-
f'change_logging_level is deprecated and will be removed in version {DEPRECATION_REMOVAL_VERSION} '
826-
'Use CONFIG.Logging.enable_console(level) instead.',
827-
DeprecationWarning,
828-
stacklevel=2,
829-
)
830-
CONFIG.Logging.enable_console(level_name)

0 commit comments

Comments
 (0)