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.
Today the read-side uses
varsbut the typed mutation API usesvariables:Constraint.vars(property + deprecated setter)Constraint.update(variables=...)(kwarg)LinearExpression.vars,QuadraticExpression.vars, and the underlying Dataset keyThe kwarg was
variablesto avoid shadowing thevars()builtin in kwarg position — that reasoning doesn't apply to property names. Result isc.varsto read butc.update(variables=...)to mutate, which is mildly confusing.Proposal
Rename
.vars→.variablesonConstraint,LinearExpression,QuadraticExpression, and the underlying Dataset key. Keep.varsas a deprecated alias for one release cycle, then remove.Scope / cost
c.varsdirectly in many places — needs coordination..variables, alias.varswithDeprecationWarning, remove later.Out of scope for #727 (typed
.update()API); tracking separately.