-
Notifications
You must be signed in to change notification settings - Fork 9
feat!: remove all overdue deprecated APIs (Optimization/Results, FlowSystem methods, kwarg shims) #741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
feat!: remove all overdue deprecated APIs (Optimization/Results, FlowSystem methods, kwarg shims) #741
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
20240e4
feat!: remove deprecated Optimization/Results API
FBumann 37444bc
fix: keep from_old_dataset() as a supported migration path
FBumann 6f4db4d
feat!: remove deprecated FlowSystem methods and pyvis network plotting
FBumann fc51028
feat!: remove the deprecated-kwarg rename bridge
FBumann 2a87c8d
docs: add v8 migration guide and changelog entry for the API removals
FBumann 8aa9b9d
test: real-file regression coverage for from_old_dataset, note v9 rem…
FBumann 1a41199
docs: fix review findings — bogus Bus kwarg, stale PyVis references, …
FBumann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,3 +14,6 @@ temp-plot.html | |
| site/ | ||
| *.egg-info | ||
| uv.lock | ||
|
|
||
| # test artifacts written to cwd | ||
| fs.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| # Migration Guide: v7.x → v8.0.0 | ||
|
|
||
| !!! tip "Quick Start" | ||
| ```bash | ||
| pip install --upgrade flixopt | ||
| ``` | ||
| v8.0.0 removes the long-deprecated v4-era APIs. If your code runs on v7.x | ||
| **without `DeprecationWarning`s**, it will run unchanged on v8.0.0 — this | ||
| guide is only relevant if you still use the old entry points below. | ||
|
|
||
| --- | ||
|
|
||
| ## Overview | ||
|
|
||
| Every API removed in v8.0.0 has been deprecated since v5/v6 and has emitted a | ||
| `DeprecationWarning` pointing to its replacement ever since. The replacements | ||
| are unchanged — nothing new to learn, only old spellings to drop: | ||
|
|
||
| | Removed | Replacement | | ||
| |---------|-------------| | ||
| | `fx.Optimization`, `fx.SegmentedOptimization` | `flow_system.optimize(solver)` or `build_model()` + `solve(solver)` | | ||
| | `fx.results` / `Results` classes | `flow_system.solution`, `flow_system.stats` | | ||
| | `FlowSystem.sel()` / `isel()` / `resample()` | `flow_system.transform.sel()` / `isel()` / `resample()` | | ||
| | `FlowSystem.coords` | `flow_system.indexes` | | ||
| | `FlowSystem.plot_network()`, `network_infos()` | `flow_system.topology.plot()`, `topology.infos()` | | ||
| | `start_network_app()` / `stop_network_app()` | `topology.start_app()` / `topology.stop_app()` | | ||
| | `topology.plot_legacy()` (PyVis) | `topology.plot()` (Plotly) | | ||
| | `FlowSystem.from_old_results()` | re-run the optimization with the current API | | ||
| | `Bus(excess_penalty_per_flow_hour=...)` | `Bus(imbalance_penalty_per_flow_hour=...)` | | ||
| | `normalize_weights` on `optimize()` / `build_model()` / `create_model()` | remove the argument — weights are always normalized | | ||
|
|
||
| --- | ||
|
|
||
| ## 💥 Breaking Changes in v8.0.0 | ||
|
|
||
| ### Optimization & Results classes removed | ||
|
|
||
| The pre-v5 workflow objects are gone. Solve directly on the `FlowSystem` and | ||
| read results from it: | ||
|
|
||
| === "v7.x and earlier (removed)" | ||
| ```python | ||
| import flixopt as fx | ||
|
|
||
| optimization = fx.Optimization('my_run', flow_system) | ||
| optimization.do_modeling() | ||
| optimization.solve(fx.solvers.HighsSolver()) | ||
|
|
||
| results = fx.results.Results.from_optimization(optimization) | ||
| results.flow_rates() | ||
| ``` | ||
|
|
||
| === "v8.0.0" | ||
| ```python | ||
| import flixopt as fx | ||
|
|
||
| flow_system.optimize(fx.solvers.HighsSolver()) | ||
|
|
||
| flow_system.solution['Boiler(Q_th)|flow_rate'] | ||
| flow_system.stats.flow_rates | ||
| ``` | ||
|
|
||
| `SegmentedOptimization` is removed without a direct replacement yet; a new | ||
| segmented (rolling-horizon) API is planned. | ||
|
|
||
| ### Data methods moved to the `transform` accessor | ||
|
|
||
| === "v7.x and earlier (removed)" | ||
| ```python | ||
| fs_jan = flow_system.sel(time='2020-01') | ||
| fs_2h = flow_system.resample('2h', method='mean') | ||
| ``` | ||
|
|
||
| === "v8.0.0" | ||
| ```python | ||
| fs_jan = flow_system.transform.sel(time='2020-01') | ||
| fs_2h = flow_system.transform.resample('2h', method='mean') | ||
| ``` | ||
|
|
||
| ### Network visualization is Plotly-only | ||
|
|
||
| `plot_network()`, the PyVis-based `topology.plot_legacy()`, and the network | ||
| app wrappers on `FlowSystem` are removed. **PyVis is no longer a dependency.** | ||
|
|
||
| === "v7.x and earlier (removed)" | ||
| ```python | ||
| flow_system.plot_network(show=True) | ||
| flow_system.start_network_app() | ||
| ``` | ||
|
|
||
| === "v8.0.0" | ||
| ```python | ||
| flow_system.topology.plot() | ||
| flow_system.topology.start_app() | ||
| ``` | ||
|
|
||
| ### Renamed `Bus` argument is no longer bridged | ||
|
|
||
| Passing the old name now raises a `TypeError` instead of warning: | ||
|
|
||
| === "v7.x and earlier (removed)" | ||
| ```python | ||
| fx.Bus('Heat', excess_penalty_per_flow_hour=1e5) | ||
| ``` | ||
|
|
||
| === "v8.0.0" | ||
| ```python | ||
| fx.Bus('Heat', imbalance_penalty_per_flow_hour=1e5) | ||
| ``` | ||
|
|
||
| ### Old result files can no longer be loaded | ||
|
|
||
| `FlowSystem.from_old_results()` (the loader for pre-v5 `*--flow_system.nc4` + | ||
| `*--solution.nc4` result pairs) is removed — re-run those optimizations with | ||
| the current API. | ||
|
|
||
| !!! info "Old *configuration* files still load" | ||
| `FlowSystem.from_old_dataset()` remains fully supported (and no longer warns): it loads a pre-v5 | ||
| `*--flow_system.nc4` configuration, renames old parameters, and returns a | ||
| `FlowSystem` ready to re-optimize. Files saved with v5+ | ||
| (`to_netcdf`/`from_netcdf`) are unaffected by any of this. | ||
|
|
||
| `from_old_dataset()` is planned for removal in **v9** — migrate pre-v5 | ||
| files to the current single-file format before then. | ||
|
|
||
| --- | ||
|
|
||
| ## Checklist | ||
|
|
||
| 1. Run your project on v7.x with warnings visible: | ||
| `python -W once::DeprecationWarning your_script.py` | ||
| 2. Fix every `DeprecationWarning` using the table above. | ||
| 3. Upgrade: `pip install --upgrade flixopt`. | ||
|
|
||
| If step 1 is silent, v8.0.0 is a drop-in upgrade. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.