Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ If upgrading from v2.x, see the [v3.0.0 release notes](https://github.com/flixOp

### 🐛 Fixed

- Fixed missing `DEPRECATION_REMOVAL_VERSION` import in `calculation.py`, `effects.py`, `flow_system.py`, and `results.py`

### 🔒 Security

### 📦 Dependencies
Expand Down
7 changes: 4 additions & 3 deletions flixopt/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from . import io as fx_io
from .aggregation import Aggregation, AggregationModel, AggregationParameters
from .components import Storage
from .config import CONFIG
from .config import CONFIG, DEPRECATION_REMOVAL_VERSION
from .core import DataConverter, TimeSeriesData, drop_constant_arrays
from .features import InvestmentModel
from .flow_system import FlowSystem
Expand Down Expand Up @@ -79,7 +79,7 @@ def __init__(
warnings.warn(
"The 'active_timesteps' parameter is deprecated and will be removed in a future version. "
'Use flow_system.sel(time=timesteps) or flow_system.isel(time=indices) before passing '
'the FlowSystem to the Calculation instead.',
f'the FlowSystem to the Calculation instead. Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -162,7 +162,8 @@ def summary(self):
@property
def active_timesteps(self) -> pd.DatetimeIndex:
warnings.warn(
'active_timesteps is deprecated. Use flow_system.sel(time=...) or flow_system.isel(time=...) instead.',
f'active_timesteps is deprecated. Use flow_system.sel(time=...) or flow_system.isel(time=...) instead. '
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand Down
52 changes: 35 additions & 17 deletions flixopt/effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import numpy as np
import xarray as xr

from .config import DEPRECATION_REMOVAL_VERSION
from .core import PlausibilityError
from .features import ShareAllocationModel
from .structure import Element, ElementContainer, ElementModel, FlowSystemModel, Submodel, register_class_for_io
Expand Down Expand Up @@ -252,7 +253,8 @@ def __init__(
def minimum_operation(self):
"""DEPRECATED: Use 'minimum_temporal' property instead."""
warnings.warn(
"Property 'minimum_operation' is deprecated. Use 'minimum_temporal' instead.",
f"Property 'minimum_operation' is deprecated. Use 'minimum_temporal' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -262,7 +264,8 @@ def minimum_operation(self):
def minimum_operation(self, value):
"""DEPRECATED: Use 'minimum_temporal' property instead."""
warnings.warn(
"Property 'minimum_operation' is deprecated. Use 'minimum_temporal' instead.",
f"Property 'minimum_operation' is deprecated. Use 'minimum_temporal' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -272,7 +275,8 @@ def minimum_operation(self, value):
def maximum_operation(self):
"""DEPRECATED: Use 'maximum_temporal' property instead."""
warnings.warn(
"Property 'maximum_operation' is deprecated. Use 'maximum_temporal' instead.",
f"Property 'maximum_operation' is deprecated. Use 'maximum_temporal' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -282,7 +286,8 @@ def maximum_operation(self):
def maximum_operation(self, value):
"""DEPRECATED: Use 'maximum_temporal' property instead."""
warnings.warn(
"Property 'maximum_operation' is deprecated. Use 'maximum_temporal' instead.",
f"Property 'maximum_operation' is deprecated. Use 'maximum_temporal' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -292,7 +297,8 @@ def maximum_operation(self, value):
def minimum_invest(self):
"""DEPRECATED: Use 'minimum_periodic' property instead."""
warnings.warn(
"Property 'minimum_invest' is deprecated. Use 'minimum_periodic' instead.",
f"Property 'minimum_invest' is deprecated. Use 'minimum_periodic' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -302,7 +308,8 @@ def minimum_invest(self):
def minimum_invest(self, value):
"""DEPRECATED: Use 'minimum_periodic' property instead."""
warnings.warn(
"Property 'minimum_invest' is deprecated. Use 'minimum_periodic' instead.",
f"Property 'minimum_invest' is deprecated. Use 'minimum_periodic' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -312,7 +319,8 @@ def minimum_invest(self, value):
def maximum_invest(self):
"""DEPRECATED: Use 'maximum_periodic' property instead."""
warnings.warn(
"Property 'maximum_invest' is deprecated. Use 'maximum_periodic' instead.",
f"Property 'maximum_invest' is deprecated. Use 'maximum_periodic' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -322,7 +330,8 @@ def maximum_invest(self):
def maximum_invest(self, value):
"""DEPRECATED: Use 'maximum_periodic' property instead."""
warnings.warn(
"Property 'maximum_invest' is deprecated. Use 'maximum_periodic' instead.",
f"Property 'maximum_invest' is deprecated. Use 'maximum_periodic' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -332,7 +341,8 @@ def maximum_invest(self, value):
def minimum_operation_per_hour(self):
"""DEPRECATED: Use 'minimum_per_hour' property instead."""
warnings.warn(
"Property 'minimum_operation_per_hour' is deprecated. Use 'minimum_per_hour' instead.",
f"Property 'minimum_operation_per_hour' is deprecated. Use 'minimum_per_hour' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -342,7 +352,8 @@ def minimum_operation_per_hour(self):
def minimum_operation_per_hour(self, value):
"""DEPRECATED: Use 'minimum_per_hour' property instead."""
warnings.warn(
"Property 'minimum_operation_per_hour' is deprecated. Use 'minimum_per_hour' instead.",
f"Property 'minimum_operation_per_hour' is deprecated. Use 'minimum_per_hour' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -352,7 +363,8 @@ def minimum_operation_per_hour(self, value):
def maximum_operation_per_hour(self):
"""DEPRECATED: Use 'maximum_per_hour' property instead."""
warnings.warn(
"Property 'maximum_operation_per_hour' is deprecated. Use 'maximum_per_hour' instead.",
f"Property 'maximum_operation_per_hour' is deprecated. Use 'maximum_per_hour' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -362,7 +374,8 @@ def maximum_operation_per_hour(self):
def maximum_operation_per_hour(self, value):
"""DEPRECATED: Use 'maximum_per_hour' property instead."""
warnings.warn(
"Property 'maximum_operation_per_hour' is deprecated. Use 'maximum_per_hour' instead.",
f"Property 'maximum_operation_per_hour' is deprecated. Use 'maximum_per_hour' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -372,7 +385,8 @@ def maximum_operation_per_hour(self, value):
def minimum_total_per_period(self):
"""DEPRECATED: Use 'minimum_total' property instead."""
warnings.warn(
"Property 'minimum_total_per_period' is deprecated. Use 'minimum_total' instead.",
f"Property 'minimum_total_per_period' is deprecated. Use 'minimum_total' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -382,7 +396,8 @@ def minimum_total_per_period(self):
def minimum_total_per_period(self, value):
"""DEPRECATED: Use 'minimum_total' property instead."""
warnings.warn(
"Property 'minimum_total_per_period' is deprecated. Use 'minimum_total' instead.",
f"Property 'minimum_total_per_period' is deprecated. Use 'minimum_total' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -392,7 +407,8 @@ def minimum_total_per_period(self, value):
def maximum_total_per_period(self):
"""DEPRECATED: Use 'maximum_total' property instead."""
warnings.warn(
"Property 'maximum_total_per_period' is deprecated. Use 'maximum_total' instead.",
f"Property 'maximum_total_per_period' is deprecated. Use 'maximum_total' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -402,7 +418,8 @@ def maximum_total_per_period(self):
def maximum_total_per_period(self, value):
"""DEPRECATED: Use 'maximum_total' property instead."""
warnings.warn(
"Property 'maximum_total_per_period' is deprecated. Use 'maximum_total' instead.",
f"Property 'maximum_total_per_period' is deprecated. Use 'maximum_total' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -617,7 +634,8 @@ def get_effect_label(eff: Effect | str) -> str:
if isinstance(eff, Effect):
warnings.warn(
f'The use of effect objects when specifying EffectValues is deprecated. '
f'Use the label of the effect instead. Used effect: {eff.label_full}',
f'Use the label of the effect instead. Used effect: {eff.label_full}. '
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
UserWarning,
stacklevel=2,
)
Expand Down
3 changes: 2 additions & 1 deletion flixopt/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,8 @@ def __init__(
self.bus = bus.label_full
warnings.warn(
f'Bus {bus.label} is passed as a Bus object to {self.label}. This is deprecated and will be removed '
f'in the future. Add the Bus to the FlowSystem instead and pass its label to the Flow.',
f'in the future. Add the Bus to the FlowSystem instead and pass its label to the Flow. '
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
UserWarning,
stacklevel=1,
)
Expand Down
11 changes: 7 additions & 4 deletions flixopt/flow_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import xarray as xr

from . import io as fx_io
from .config import CONFIG
from .config import CONFIG, DEPRECATION_REMOVAL_VERSION
from .core import (
ConversionError,
DataConverter,
Expand Down Expand Up @@ -995,7 +995,8 @@ def _connect_network(self):
warnings.warn(
f'The Bus {flow._bus_object.label_full} was added to the FlowSystem from {flow.label_full}.'
f'This is deprecated and will be removed in the future. '
f'Please pass the Bus.label to the Flow and the Bus to the FlowSystem instead.',
f'Please pass the Bus.label to the Flow and the Bus to the FlowSystem instead. '
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=1,
)
Expand Down Expand Up @@ -1165,7 +1166,8 @@ def scenario_weights(self, value: Numeric_S | None) -> None:
@property
def weights(self) -> Numeric_S | None:
warnings.warn(
'FlowSystem.weights is deprecated. Use FlowSystem.scenario_weights instead.',
f'FlowSystem.weights is deprecated. Use FlowSystem.scenario_weights instead. '
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -1180,7 +1182,8 @@ def weights(self, value: Numeric_S) -> None:
value: Scenario weights to set
"""
warnings.warn(
'Setting FlowSystem.weights is deprecated. Set FlowSystem.scenario_weights instead.',
f'Setting FlowSystem.weights is deprecated. Set FlowSystem.scenario_weights instead. '
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand Down
26 changes: 17 additions & 9 deletions flixopt/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from . import io as fx_io
from . import plotting
from .color_processing import process_colors
from .config import CONFIG
from .config import CONFIG, DEPRECATION_REMOVAL_VERSION
from .flow_system import FlowSystem
from .structure import CompositeContainerMixin, ElementContainer, ResultsContainer

Expand Down Expand Up @@ -229,7 +229,8 @@ def __init__(
flow_system_data = kwargs.pop('flow_system')
warnings.warn(
"The 'flow_system' parameter is deprecated. Use 'flow_system_data' instead. "
"Access is now via '.flow_system_data', while '.flow_system' returns the restored FlowSystem.",
"Access is now via '.flow_system_data', while '.flow_system' returns the restored FlowSystem. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -1322,7 +1323,8 @@ def plot_node_balance(
import warnings

warnings.warn(
"The 'indexer' parameter is deprecated and will be removed in a future version. Use 'select' instead.",
f"The 'indexer' parameter is deprecated and will be removed in a future version. Use 'select' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -1457,7 +1459,8 @@ def plot_node_balance_pie(
import warnings

warnings.warn(
"The 'indexer' parameter is deprecated and will be removed in a future version. Use 'select' instead.",
f"The 'indexer' parameter is deprecated and will be removed in a future version. Use 'select' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -1597,7 +1600,8 @@ def node_balance(
import warnings

warnings.warn(
"The 'indexer' parameter is deprecated and will be removed in a future version. Use 'select' instead.",
f"The 'indexer' parameter is deprecated and will be removed in a future version. Use 'select' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -1744,7 +1748,8 @@ def plot_charge_state(
import warnings

warnings.warn(
"The 'indexer' parameter is deprecated and will be removed in a future version. Use 'select' instead.",
f"The 'indexer' parameter is deprecated and will be removed in a future version. Use 'select' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -2262,7 +2267,8 @@ def plot_heatmap(

warnings.warn(
"The 'heatmap_timeframes' and 'heatmap_timesteps_per_frame' parameters are deprecated. "
"Use 'reshape_time=(timeframes, timesteps_per_frame)' instead.",
f"Use 'reshape_time=(timeframes, timesteps_per_frame)' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -2280,7 +2286,8 @@ def plot_heatmap(
import warnings

warnings.warn(
"The 'color_map' parameter is deprecated. Use 'colors' instead.",
f"The 'color_map' parameter is deprecated. Use 'colors' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -2444,7 +2451,8 @@ def plot_heatmap(
import warnings

warnings.warn(
"The 'indexer' parameter is deprecated. Use 'select' instead.",
f"The 'indexer' parameter is deprecated. Use 'select' instead. "
f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
DeprecationWarning,
stacklevel=2,
)
Expand Down