Skip to content

fix: rebase workspace-export-from-lockfile onto rattler_lock 0.29#6028

Merged
baszalmstra merged 1 commit intoprefix-dev:mainfrom
baszalmstra:fix-export-from-lockfile
May 6, 2026
Merged

fix: rebase workspace-export-from-lockfile onto rattler_lock 0.29#6028
baszalmstra merged 1 commit intoprefix-dev:mainfrom
baszalmstra:fix-export-from-lockfile

Conversation

@baszalmstra
Copy link
Copy Markdown
Contributor

Description

#5989 added pixi workspace export --from-lockfile against an older rattler_lock API. While that PR was open, rattler_lock shipped a refactor that:

  • replaced LockedPackageRef with a single LockedPackage enum (and dropped the second _env_data tuple slot on the Pypi variant);
  • turned PypiPackageData into a Distribution / Source enum with method accessors (name(), location().inner(), version()), and removed the standalone editable field;
  • removed package_record from CondaSourceData (use source.name() instead);
  • changed Environment::packages to take rattler_lock::Platform<'lock> instead of rattler_conda_types::Platform.

#5989 was merged without rebasing onto those changes, so main now fails cargo check with seven errors in crates/pixi_cli/src/workspace/export/conda_environment.rs. This PR rebases that one new file onto the current API. Net diff is +29/-11 in a single file.

A few notes on the editable handling, since the lockfile no longer exposes it directly: editability is a manifest concept (the workspace's pixi.toml says editable = true), not a property the resolver writes back. So the new code builds the editable set from environment.pypi_dependencies(Some(*platform)) filtered by spec.editable() == Some(true) and looks each locked pypi package up by name. Transitive pypi source deps that happen to be PypiPackageData::Source are no longer incorrectly rendered with -e.

How Has This Been Tested?

Locally on Windows against the current main@upstream:

  • cargo check --workspace --all-targets — clean
  • cargo check --workspace --all-targets --features slow_integration_tests,online_tests — clean
  • cargo clippy --workspace --all-targets — clean
  • cargo fmt --check — clean

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: Claude

Checklist:

  • I have performed a self-review of my own code

@baszalmstra baszalmstra changed the title fix(pixi-cli): rebase workspace-export-from-lockfile onto rattler_lock 0.29 fix: rebase workspace-export-from-lockfile onto rattler_lock 0.29 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
@baszalmstra baszalmstra force-pushed the fix-export-from-lockfile branch from f595496 to 96a74b8 Compare May 6, 2026 16:52
@baszalmstra baszalmstra merged commit 6229468 into prefix-dev:main May 6, 2026
37 checks passed
@baszalmstra baszalmstra deleted the fix-export-from-lockfile branch May 6, 2026 18:12
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