feat(pixi-build): support package.run-constraints#5982
Merged
baszalmstra merged 3 commits intoprefix-dev:mainfrom May 6, 2026
Merged
feat(pixi-build): support package.run-constraints#5982baszalmstra merged 3 commits intoprefix-dev:mainfrom
package.run-constraints#5982baszalmstra merged 3 commits intoprefix-dev:mainfrom
Conversation
54a1229 to
1278987
Compare
baszalmstra
reviewed
May 6, 2026
Contributor
|
I tested it locally and it works with a |
ac478c3 to
61a19b9
Compare
baszalmstra
reviewed
May 6, 2026
Contributor
baszalmstra
left a comment
There was a problem hiding this comment.
I have only one comment! Otherwise look good!
package.run-constraints
Add `[package.run-constraints]` (and `[package.target.<sel>.run-constraints]`) to express conda `run_constrained` metadata on packages built with pixi. Constraints apply to packages in the run environment only when they are pulled in by another dependency — they never cause installation on their own, mirroring conda's existing semantics. The new field is threaded end-to-end: - pixi_manifest: new `SpecType::RunConstraints`; TOML parsing for the `[package.run-constraints]` and target-scoped variants. - pixi_build_types: new `Target.run_constraints` field on the protocol type, included in `is_empty`/`Hash` and round-tripped via serde. - pixi_build_type_conversions: `to_target_v1` propagates the bucket. - pixi_build_backend: `PackageSpecDependencies` and the `Targets` / `Dependencies` trait surfaces gain the new field; `from_targets_v1_to_conditional_requirements` emits constraints into `Requirements.run_constraints` for both default and per-selector targets. The wire protocol's `CondaBuildV1Params.run_constraints` was already in place; the dispatcher already routes them to rattler-build. - schema/model.py + regenerated `schema.json` / pyproject schemas so IDE autocomplete and validators see the new field. - docs: new section in `docs/reference/pixi_manifest.md`, a brief entry in `docs/build/dependency_types.md`, and a snippet block in the package-manifest TOML fixture. Tests cover each conversion layer: TOML parsing, target-specific routing, the pixi-build preview gate on source specs in `run-constraints`, the `to_target_v1` and `From<&Target>` conversions, `from_targets_v1_to_conditional_requirements` populating both default and platform-conditional entries, and a regression test for `Target::is_empty` so a future copy-paste bug can't silently drop a target whose only payload is `run-constraints`.
baszalmstra
approved these changes
May 6, 2026
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.
Add
[package.run-constraints](and[package.target.<sel>.run-constraints]) to express condarun_constrainedmetadata on packages built with pixi. Constraints apply to packages in the run environment only when they are pulled in by another dependency — they never cause installation on their own, mirroring conda's existing semantics.The new field is threaded end-to-end:
SpecType::RunConstraints; TOML parsing for the[package.run-constraints]and target-scoped variants.Target.run_constraintsfield on the protocol type, included inis_empty/Hashand round-tripped via serde.to_target_v1propagates the bucket.PackageSpecDependenciesand theTargets/Dependenciestrait surfaces gain the new field;from_targets_v1_to_conditional_requirementsemits constraints intoRequirements.run_constraintsfor both default and per-selector targets. The wire protocol'sCondaBuildV1Params.run_constraintswas already in place; the dispatcher already routes them to rattler-build.schema.json/ pyproject schemas so IDE autocomplete and validators see the new field.docs/reference/pixi_manifest.md, a brief entry indocs/build/dependency_types.md, and a snippet block in the package-manifest TOML fixture.Tests cover each conversion layer: TOML parsing, target-specific routing, the pixi-build preview gate on source specs in
run-constraints, theto_target_v1andFrom<&Target>conversions,from_targets_v1_to_conditional_requirementspopulating both default and platform-conditional entries, and a regression test forTarget::is_emptyso a future copy-paste bug can't silently drop a target whose only payload isrun-constraints.Closes #4871
Closes #5418
How Has This Been Tested?
New unit tests. I think this covers the functionality quite well. I also tried a manual test project, which worked fine for me.
AI Disclosure
Tools: Claude
Checklist:
schema/model.py.