feat: add --from-lockfile to pixi workspace export#5989
Merged
ruben-arts merged 2 commits intoprefix-dev:mainfrom May 6, 2026
Merged
feat: add --from-lockfile to pixi workspace export#5989ruben-arts merged 2 commits intoprefix-dev:mainfrom
--from-lockfile to pixi workspace export#5989ruben-arts merged 2 commits intoprefix-dev:mainfrom
Conversation
Add a `--from-lockfile` flag to `pixi workspace export conda-environment` that renders a frozen environment.yaml using the package versions resolved in the lock file instead of the manifest specs. Conda packages are pinned as `name ==version build`, registry PyPI packages as `name==version`, and git/file/path PyPI sources keep their direct reference URLs. Closes prefix-dev#5825 https://claude.ai/code/session_011qEmEGrK3p1pmeVAwydSc7
- Replace `pixi install` with `pixi lock` in error help text since the user just wants the lock file refreshed, not the env materialised. - Regenerate the autogenerated CLI reference page to surface the new --from-lockfile flag. - Mention the new flag in the conda switching guide. https://claude.ai/code/session_011qEmEGrK3p1pmeVAwydSc7
ruben-arts
approved these changes
May 6, 2026
4 tasks
baszalmstra
added a commit
to baszalmstra/pixi
that referenced
this pull request
May 6, 2026
…k 0.29 prefix-dev#5989 added the new `pixi workspace export --from-lockfile` path against an older rattler_lock API. While that PR was open, rattler_lock split `LockedPackageRef` into a single `LockedPackage` enum, turned `PypiPackageData` into a `Distribution`/`Source` enum with method accessors (`name()`, `location()`, `version()`), removed the `editable` field, dropped `package_record` from `CondaSourceData`, and changed `Environment::packages` to take `rattler_lock::Platform<''_>` instead of `rattler_conda_types::Platform`. The PR was merged without rebasing onto those changes, so `cargo check` failed on `main` with seven errors in `crates/pixi_cli/src/workspace/export/conda_environment.rs`. This rebases the new code onto the current API: - swap `LockedPackageRef`/`LockedPackageRef::Pypi(p, _)` for `LockedPackage`/`LockedPackage::Pypi(p)` - read pypi fields through the new methods (`pypi.name()`, `pypi.location().inner()`, `pypi.version()`) - look the package up in the manifest pypi-deps for this environment + platform to decide editability instead of inferring it from the lockfile shape (transitive source pypi deps must not get rendered with `-e`) - resolve `rattler_conda_types::Platform` to `rattler_lock::Platform<''_>` via `lockfile_env.platforms().find(|p| p.subdir() == *platform)` before calling `Environment::packages` - replace `source.package_record.name.as_source()` with `source.name().as_source()` for conda source packages
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 a
--from-lockfileflag topixi workspace export conda-environmentthat renders a frozen environment.yaml using the package versions resolved in the lock file instead of the manifest specs. Conda packages are pinned asname ==version build, registry PyPI packages asname==version, and git/file/path PyPI sources keep their direct reference URLs.Closes #5825
How Has This Been Tested?
CI
AI Disclosure
Tools: Claude Code Web Opus 4.7 High
Checklist:
schema/model.py.