fix: expand extras self-refs, drop PEP 517 fallback#5992
Open
baszalmstra wants to merge 3 commits intoprefix-dev:mainfrom
Open
fix: expand extras self-refs, drop PEP 517 fallback#5992baszalmstra wants to merge 3 commits intoprefix-dev:mainfrom
baszalmstra wants to merge 3 commits intoprefix-dev:mainfrom
Conversation
The lockfile-v7 refactor moved per-package backend workspaces from `.pixi/build/work/` to `.pixi/bld/<package>/<workspace_key>/`. https://claude.ai/code/session_018Wo78WYzQZBRWQQ3zNSsE4
UV's static `database.requires_dist` keeps `pkg[group]` self-references from `[project.optional-dependencies]` as-is, while build backends like hatchling write the expanded contents into the wheel METADATA at lock time. The two views compare as different, so the satisfiability check falsely reports the lock-file as out-of-date for projects that compose their extras (e.g. Deltares/Ribasim's `all = ["pkg[a]", "pkg[b]"]`). Run the same expansion ourselves on the static-parse output: each `pkg[a, b]; <outer marker>` is replaced by the raw entries of groups `a` and `b` carrying the outer marker. Cycles in the optional-deps graph are broken on the path that closes them. Also dedup the requires_dist diff display and include extras so the "added: [pkg, pkg, pkg]" output becomes "added: [pkg[a], pkg[b]]". https://claude.ai/code/session_018Wo78WYzQZBRWQQ3zNSsE4
a60f984 to
91d9d6c
Compare
The lockfile-v7 refactor (prefix-dev#5607) introduced `read_local_package_metadata` which fell back to `get_or_build_wheel_metadata` when uv's static `requires_dist` declined. That fallback needs the host conda prefix to have Python, but cross-platform satisfiability runs on platforms that may not be in the lock at all. The resulting `PythonMissingError` panicked out through `LazyBuildDispatch::interpreter` past this path's missing `catch_unwind`, aborting `pixi run` / `pixi reinstall` on hosts whose platform was missing from the lock (e.g. macOS arm64 against a linux-64-only lock). Restrict the function to uv's static path. `Ok(Some)` feeds drift detection; `Ok(None)` (uv's "static doesn't apply" classification) trusts the lock; `Err` surfaces as `PlatformUnsat::FailedToReadLocalMetadata` to force a re-solve. Verified for uv 0.9.5 that `database.requires_dist` itself does not invoke the interpreter. Co-authored-by: Bas Zalmstra <4995967+baszalmstra@users.noreply.github.com> https://claude.ai/code/session_018Wo78WYzQZBRWQQ3zNSsE4
91d9d6c to
9dd1b71
Compare
Contributor
Author
|
@nichmor The last two commits in this PR touch some of the code you wrote. Would you be able to take a look whether the changes make sense to you? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After the lockfile-v7 refactor (#5607)
pixi install --lockedstarted reporting false drift on a couple of common shapes. This PR fixes the satisfiability check end-to-end and adapts one stale test path along the way.Changes
test_workspace_variants_separate_work_directories: work directories moved from.pixi/build/work/<pkg>--<hash>/to.pixi/bld/<pkg>/<workspace_key>/in the lockfile-v7 refactor. Test now looks in the new location.Expand
pkg[group]self-references in staticrequires_dist: UV's staticdatabase.requires_distkeepspkg[group]self-references from[project.optional-dependencies]as-is, while build backends like hatchling write the expanded contents into the wheel METADATA at lock time. The two views compare as different, so satisfiability falsely reports the lock-file as out-of-date for any project that composes its extras (e.g. Deltares/Ribasim'sall = ["pkg[a]", "pkg[b]"]).We now run the same expansion ourselves: each
pkg[a, b]; <outer marker>is replaced by the raw entries of groupsaandbcarrying the outer marker. Cycles in the optional-deps graph (e.g.a → b → a) are broken on the path that closes them.Also dedups the requires-dist diff message and includes extras, so
added: [pkg, pkg, pkg]becomesadded: [pkg[a], pkg[b]].Skip PEP 517 build during the satisfiability check:
read_local_package_metadatapreviously fell back toget_or_build_wheel_metadatawhen uv's staticrequires_distdeclined. That fallback needs the host conda prefix to have Python, but cross-platform satisfiability runs on platforms that may not be in the lock at all. The resultingPythonMissingErrorpanicked throughLazyBuildDispatch::interpreterpast this path's missingcatch_unwind, abortingpixi run/pixi reinstallon hosts whose platform was missing from the lock (e.g. macOS arm64 against a linux-64-only lock).The function is now restricted to uv's static path.
Ok(Some)feeds drift detection (then runs through the self-extras expansion);Ok(None)(uv's "static doesn't apply" classification) trusts the lock;Errsurfaces asPlatformUnsat::FailedToReadLocalMetadatato force a re-solve.Verified for uv 0.9.5 that
database.requires_distitself does not invoke the interpreter.Verification
target/release/pixifrom the branch, ranpixi install --lockedagainstDeltares/Ribasim@main(v6 lockfile): exit 0, install completes, nolock-file not up-to-dateand nometadata for local package 'ribasim' has changedin the trace. Static-only path is exercised forribasim,ribasim-api, andribasim-testmodelsper the debug log.