Skip to content
Open
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
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,27 @@ Until here -->

## [7.0.0] - Unreleased

**Summary**: Performance release with **up to 67x faster model building** for large systems through batched/vectorized operations.
**Summary**: Performance release with **up to 67x faster model building** for large systems through batched/vectorized operations. Renames `label` to `id` across the API with deprecation support, introduces `IdList[T]` as the standard container, and redesigns the `Flow` constructor.

### ✨ Added

- **`IdList[T]` container** (`flixopt/id_list.py`): New generic frozen ordered container replacing `FlowContainer`, `ElementContainer`, `ResultsContainer`, and `CarrierContainer`. Provides dict-like access by primary key, short-key fallback, or positional index, with helpful error messages including close-match suggestions.

### 💥 Breaking Changes

- **`label` renamed to `id`**: All element constructors now use `id` instead of `label`. The old `label` parameter and `.label` / `.label_full` properties are deprecated and will be removed in v7.0.0. Use `.id` everywhere.
- **`Flow` constructor redesigned**: `bus` is now the first positional argument; `flow_id` (optional) sets the short name, defaulting to the bus name. Old forms `Flow(label, bus)` and `Flow(label, bus=...)` still work with deprecation warnings.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Clarify deprecation removal version in 7.0.0 notes

Line 65-66 says deprecated label APIs will be removed in v7.0.0, but this section is the v7.0.0 release and the code keeps them with warnings. Please update to the next major (e.g., v8.0.0) or “future major release” to avoid conflicting guidance.

✏️ Suggested wording
-- **`label` renamed to `id`**: All element constructors now use `id` instead of `label`. The old `label` parameter and `.label` / `.label_full` properties are deprecated and will be removed in v7.0.0. Use `.id` everywhere.
+- **`label` renamed to `id`**: All element constructors now use `id` instead of `label`. The old `label` parameter and `.label` / `.label_full` properties are deprecated and will be removed in v8.0.0. Use `.id` everywhere.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- **`label` renamed to `id`**: All element constructors now use `id` instead of `label`. The old `label` parameter and `.label` / `.label_full` properties are deprecated and will be removed in v7.0.0. Use `.id` everywhere.
- **`Flow` constructor redesigned**: `bus` is now the first positional argument; `flow_id` (optional) sets the short name, defaulting to the bus name. Old forms `Flow(label, bus)` and `Flow(label, bus=...)` still work with deprecation warnings.
- **`label` renamed to `id`**: All element constructors now use `id` instead of `label`. The old `label` parameter and `.label` / `.label_full` properties are deprecated and will be removed in v8.0.0. Use `.id` everywhere.
- **`Flow` constructor redesigned**: `bus` is now the first positional argument; `flow_id` (optional) sets the short name, defaulting to the bus name. Old forms `Flow(label, bus)` and `Flow(label, bus=...)` still work with deprecation warnings.
🤖 Prompt for AI Agents
In `@CHANGELOG.md` around lines 65 - 66, Update the v7.0.0 changelog wording to
avoid implying removal in the same release: change the deprecation removal
target for the old `label` parameter and `.label` / `.label_full` properties
(referenced in the `label` → `id` note) from "v7.0.0" to either "v8.0.0" or "a
future major release"; likewise clarify the `Flow` constructor note (mentions
`Flow(label, bus)` compatibility) to say those old forms remain deprecated until
that future major release. Ensure references to symbols `label`, `id`, `Flow`,
`.label`, and `.label_full` are updated consistently.

- **`Flow.id` returns qualified name**: `Flow.id` now returns `component(flow_id)` (e.g., `Boiler(Q_fu)`) instead of just the short name. Use `flow.flow_id` for the short name.
- **`Flow.flow_id`**: New public property for the short flow identifier (e.g., `'Q_fu'`). This replaces the internal `_short_id` for Flow objects.
- **Container classes replaced**: `FlowContainer`, `ElementContainer`, `ResultsContainer` replaced by `IdList`. `EffectCollection` and `CarrierContainer` now inherit from `IdList`. Access patterns (`[]`, `in`, `keys()`, `values()`, `items()`, `get()`) are preserved.

### 🗑️ Deprecated

- `Element(label=...)` — use `Element(id=...)` instead
- `Flow(id=...)` — use `Flow(flow_id=...)` instead
- `.label` property — use `.id` instead
- `.label_full` property — use `.id` instead
- `Flow(label, bus)` positional form — use `Flow(bus, flow_id=...)` instead

### 🚀 Performance

Expand Down
5 changes: 4 additions & 1 deletion flixopt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
)
from .config import CONFIG
from .core import TimeSeriesData
from .effects import PENALTY_EFFECT_LABEL, Effect
from .effects import PENALTY_EFFECT_ID, PENALTY_EFFECT_LABEL, Effect
from .elements import Bus, Flow
from .flow_system import FlowSystem
from .flow_system_status import FlowSystemStatus
from .id_list import IdList
from .interface import InvestParameters, Piece, Piecewise, PiecewiseConversion, PiecewiseEffects, StatusParameters
from .optimization import Optimization, SegmentedOptimization
from .plot_result import PlotResult
Expand All @@ -48,6 +49,8 @@
'Flow',
'Bus',
'Effect',
'IdList',
'PENALTY_EFFECT_ID',
'PENALTY_EFFECT_LABEL',
'Source',
'Sink',
Expand Down
Loading