Skip to content

Conversation

@FBumann
Copy link
Member

@FBumann FBumann commented Nov 22, 2025

Description

Add proper version to all deprecations

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Code refactoring

Related Issues

Closes #(issue number)

Testing

  • I have tested my changes
  • Existing tests still pass

Checklist

  • My code follows the project style
  • I have updated documentation if needed
  • I have added tests for new functionality (if applicable)

Summary by CodeRabbit

  • Bug Fixes
    • Deprecation warnings now state the planned removal version, giving clearer upgrade guidance.
  • Tests
    • Added extensive tests to validate deprecation warnings and removal-version messaging across features and plotting utilities.
  • Chore
    • Updated Unreleased changelog entries to document added deprecation tests and clarified removal-version wording.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 22, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a centralized DEPRECATION_REMOVAL_VERSION import and appends removal-version notices to deprecation warnings across code; also adds comprehensive tests covering these deprecations and updates CHANGELOG entries.

Changes

Cohort / File(s) Summary
Deprecation import + message updates
flixopt/calculation.py, flixopt/effects.py, flixopt/flow_system.py, flixopt/results.py
Added DEPRECATION_REMOVAL_VERSION import and appended "Will be removed in v{DEPRECATION_REMOVAL_VERSION}." to multiple deprecation warnings (active_timesteps, deprecated properties, network/weights warnings, plotting/results deprecations).
Message update (no import change)
flixopt/elements.py
Updated Bus deprecation message in Flow.__init__ to include removal-version notice and adjusted spacing in the message.
Tests: deprecation coverage
tests/test_deprecations.py
Added extensive tests asserting deprecation warnings include removal version across parameters, properties, plotting helpers, and a simple_results fixture for pipeline testing.
Changelog
CHANGELOG.md
Added Unreleased entries for deprecation tests and fixed deprecation warnings to specify removal version.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Rationale: consistent but cross-cutting string changes plus a large, new test file that requires reading test cases and understanding expected warning messages.
  • Files to pay extra attention to:
    • tests/test_deprecations.py — validate test coverage, fixtures, and exact warning message text.
    • flixopt/results.py and flixopt/effects.py — many deprecation sites; ensure messages interpolate version safely and do not break formatting.
    • flixopt/flow_system.py / flixopt/calculation.py — confirm no accidental logic or import cycles introduced by new import.

Possibly related PRs

Suggested labels

v3.0.0

Poem

🐰 A tiny hop, a gentle tweak,

Warnings now say the day they’ll leak.
Tests hop in to count each line,
“Will be removed in v…” — how fine!
My floppy ears applaud the sign.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'Improve filterwarnings' is vague and does not clearly reflect the actual changes. The PR focuses on adding version information to deprecations, not improving filterwarnings configuration. Rename the title to more accurately reflect the main change, such as 'Add version information to deprecation messages' or 'Include removal version in all deprecations'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description properly follows the template structure and includes a clear summary ('Add proper version to all deprecations'), but the Type of Change checkboxes are incomplete and testing fields are unchecked.
Docstring Coverage ✅ Passed Docstring coverage is 87.10% which is sufficient. The required threshold is 80.00%.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 481cf6f and e97b490.

📒 Files selected for processing (4)
  • CHANGELOG.md (2 hunks)
  • flixopt/flow_system.py (5 hunks)
  • flixopt/results.py (11 hunks)
  • tests/test_deprecations.py (5 hunks)

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

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

⚠️ Outside diff range comments (2)
flixopt/results.py (2)

2417-2422: Add version removal information to this deprecation warning.

This deprecation warning is missing the version removal information that was added to other warnings in this PR. For consistency with lines 2268-2274 (which deprecate the same parameters) and the PR objective to add version info to all deprecations, this warning should also include the removal version.

Apply this diff:

         warnings.warn(
             "The 'heatmap_timeframes' and 'heatmap_timesteps_per_frame' parameters are deprecated. "
-            "Use 'reshape_time=(timeframes, timesteps_per_frame)' instead.",
+            "Use 'reshape_time=(timeframes, timesteps_per_frame)' instead. "
+            f'Will be removed in v{DEPRECATION_REMOVAL_VERSION}.',
             DeprecationWarning,
             stacklevel=2,
         )

2436-2440: Add version removal information to this deprecation warning.

This deprecation warning is missing the version removal information that was added to other warnings in this PR. For consistency with lines 2288-2293 (which deprecate the same parameter) and the PR objective to add version info to all deprecations, this warning should also include the removal version.

