Skip to content

Commit c8c1417

Browse files
authored
Feature/v3/feature/last minute improvements (#403)
* Typos oin CHANGELOG.md * Add error handling in exmaple * Surface warnings during tests (avoid hiding deprecations) * Add missing docs file * Imrpve Releasnotes of v2.2.0 * Improve docs * Remove some filterwarnings from tsam
1 parent 8cb3866 commit c8c1417

7 files changed

Lines changed: 62 additions & 13 deletions

File tree

.github/workflows/python-app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
uv pip install --system .[dev]
8989
9090
- name: Run tests
91-
run: pytest -v -p no:warnings --numprocesses=auto
91+
run: pytest -v --numprocesses=auto
9292

9393
test-examples:
9494
runs-on: ubuntu-24.04

CHANGELOG.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ This replaces `specific_share_to_other_effects_*` parameters and inverts the dir
9999
- FlowSystem manipulation: `sel()`, `isel()`, `resample()`, `copy()`, `__eq__()` methods
100100
- Direct access to FlowSystem from results without manual restoring (lazily loaded)
101101
- New `FlowResults` class and precomputed DataArrays for sizes/flow_rates/flow_hours
102-
- `effects_per_component()` dataset for component impact evaluation, including all indirect effects through effect shares
102+
- `effects_per_component` dataset for component impact evaluation, including all indirect effects through effect shares
103103

104104
**Other additions:**
105105

@@ -124,7 +124,7 @@ This replaces `specific_share_to_other_effects_*` parameters and inverts the dir
124124
- Type system overhaul - added clear separation between temporal and non-temporal data throughout codebase for better clarity
125125
- Enhanced FlowSystem interface with improved `__repr__()` and `__str__()` methods
126126
- Improved Model Structure - Views and organisation is now divided into:
127-
- Model: The main Model (linopy.Model) that is used to create and store the variables and constraints for the flow_system.
127+
- Model: The main Model (linopy.Model) that is used to create and store the variables and constraints for the FlowSystem.
128128
- Submodel: The base class for all submodels. Each is a subset of the Model, for simpler access and clearer code.
129129
- Made docstrings in `config.py` more compact and easier to read
130130
- Improved format handling in configuration module
@@ -188,7 +188,7 @@ This replaces `specific_share_to_other_effects_*` parameters and inverts the dir
188188
- **Centralized deprecation pattern**: Added `_handle_deprecated_kwarg()` helper method to `Interface` base class that provides reusable deprecation handling with consistent warnings, conflict detection, and optional value transformation. Applied across 5 classes (InvestParameters, Source, Sink, SourceAndSink, Effect) reducing deprecation boilerplate by 72%.
189189
- FlowSystem data management simplified - removed `time_series_collection` pattern in favor of direct timestep properties
190190
- Change modeling hierarchy to allow for more flexibility in future development. This leads to minimal changes in the access and creation of Submodels and their variables.
191-
- Added new module `.modeling` that contains Modelling primitives and utilities
191+
- Added new module `.modeling` that contains modeling primitives and utilities
192192
- Clearer separation between the main Model and "Submodels"
193193
- Improved access to the Submodels and their variables, constraints and submodels
194194
- Added `__repr__()` for Submodels to easily inspect its content
@@ -218,10 +218,12 @@ This replaces `specific_share_to_other_effects_*` parameters and inverts the dir
218218
- All examples now enable console logging to demonstrate proper logging usage
219219
- Console logging now outputs to `sys.stdout` instead of `sys.stderr` for better compatibility with output redirection
220220

221+
### 💥 Breaking Changes
222+
- Console logging is now disabled by default (`CONFIG.Logging.console = False`). Enable it explicitly in your scripts with `CONFIG.Logging.console = True` and `CONFIG.apply()`
223+
- File logging is now disabled by default (`CONFIG.Logging.file = None`). Set a file path to enable file logging
224+
221225
### ♻️ Changed
222226
- Logging and Configuration management changed
223-
- **Breaking**: Console logging is now disabled by default (`CONFIG.Logging.console = False`). Enable it explicitly in your scripts with `CONFIG.Logging.console = True` and `CONFIG.apply()`
224-
- **Breaking**: File logging is now disabled by default (`CONFIG.Logging.file = None`). Set a file path to enable file logging
225227
- Improved default logging colors: DEBUG is now gray (`\033[90m`) for de-emphasized messages, INFO uses terminal default color (`\033[0m`) for clean output
226228

227229
### 🗑️ Deprecated

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ We believe that optimization modeling should be **approachable for beginners** y
1010

1111
**Short-term goals:**
1212

13-
- **Multi-dimensional modeling**: Full support for multi-period investments and scenario-based stochastic optimization (periods and scenarios are in active development)
13+
- **Multi-dimensional modeling**: Multi-period investments and scenario-based stochastic optimization are available (periods and scenarios are in active development for enhanced features)
1414
- **Enhanced component library**: More pre-built, domain-specific components (sector coupling, hydrogen systems, thermal networks, demand-side management)
1515

1616
**Medium-term vision:**
1717

1818
- **Modeling to generate alternatives (MGA)**: Built-in support for exploring near-optimal solution spaces to produce more robust, diverse solutions under uncertainty
19-
- **Interactive tutorials**: Browser-based, reactive tutorials for learning FlixOpt without local installation (marimo)
19+
- **Interactive tutorials**: Browser-based, reactive tutorials for learning FlixOpt without local installation ([marimo](https://marimo.io))
2020
- **Standardized cost calculations**: Align with industry standards (VDI 2067) for CAPEX/OPEX calculations
2121
- **Advanced result analysis**: Time-series aggregation, automated reporting, and rich visualization options
2222
- **Recipe collection**: Community-driven library of common modeling patterns, data manipulation techniques, and optimization strategies (see [Recipes](user-guide/recipes/index.md) - help wanted!)

docs/user-guide/recipes/index.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Recipes
2+
3+
**Coming Soon!** 🚧
4+
5+
This section will contain quick, copy-paste ready code snippets for common FlixOpt patterns.
6+
7+
---
8+
9+
## What Will Be Here?
10+
11+
Short, focused code snippets showing **how to do specific things** in FlixOpt:
12+
13+
- Common modeling patterns
14+
- Integration with other tools
15+
- Performance optimizations
16+
- Domain-specific solutions
17+
- Data analysis shortcuts
18+
19+
Unlike full examples, recipes will be focused snippets showing a single concept.
20+
21+
---
22+
23+
## Planned Topics
24+
25+
- **Storage Patterns** - Batteries, thermal storage, seasonal storage
26+
- **Multi-Criteria Optimization** - Balance multiple objectives
27+
- **Data I/O** - Loading time series from CSV, databases, APIs
28+
- **Data Manipulation** - Common xarray operations for parameterization and analysis
29+
- **Investment Optimization** - Size optimization strategies
30+
- **Renewable Integration** - Solar, wind capacity optimization
31+
- **On/Off Constraints** - Minimum runtime, startup costs
32+
- **Large-Scale Problems** - Segmented and aggregated calculations
33+
- **Custom Constraints** - Extend models with linopy
34+
- **Domain-Specific Patterns** - District heating, microgrids, industrial processes
35+
36+
---
37+
38+
## Want to Contribute?
39+
40+
**We need your help!** If you have recurring modeling patterns or clever solutions to share, please contribute via [GitHub issues](https://github.com/flixopt/flixopt/issues) or pull requests.
41+
42+
Guidelines:
43+
1. Keep it short (< 100 lines of code)
44+
2. Focus on one specific technique
45+
3. Add brief explanation and when to use it
46+
47+
Check the [contribution guide](../../contribute.md) for details.

examples/02_Complex/complex_example.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,10 @@
190190
flow_system.add_elements(bhkw_2) if use_chp_with_piecewise_conversion else flow_system.add_elements(bhkw)
191191

192192
pprint(flow_system) # Get a string representation of the FlowSystem
193-
flow_system.start_network_app() # Start the network app. Does only work with extra dependencies installed
193+
try:
194+
flow_system.start_network_app() # Start the network app
195+
except ImportError as e:
196+
print(f'Network app requires extra dependencies: {e}')
194197

195198
# --- Solve FlowSystem ---
196199
calculation = fx.FullCalculation('complex example', flow_system, time_indices)

flixopt/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@
4747
# These filters match the test configuration in pyproject.toml for consistency.
4848

4949
# tsam: Time series aggregation library
50-
# - FutureWarning: Upcoming API changes in tsam (will be fixed in future tsam releases)
51-
warnings.filterwarnings('ignore', category=FutureWarning, module='tsam')
52-
# - UserWarning: Informational message about minimal value constraints
50+
# - UserWarning: Informational message about minimal value constraints during clustering.
5351
warnings.filterwarnings('ignore', category=UserWarning, message='.*minimal value.*exceeds.*', module='tsam')
5452
# TODO: Might be able to fix it in flixopt?
5553

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ filterwarnings = [
202202
"error::UserWarning:flixopt",
203203

204204
# === Third-party warnings (mirrored from __init__.py) ===
205-
"ignore::FutureWarning:tsam",
206205
"ignore:.*minimal value.*exceeds.*:UserWarning:tsam",
207206
"ignore:Coordinates across variables not equal:UserWarning:linopy",
208207
"ignore:.*join will change from join='outer' to join='exact'.*:FutureWarning:linopy",

0 commit comments

Comments
 (0)