Skip to content

fix: serialize PEP 508 deps as filesystem paths - #6072

Merged
baszalmstra merged 2 commits into
prefix-dev:mainfrom
aldbr:fix-pep508-url
May 12, 2026
Merged

baszalmstra merged 2 commits into
prefix-dev:mainfrom
aldbr:fix-pep508-url

Conversation

@aldbr

@aldbr aldbr commented May 11, 2026

Copy link
Copy Markdown
Contributor

Description

Pixi 0.68.0 introduced a regression where pixi add --pypi 'name @ file:///abs/path' writes the full file://... URL into the path = "..." field of pixi.toml. The resulting manifest cannot be solved by pixi: on reload, the URL string is treated as a relative PathBuf and joined with the project root.

From what I understand #5607 changed crates/pixi_pypi_spec/src/pep508.rs to wrap the parsed file path in a Verbatim, storing the user's original file://... string as given. The manifest serializer prefers given over the inner PathBuf, so the URL ended up under a field that expects a filesystem path.

rattler_lock::Verbatim's PartialEq only compares inner, ignoring given. The existing test_from_args assertion was a no-op for this class of bug because Verbatim::new_with_given(path, url) and Verbatim::new(path) compare equal.

Dropping the URL form of given for file:// URLs seems to restore the pre-#5607 behavior of storing a bare PathBuf, whose Display correctly produces a filesystem path on serialization.

# Before (0.68.0) — unloadable
subpkg = { path = "file:///tmp/.../sibling/subpkg" }

# After — matches 0.67.x
subpkg = { path = "/tmp/.../sibling/subpkg" }

Fixes #6071

How Has This Been Tested?

  • fixed the existing test_from_args
  • new test_pep508_file_url_serializes_as_path to make sure there is no file:// URL into the path = "..." field
  • cargo test -p pixi_pypi_spec --features 'pixi_spec/rattler_lock'
  • pixi run lint

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 (Opus 4.7)

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added sufficient tests to cover my changes.

@aldbr
aldbr force-pushed the fix-pep508-url branch from cd10018 to c2d148c Compare May 11, 2026 15:30
Comment thread crates/pixi_pypi_spec/src/pep508.rs Resolved
@aldbr
aldbr force-pushed the fix-pep508-url branch from 85f84c4 to b887e99 Compare May 12, 2026 06:32
@baszalmstra baszalmstra changed the title fix(pypi_spec): serialize PEP 508 deps as filesystem paths fix: serialize PEP 508 deps as filesystem paths May 12, 2026
@baszalmstra
baszalmstra merged commit a2973a3 into prefix-dev:main May 12, 2026
37 checks passed
@baszalmstra

Copy link
Copy Markdown
Contributor

Thanks!

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.

pixi add --pypi 'name @ file:///abs/path' produces an unloadable manifest in 0.68.0

3 participants