Apply this diff:

         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,
         )
🧹 Nitpick comments (1)
flixopt/flow_system.py (1)

1109-1117: Consider updating the hardcoded version for consistency.

The all_elements property deprecation warning uses a hardcoded version "v4.0.0" (line 1113), while this PR establishes a pattern of using DEPRECATION_REMOVAL_VERSION for all other deprecation warnings.

For consistency and maintainability, consider updating this to:

f'This property will be removed in v{DEPRECATION_REMOVAL_VERSION}.'

Unless v4.0.0 is intentionally different from the value in DEPRECATION_REMOVAL_VERSION, in which case this is fine as-is.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 55b1fbd and 481cf6f.

📒 Files selected for processing (6)
  • CHANGELOG.md (1 hunks)
  • flixopt/calculation.py (3 hunks)
  • flixopt/effects.py (18 hunks)
  • flixopt/elements.py (1 hunks)
  • flixopt/flow_system.py (4 hunks)
  • flixopt/results.py (9 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
flixopt/results.py (1)
flixopt/config.py (1)
  • CONFIG (169-700)
flixopt/effects.py (2)
flixopt/elements.py (1)
  • label_full (614-615)
flixopt/structure.py (2)
  • label_full (984-985)
  • label_full (1476-1477)
🔇 Additional comments (14)
CHANGELOG.md (1)

70-71: Clear documentation of the deprecation warning improvements.

The changelog entry accurately describes the changes made to centralize deprecation version management. Good practice to document this refactoring.

flixopt/elements.py (1)

519-520: LGTM! Consistent deprecation message format.

The addition of the removal version notice improves user communication by clearly indicating when this deprecated feature will be removed.

flixopt/flow_system.py (3)

18-18: LGTM! Import added to support centralized deprecation version management.

This import enables the consistent use of DEPRECATION_REMOVAL_VERSION throughout the module, improving maintainability.


998-999: Consistent deprecation message update.

The warning message now clearly communicates when this deprecated behavior will be removed, improving user experience.


1169-1170: Well-coordinated deprecation warnings for the weights property.

Both the getter and setter now include the removal version notice, ensuring consistent messaging for this deprecated property.

Also applies to: 1185-1186

flixopt/effects.py (3)

19-19: LGTM! Essential import for centralized deprecation management.

This import enables consistent deprecation version messaging across all the Effect class properties.


256-257: Excellent systematic update of all deprecated Effect properties.

All deprecated property getters and setters now consistently include the removal version notice. This comprehensive update ensures users have clear guidance across the entire Effect API surface.

Also applies to: 267-268, 278-279, 289-290, 300-301, 311-312, 322-323, 333-334, 344-345, 355-356, 366-367, 377-378, 388-389, 399-400, 410-411, 421-422


637-638: Consistent deprecation messaging for effect object usage.

The warning for using Effect objects instead of labels now includes the removal version, maintaining consistency with the rest of the codebase.

flixopt/calculation.py (3)

28-28: LGTM! Import added for centralized deprecation version management.

This import enables consistent deprecation messaging for the active_timesteps parameter and property.


82-82: Clear deprecation messaging for the active_timesteps parameter.

The warning now includes the removal version, helping users plan their migration to the recommended flow_system.sel(time=...) or flow_system.isel(time=...) approach.


165-166: Well-coordinated deprecation warnings.

Both the active_timesteps parameter and property now include consistent removal version information, ensuring clear messaging regardless of how users access this deprecated feature.

flixopt/results.py (3)

18-18: LGTM: Import statement is correct.

The import of DEPRECATION_REMOVAL_VERSION from config is properly added.


230-236: LGTM: Deprecation warning properly updated.

The deprecation message now includes the removal version, which helps users plan their migration.


1325-1330: LGTM: Consistent deprecation warning format.

The indexer parameter deprecation properly includes version removal information.

… heatmap_timesteps_per_frame deprecation warning to include version removal information using

  DEPRECATION_REMOVAL_VERSION
  2. ✅ flixopt/results.py:2421-2426 - The color_map deprecation warning already had the version info (it was updated before I started)
  3. ✅ flixopt/flow_system.py:1109-1116 - Updated the hardcoded "v4.0.0" to use DEPRECATION_REMOVAL_VERSION for consistency with all other deprecation warnings
@FBumann FBumann merged commit b669c5c into main Nov 23, 2025
7 of 8 checks passed
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.

2 participants