Skip to content

feat: refactor pixi pypi spec#5155

Merged
tdejager merged 2 commits intoprefix-dev:mainfrom
tdejager:refactor/pixi-pypi-spec
Dec 18, 2025
Merged

feat: refactor pixi pypi spec#5155
tdejager merged 2 commits intoprefix-dev:mainfrom
tdejager:refactor/pixi-pypi-spec

Conversation

@tdejager
Copy link
Contributor

@tdejager tdejager commented Dec 17, 2025

Description

I was looking into how to marry tool.uv.sources from pyproject and our pypi-dependencies into a more coherent design. Currently we do not allow for a top-level tool.uv.sources at all, and I wanted to change that. I then quickly ran into the fact that our design differs from the uv way of looking quite a bit. So decided to do this refactor first.

This refactors PixiPypiSpec to follow UV's pattern with a struct + source enum design.

The new design separates:

  • PixiPypiSource enum with variants: Registry, Git, Path, Url
  • PixiPypiSpec struct with extras and source fields

This makes the code cleaner because you can now access spec.extras directly without having to match on every variant. It also aligns better with how uv structures their Requirement + RequirementSource types, which makes the mental model easier when working with both codebases.

Also renamed is_direct_dependency to is_source_dependency as that's a bit more descriptive for what it actually checks.

How Has This Been Tested?

Ran the full pixi r test-slow suite - 931 tests pass. Also verified backwards compatibility by checking that the TOML serialization format stays the same (simple version strings like ">=1.0" still work, as do table formats with extras/index).

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.5

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.

@tdejager tdejager added the test:extra_slow Run the extra slow tests label Dec 17, 2025
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@tdejager tdejager merged commit 669a9e2 into prefix-dev:main Dec 18, 2025
68 of 72 checks passed
ruben-arts pushed a commit to ruben-arts/pixi that referenced this pull request Dec 22, 2025
This refactors PixiPypiSpec to follow UV's pattern with a struct + source enum design.
The new design separates:
    PixiPypiSource enum with variants: Registry, Git, Path, Url
    PixiPypiSpec struct with extras and source fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:extra_slow Run the extra slow tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants