Skip to content

Unify naming: rename .vars → .variables across Constraint/LinearExpression/QuadraticExpression #730

@FBumann

Description

@FBumann

Today the read-side uses vars but the typed mutation API uses variables:

  • Constraint.vars (property + deprecated setter)
  • Constraint.update(variables=...) (kwarg)
  • Same split on LinearExpression.vars, QuadraticExpression.vars, and the underlying Dataset key

The kwarg was variables to avoid shadowing the vars() builtin in kwarg position — that reasoning doesn't apply to property names. Result is c.vars to read but c.update(variables=...) to mutate, which is mildly confusing.

Proposal

Rename .vars.variables on Constraint, LinearExpression, QuadraticExpression, and the underlying Dataset key. Keep .vars as a deprecated alias for one release cycle, then remove.

Scope / cost

  • Touches every internal callsite + the Dataset key.
  • PyPSA reads c.vars directly in many places — needs coordination.
  • Two-release deprecation: add .variables, alias .vars with DeprecationWarning, remove later.

Out of scope for #727 (typed .update() API); tracking separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions