Skip to content

[linopy v1 / linopy 0.8] Deprecated Constraint.lhs/.rhs setter used in constraint mutation #732

Description

@FBumann

Category: deprecated API (6 code sites) — linopy 0.8 deprecation, orthogonal to the semantics flag but blocks the build

Symptom

Under linopy 0.8, augmenting a constraint via the .lhs/.rhs setter emits:

DeprecationWarning: Constraint.lhs setter is deprecated and will be removed in
a future release; use Constraint.update(lhs=...) instead.

pyproject.toml escalates DeprecationWarning from the flixopt module to an error (error::DeprecationWarning:flixopt), so every model build aborts here before any semantics arithmetic even runs.

Location

  • flixopt/components.pyTransmissionModelcon_transmission.lhs += ...
  • flixopt/features.pyShareAllocationModel_eq_total.lhs -= ... (×3), share_constraints[name].lhs -= ...
  • flixopt/elements.pyBusModeleq_bus_balance.lhs += ...

Root cause

linopy 0.8 makes Constraint.update(...) the single mutation API and deprecates the .lhs/.rhssetters (the getters are fine).

Repro

Any effect/bus/transmission model build under linopy 0.8 with flixopt's strict pytest filterwarnings.

Proposed fix

con.lhs += exprcon.update(lhs=con.lhs + expr). Works on linopy 0.8; equivalent under both semantics.

Severity

Build-breaking under linopy 0.8 (via flixopt's warning-as-error config). Not a v1-semantics rule per se, but a prerequisite for running under the v1-capable linopy.

Fixed in #729.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    linopy-v1Compatibility with linopy v1 semantics (PR #717)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions