PyPSA / PyPSA/linopy

Remove legacy semantics at linopy 1.0 (Stage 3)

Open
#846 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

model formulation refactor v1
Dominant language
Python
Stars
257
Forks
87
Avg merge
1d 3h
Merged PRs (30d)
29

Description

[!NOTE]
The following was generated by AI.

Tracks the final Stage 3 of the v1 arithmetic-convention rollout (opt-in → default → 1.0): remove legacy semantics entirely, leaving only v1.

Prerequisite
  • v1 is the default — #845. Legacy stays reachable via options["semantics"] = "legacy" from the default flip (a pre-1.0 minor) through to 1.0 — however many minors that spans; this issue removes it at 1.0. Removing a documented opt-out is a breaking change, so it rides the 1.0 major.
The strip (at 1.0)

A dependency-ordered, mostly-mechanical checklist already exists in
arithmetics-design/legacy-removal.md. grep "LEGACY: remove at 1.0" finds
every inline marker. In summary:

  • Drop the semantics option, is_v1(), LinopySemanticsWarning, and every legacy warn/branch (config, semantics, expressions, variables, constraints).
  • Collapse the *_v1 / *_legacy method pairs into single implementations.
  • Remove the MultiIndex machinery kept alive only for legacy — the alignment.py level-projection subsystem, netcdf MI (de)serialize, assign_multiindex_safe, and the scattered isinstance(..., pd.MultiIndex) guards.
  • Drop the legacy side of the test matrix (the pytest.mark.legacy cases and the dual-semantics parametrization).
Docs
  • Re-frame arithmetics-design/convention.md / goals.md — drop the "v1"/legacy framing once there is only one convention.

Full checklist: arithmetics-design/legacy-removal.md.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with arithmetics-design/legacy-removal.md and run grep "LEGACY: remove at 1.0" to map the dependency-ordered work. Check the v1 default prerequisite in #845, then review the listed config, semantics, expressions, variables, constraints, alignment.py, netcdf MultiIndex handling, and tests. Done means legacy semantics and framing are removed and the remaining test matrix passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, documentation, testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.