Skip to content

feat: add a uv backend to setup-env library mode - #4

Open
lkstrp wants to merge 2 commits into
PyPSA:mainfrom
lkstrp:add-a-uv-backend-1
Open

lkstrp wants to merge 2 commits into
PyPSA:mainfrom
lkstrp:add-a-uv-backend-1

Conversation

@lkstrp

@lkstrp lkstrp commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

I don't think it's a good idea to default to pixi everywhere. See comment below.

This PR allows to just follow the upstream package manager. uv for uv repos like PyPSA, pixi for repos like PyPSA-Eur. pixi is not used as second toolchain if not needed/ defined by the importing repository.

PyPSA/PyPSA#2197 (review)

I am quite against this. The overhead is not marginal. And in the evolving world leading to worktrees and sandboxes its a problem for nearly no benefit. See stats below.

Next to that, the CI is here no longer testing the built wheel. Also the master is not testing fresh dependencies anymore. With pixi.toml we have two sources of truth next to pyproject.toml...

My counter proposal is here: #4

| | uv | pixi | Δ |
|---|---|---|---|
| Cold setup (empty cache) | 37.0 s | 46.6 s | +26% |
| Warm setup (per worktree) | 2.1 s | 4.2 s | 2x |
| Re-sync, nothing changed | 113 ms | 212 ms | 2x |
| run overhead | 55 ms | 213 ms | 4x |
| Cache + Python | 1.5 GB | 2.0 GB | +33% |
| Per extra worktree | 6.5 MB | ~130 MB | ~20x |
| 3 worktrees total | ~1.7 GB | ~2.4 GB | +40% |

@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (32c3d98) to head (4947bbc).

Additional details and impacted files
@@            Coverage Diff            @@
##              main        #4   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines            2         2           
=========================================
  Hits             2         2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@brynpickering

Copy link
Copy Markdown
Collaborator

Using pixi even for uv projects ensures we create environments including non-python libs in a consistent way, which covers existing uv backend projects (linopy, atlite, ppm). The overhead w.r.t. worktrees isn't relevant to the CI, although I agree there are performance hits when using it locally (I'm happy to accept them so that I don't have to think about those non-python libs).

Another thing is that the CI workflows are doing things slightly differently. They actively install packages with uv after installing the pixi environment that sets python + non-python libs. So, in theory, you get the best of both worlds...

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.

2 participants