Skip to content

feat: rename LinopyYamlError to LpspecError - #390

Closed
FBumann wants to merge 2 commits into
docs/trimfrom
fix/lpspec-error
Closed

FBumann wants to merge 2 commits into
docs/trimfrom
fix/lpspec-error

Conversation

@FBumann

@FBumann FBumann commented Jul 31, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #389. Stacked on #388 (base docs/trim), because it edits docs/design/linopy.md, which only exists there.

The problem

lps.solve goes YAML → polars → HiGHS and imports nothing from linopy. lpspec.linopy is not in __all__. The bare-install CI job runs the entire suite with linopy, xarray and pandas absent.

And yet the root of the public exception tree was LinopyYamlError — so on that path, the only place a user met the word "linopy" in normal use was the traceback of every error they hit, including errors about a parquet file.

The change

LpspecError(ValueError)
├── LanguageError  (SchemaError, DimensionError, PiecewiseExpansionError)
├── DataError
└── NoSolutionError

A pure rename: 33 insertions, 33 deletions, no alias, no shim.

No deprecation path, deliberately

The first version of this PR kept LinopyYamlError working through a module __getattr__ with a DeprecationWarning. That is gone, because the repo's own release tooling makes the argument against it: the conventional-commit gate refuses ! and BREAKING CHANGE: while the version is pinned to the alpha stream, on the grounds that "the alpha stream carries no compatibility promise, so there is nothing for the version to announce."

A deprecation shim is machinery in service of a guarantee we have not made. Removing it also keeps the declared surface exactly __all__ with nothing clever behind it.

Migration

# before
except lps.LinopyYamlError:

# after
except lps.LpspecError:

ValueError still catches everything, as before — LpspecError subclasses it.


709 passed, ruff check clean, ruff format clean, pyrefly 0 errors, mkdocs build --strict clean.

Not marked ! for the reason above.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a6e09820-06ce-40af-9b91-ac0bc9924a8c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

Three different relationships to linopy were being explained in fragments across
every page: it is not a runtime dependency, it is the differential oracle, and
it is an opt-in shim for models already in memory. Conflating them is what made
"the lanes" read as a structural theme rather than an implementation detail.

docs/design/linopy.md now holds all three, and the rest stops mentioning it.

SPEC loses 31 mentions down to two pointers. Most were internal guarantees
dressed as language rules — "both lanes reject it at load time", "cannot make
the lanes diverge", "what makes both lanes agree by construction". Those state
that our two implementations agree, which is a correctness property of ours and
not a rule about what a YAML file may contain; the reference now just states the
rule. The rest explained our semantics by pointing at linopy — "as in
linopy.Model.add_variables", "mirroring add_piecewise_formulation", "linopy's v1
arithmetic convention" — which tells a reader who has never used linopy nothing,
and in every case the rule was already stated completely in the table above it.

Section 8 keeps only the product path. The two paths genuinely accept different
*data* inputs (#60) while accepting the same language, and interleaving them
normalised the wart; that table moves to the linopy page where it reads as the
open question it is.

The pitch drops it too: README and index sold the benchmark as "against the
eager lane's own best path", which asks a prospective user to know there are two
before they know there is one. It is measured against linopy, so it now says so.

ARCHITECTURE keeps every mention. The two-lane structure *is* the architecture
there — hard rule 3, the four fences, the directory each lives in, all enforced
by tests. That page's subject is internal structure.

Filed while writing it: LinopyYamlError roots the public exception tree, so the
only place a user of the pure-polars path meets the word "linopy" in normal use
is the traceback of every error they hit (#389).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@read-the-docs-community

read-the-docs-community Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 lpspec | 🛠️ Build #33850491 | 📁 Comparing 1ad51b7 against latest (d9be107)

  🔍 Preview build  

28 files changed · + 2 added · ± 26 modified

+ Added

± Modified

@FBumann
FBumann force-pushed the fix/lpspec-error branch from 65467a3 to 852db0f Compare July 31, 2026 10:15
@FBumann FBumann changed the title feat!: rename LinopyYamlError to LpspecError feat: rename LinopyYamlError to LpspecError Jul 31, 2026
The old name dated from when this package was called linopy-yaml. It had become
the sharpest place a dependency the product path does not have leaked into the
surface: `lps.solve` goes YAML -> polars -> HiGHS and imports nothing from
linopy, `lpspec.linopy` is not in `__all__`, and the bare-install CI job proves
the whole suite runs without it — so on that path the only place a user met the
word "linopy" in normal use was the traceback of every error they hit.

Removed outright rather than aliased. The alpha stream carries no compatibility
promise — the release tooling says so itself, refusing `!` and `BREAKING CHANGE:`
on the grounds that there is nothing for the version to announce — so a
deprecation shim would have been machinery in service of a guarantee we have not
made. Migration is `except lps.LinopyYamlError` -> `except lps.LpspecError`, and
`ValueError` catches everything either way.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@FBumann

FBumann commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #394 — same commit, retargeted to main. GitHub closed this automatically when docs/trim was deleted on merging #388, and it cannot be reopened because the head branch was force-pushed (rebased onto main) after closure.

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.

1 participant