Skip to content

feat!: remove all overdue deprecated APIs (Optimization/Results, FlowSystem methods, kwarg shims)#741

Closed
FBumann wants to merge 7 commits into
mainfrom
remove-deprecated-api
Closed

feat!: remove all overdue deprecated APIs (Optimization/Results, FlowSystem methods, kwarg shims)#741
FBumann wants to merge 7 commits into
mainfrom
remove-deprecated-api

Conversation

@FBumann

@FBumann FBumann commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

Removes every API that has outlived its promised removal deadline (tests/deprecated/conftest.py said v6.0.0, DEPRECATION_REMOVAL_VERSION says 7.0.0 — main is on 7.2.1).

Net: −14,215 lines across 4 commits.

Commit 1 — Optimization/Results workflow API

  • Optimization / SegmentedOptimization, Results + per-element results classes
  • FlowSystem.from_old_results() (itself deprecation-warned)
  • normalize_weights deprecated parameter on create_model / build_model / optimize()
  • tests/deprecated/ (32 files, ~9.2k lines), the deprecated_api pytest marker, dead supporting code

Commit 2 — from_old_dataset() stays supported

The one remaining pre-v5 file loader keeps working without a deprecation warning; the v5 migration guide now points at it.

Commit 3 — deprecated FlowSystem methods + pyvis

  • plot_network(), start_network_app(), stop_network_app(), network_infos()topology.*
  • sel(), isel(), resample(), _dataset_* helpers, coords property → transform.*
  • topology.plot_legacy() and the pyvis renderer — pyvis is no longer a dependency
  • resample/sel equivalence test suites adapted to the accessor API (coverage preserved)

Commit 4 — kwarg rename bridge

  • Interface._handle_deprecated_kwarg and its sole use: Bus(excess_penalty_per_flow_hour=...) now raises TypeError — use imbalance_penalty_per_flow_hour. Docs examples still teaching the old name were fixed.

Commit 5 — docs & release notes

  • docs/user-guide/migration-guide-v8.md (old/new examples for every removed entry point), linked from the mkdocs nav, the v7 guide, and the CHANGELOG header
  • hand-written [Unreleased] CHANGELOG section — fold under the v8.0.0 heading when release-please cuts it

Deliberately kept

  • FlowSystem.from_old_dataset() + flixopt.io conversion helpers (PARAMETER_RENAMES, …): loading pre-v5 files remains supported, with tests.

Migration

Old New
fx.Optimization(name, fs).solve(solver) fs.optimize(solver)
Results / results.flow_rates() fs.solution, fs.stats
fs.sel/isel/resample(...) fs.transform.sel/isel/resample(...)
fs.plot_network() / network app fs.topology.plot() / topology.start_app()
Bus(excess_penalty_per_flow_hour=...) Bus(imbalance_penalty_per_flow_hour=...)

Context

Peeled out of the element-data-classes stack (#602) so the overdue cleanup lands on its own timeline. This is the v8.0.0 trigger commit-wise; release-please will accumulate until the release PR is merged.

Full suite locally: 1183 passed, 0 failed.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Breaking Changes

    • Removed legacy optimization, results, network visualization, and FlowSystem transformation APIs.
    • Deprecated parameters and penalty aliases are no longer accepted.
    • Flow and result access has been streamlined with updated container behavior.
  • Improvements

    • Data selection and resampling are now handled through the transform accessor.
    • Plotly-based topology visualization remains available; PyVis support was removed.
  • Documentation

    • Added a v8 migration guide covering upgrade steps and legacy data handling.
    • Updated penalty terminology and migration guidance.

Removes the pre-accessor workflow API that has outlived two removal
deadlines (conftest said v6.0.0, DEPRECATION_REMOVAL_VERSION said 7.0.0):

- Optimization and SegmentedOptimization classes (flixopt/optimization.py)
- Results and per-element Results classes (flixopt/results.py)
- FlowSystem.from_old_results() migration helper (itself deprecated)
- normalize_weights deprecated parameter on create_model/build_model/optimize
- dead supporting code: ResultsContainer, used_in_calculation flag
- tests/deprecated (32 files) and the deprecated_api pytest marker

The file-migration path is intentionally kept: FlowSystem.from_old_dataset()
and the io conversion helpers still load pre-v5 files.

BREAKING CHANGE: fx.Optimization, fx.SegmentedOptimization, flixopt.results
and FlowSystem.from_old_results() are removed. Use FlowSystem.optimize() /
build_model() + solve() and access results via FlowSystem.solution.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@FBumann, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d6383155-8c40-4da4-9157-de94f1146c5f

📥 Commits

Reviewing files that changed from the base of the PR and between 8aa9b9d and 1a41199.

📒 Files selected for processing (6)
  • docs/user-guide/glossary.md
  • docs/user-guide/mathematical-notation/effects-and-dimensions.md
  • docs/user-guide/migration-guide-v8.md
  • docs/user-guide/optimization/index.md
  • docs/user-guide/results/index.md
  • flixopt/topology_accessor.py
📝 Walkthrough

Walkthrough

This change removes deprecated optimization, results, transformation, visualization, and parameter APIs for v8, replaces ResultsContainer with FlowContainer, updates legacy dataset migration guidance, removes PyVis support, and aligns tests, CI, dependencies, and documentation with the new interfaces.

Changes

v8 API cleanup and migration

Layer / File(s) Summary
Core API and compatibility removals
flixopt/__init__.py, flixopt/flow_system.py, flixopt/optimization.py, flixopt/optimize_accessor.py, flixopt/plotting.py, flixopt/topology_accessor.py, flixopt/structure.py
Removes deprecated optimization exports, FlowSystem methods, normalization arguments, warning helpers, and legacy PyVis visualization paths.
Container and parameter contracts
flixopt/structure.py, flixopt/elements.py
Replaces ResultsContainer with FlowContainer label/index access and stops translating the deprecated Bus penalty keyword.
Migration and transform adoption
flixopt/flow_system.py, docs/user-guide/migration-guide-v5.md, docs/user-guide/migration-guide-v8.md, tests/flow_system/*, tests/io/test_io_conversion.py, tests/test_scenarios.py
Keeps legacy dataset loading, removes old result-file migration, documents v8 replacements, and updates tests to use transform APIs.
Documentation and validation alignment
CHANGELOG.md, docs/user-guide/*, tests/deprecated/*, tests/plotting/test_topology_accessor.py, .github/workflows/tests.yaml, pyproject.toml, .gitignore
Updates terminology and migration references, removes deprecated test coverage and helpers, removes PyVis and the deprecated pytest marker, and ignores fs.json artifacts.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is detailed, but it does not follow the required template sections or include issues, testing, or checklist items. Reformat it to include the template headings: Description, Type of Change, Related Issues, Testing, and Checklist, with values filled in.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: removal of overdue deprecated APIs and related shims.
Docstring Coverage ✅ Passed Docstring coverage is 92.16% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch remove-deprecated-api

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@flixopt/flow_system.py`:
- Around line 827-828: The from_old_dataset() migration API must remain
supported without deprecation warnings. Remove its v6 removal warning/notice,
and update related migration documentation references from the removed
from_old_results() API to from_old_dataset().
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9c85eeea-da0a-4f15-9cf6-3d828ad55b35

📥 Commits

Reviewing files that changed from the base of the PR and between cc56774 and 20240e4.

📒 Files selected for processing (44)
  • .github/workflows/tests.yaml
  • .gitignore
  • flixopt/__init__.py
  • flixopt/flow_system.py
  • flixopt/optimization.py
  • flixopt/optimize_accessor.py
  • flixopt/results.py
  • flixopt/structure.py
  • pyproject.toml
  • tests/conftest.py
  • tests/deprecated/__init__.py
  • tests/deprecated/conftest.py
  • tests/deprecated/examples/00_Minmal/minimal_example.py
  • tests/deprecated/examples/01_Simple/simple_example.py
  • tests/deprecated/examples/02_Complex/complex_example.py
  • tests/deprecated/examples/02_Complex/complex_example_results.py
  • tests/deprecated/examples/03_Optimization_modes/example_optimization_modes.py
  • tests/deprecated/examples/04_Scenarios/scenario_example.py
  • tests/deprecated/examples/05_Two-stage-optimization/two_stage_optimization.py
  • tests/deprecated/test_bus.py
  • tests/deprecated/test_component.py
  • tests/deprecated/test_config.py
  • tests/deprecated/test_cycle_detection.py
  • tests/deprecated/test_effect.py
  • tests/deprecated/test_effects_shares_summation.py
  • tests/deprecated/test_examples.py
  • tests/deprecated/test_flow.py
  • tests/deprecated/test_flow_system_resample.py
  • tests/deprecated/test_functional.py
  • tests/deprecated/test_heatmap_reshape.py
  • tests/deprecated/test_integration.py
  • tests/deprecated/test_io.py
  • tests/deprecated/test_linear_converter.py
  • tests/deprecated/test_network_app.py
  • tests/deprecated/test_on_hours_computation.py
  • tests/deprecated/test_plotting_api.py
  • tests/deprecated/test_resample_equivalence.py
  • tests/deprecated/test_results_io.py
  • tests/deprecated/test_results_overwrite.py
  • tests/deprecated/test_results_plots.py
  • tests/deprecated/test_scenarios.py
  • tests/deprecated/test_storage.py
  • tests/deprecated/test_timeseries.py
  • tests/io/test_io_conversion.py
💤 Files with no reviewable changes (37)
  • tests/deprecated/init.py
  • tests/deprecated/examples/01_Simple/simple_example.py
  • tests/deprecated/examples/00_Minmal/minimal_example.py
  • tests/deprecated/test_plotting_api.py
  • tests/deprecated/test_functional.py
  • tests/deprecated/test_scenarios.py
  • tests/deprecated/test_results_overwrite.py
  • tests/deprecated/test_io.py
  • tests/deprecated/examples/02_Complex/complex_example_results.py
  • pyproject.toml
  • tests/deprecated/test_network_app.py
  • tests/deprecated/test_examples.py
  • tests/deprecated/examples/05_Two-stage-optimization/two_stage_optimization.py
  • tests/deprecated/test_config.py
  • tests/deprecated/test_cycle_detection.py
  • tests/deprecated/test_effect.py
  • tests/deprecated/test_bus.py
  • tests/deprecated/examples/04_Scenarios/scenario_example.py
  • tests/deprecated/test_on_hours_computation.py
  • tests/deprecated/test_results_plots.py
  • tests/deprecated/test_heatmap_reshape.py
  • tests/deprecated/test_results_io.py
  • tests/deprecated/examples/03_Optimization_modes/example_optimization_modes.py
  • tests/conftest.py
  • tests/deprecated/examples/02_Complex/complex_example.py
  • tests/deprecated/test_resample_equivalence.py
  • flixopt/optimize_accessor.py
  • tests/deprecated/test_effects_shares_summation.py
  • tests/deprecated/test_storage.py
  • tests/deprecated/test_linear_converter.py
  • tests/deprecated/test_flow_system_resample.py
  • tests/deprecated/test_component.py
  • tests/deprecated/test_flow.py
  • tests/deprecated/conftest.py
  • tests/deprecated/test_integration.py
  • flixopt/optimization.py
  • tests/io/test_io_conversion.py

Comment thread flixopt/flow_system.py
FBumann and others added 3 commits July 23, 2026 07:43
It is the only remaining loader for pre-v5 files, so drop its deprecation
warning and docstring notice, and point the v5 migration guide at it now
that from_old_results() is gone.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
All of these have warned 'will be removed in v7.0.0' since before 7.0.0
shipped; their replacements are long established:

- plot_network(), start_network_app(), stop_network_app(), network_infos()
  -> topology accessor (topology.plot/start_app/stop_app/infos)
- sel(), isel(), resample() and the _dataset_* static helpers
  -> transform accessor (transform.sel/isel/resample)
- FlowSystem.coords property
- topology.plot_legacy() and the pyvis-based plot_network helper, plus the
  pyvis dependency itself

Tests exercising the old entry points were adapted to the accessor API
(resample/sel equivalence suites) or removed where they only tested the
deprecation shims.

BREAKING CHANGE: FlowSystem.sel/isel/resample/coords/plot_network/
start_network_app/stop_network_app/network_infos and topology.plot_legacy()
are removed. Use flow_system.transform.* and flow_system.topology.*.
pyvis is no longer a dependency.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Removes Interface._handle_deprecated_kwarg and its sole remaining use, the
Bus constructor's excess_penalty_per_flow_hour -> imbalance_penalty_per_flow_hour
rename. Docs examples still teaching the old name were updated.

File-level conversion is unaffected: flixopt.io.PARAMETER_RENAMES still
maps old names when loading pre-v5 files.

BREAKING CHANGE: passing excess_penalty_per_flow_hour to Bus(...) now raises
a TypeError instead of warning. Use imbalance_penalty_per_flow_hour.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@FBumann FBumann changed the title feat!: remove deprecated Optimization/Results API feat!: remove all overdue deprecated APIs (Optimization/Results, FlowSystem methods, kwarg shims) Jul 23, 2026
FBumann and others added 2 commits July 23, 2026 09:12
- docs/user-guide/migration-guide-v8.md in the style of the v6/v7 guides,
  with old/new examples for every removed entry point
- linked from mkdocs nav, the v7 guide, and the CHANGELOG header tip
- hand-written Unreleased changelog section summarizing the removals

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…oval

The removed from_old_results tests were the only ones loading the real pre-v5
fixture files; from_old_dataset was left without real-file proof. Add a
parametrized load test over all 10 fixtures plus one end-to-end solve
(objective pinned), and document in the v8 migration guide that the pre-v5
file bridge is planned for removal in v9.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@FBumann

FBumann commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

Keep plot_network somehow

@FBumann
FBumann marked this pull request as draft July 23, 2026 12:48
@FBumann
FBumann marked this pull request as ready for review July 23, 2026 14:11

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
flixopt/flow_system.py (1)

1670-1670: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Replace stale PyVis exports with the retained Plotly export API.

topology.plot() now returns PlotResult; path= is passed as Plotly layout kwargs, so flow_system.topology.plot(path=...) will not export HTML. Remove the removed plot_legacy() reference and use PlotResult.to_html(...):

  • docs/home/quick-start.md
  • docs/user-guide/optimization/index.md
  • flixopt/topology_accessor.py: examples and See Also
  • flixopt/flow_system.py: examples and See Also

Use flow_system.topology.plot(show=True).to_html('...').

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@flixopt/flow_system.py` at line 1670, Replace stale PyVis and plot_legacy
references with the retained Plotly API: in flixopt/flow_system.py (1670-1670)
and flixopt/topology_accessor.py (495-495), plus examples and See Also links in
docs/home/quick-start.md and docs/user-guide/optimization/index.md (line ranges
not provided), use flow_system.topology.plot(show=True).to_html('...') for HTML
export and update references accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/user-guide/mathematical-notation/effects-and-dimensions.md`:
- Line 80: Remove the obsolete shortage_penalty_per_flow_hour keyword from the
Bus example, leaving imbalance_penalty_per_flow_hour as the single penalty
parameter for both imbalance directions.

In `@docs/user-guide/migration-guide-v8.md`:
- Line 30: Update the migration guide row for removed normalize_weights
arguments to document all affected APIs: optimize(...), create_model(), and
build_model().

In `@docs/user-guide/optimization/index.md`:
- Around line 366-371: Correct the documentation around
imbalance_penalty_per_flow_hour to state that its default is None, while
identifying 1e5 as the explicitly configured diagnostic penalty value in the
heat_bus example.

---

Outside diff comments:
In `@flixopt/flow_system.py`:
- Line 1670: Replace stale PyVis and plot_legacy references with the retained
Plotly API: in flixopt/flow_system.py (1670-1670) and
flixopt/topology_accessor.py (495-495), plus examples and See Also links in
docs/home/quick-start.md and docs/user-guide/optimization/index.md (line ranges
not provided), use flow_system.topology.plot(show=True).to_html('...') for HTML
export and update references accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5bb046c2-1e2b-45e2-a3f2-8e75652ee9fd

📥 Commits

Reviewing files that changed from the base of the PR and between 37444bc and 8aa9b9d.

📒 Files selected for processing (19)
  • CHANGELOG.md
  • docs/user-guide/glossary.md
  • docs/user-guide/mathematical-notation/effects-and-dimensions.md
  • docs/user-guide/migration-guide-v7.md
  • docs/user-guide/migration-guide-v8.md
  • docs/user-guide/optimization/index.md
  • flixopt/elements.py
  • flixopt/flow_system.py
  • flixopt/plotting.py
  • flixopt/structure.py
  • flixopt/topology_accessor.py
  • mkdocs.yml
  • pyproject.toml
  • tests/flow_system/test_flow_system_resample.py
  • tests/flow_system/test_resample_equivalence.py
  • tests/io/test_io_conversion.py
  • tests/plotting/test_network_app.py
  • tests/plotting/test_topology_accessor.py
  • tests/test_scenarios.py
💤 Files with no reviewable changes (5)
  • flixopt/elements.py
  • tests/plotting/test_network_app.py
  • tests/plotting/test_topology_accessor.py
  • pyproject.toml
  • flixopt/structure.py

Comment thread docs/user-guide/mathematical-notation/effects-and-dimensions.md Outdated
Comment thread docs/user-guide/migration-guide-v8.md Outdated
Comment thread docs/user-guide/optimization/index.md
…penalty default

- effects-and-dimensions: drop the nonexistent shortage_penalty_per_flow_hour
  kwarg; imbalance_penalty_per_flow_hour covers both directions
- optimization guide: 1e5 is the example's diagnostic penalty, the default is
  None (strict balance)
- migration guide: normalize_weights row lists all three affected entry points
- topology docstring + results guide: replace plot_legacy/PyVis instructions
  with the Plotly Sankey API and write_html export
- glossary: fold the shortage_penalty row into imbalance_penalty

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@FBumann

FBumann commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

Collected into the v8 integration branch (see #747). Main stays v7-compatible; this content ships with v8.0.0. Branch kept — it is a merge parent of v8.

@FBumann FBumann closed this Jul 23, 2026
FBumann added a commit that referenced this pull request Jul 23, 2026
Squash of the remove-deprecated-api branch. Removes everything that outlived
its promised removal deadline (announced for v6/v7):

- Optimization / SegmentedOptimization / Results classes
- FlowSystem.sel/isel/resample/coords, plot_network and the network app
  wrappers, topology.plot_legacy() and the pyvis renderer (pyvis dependency
  dropped)
- normalize_weights parameter, the deprecated-kwarg rename bridge,
  from_old_results(), tests/deprecated and the deprecated_api marker

Kept: FlowSystem.from_old_dataset() + io conversion helpers as the supported
pre-v5 file migration path, with real-file regression tests (sunset: v9).
Adds docs/user-guide/migration-guide-v8.md and the CHANGELOG Unreleased
section.

BREAKING CHANGE: see the v8 migration guide for the complete removed->
replacement table.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant