Skip to content

fix(pypi): now cache miss when a no-binary, no-build was found#4362

Merged
tdejager merged 8 commits intoprefix-dev:mainfrom
tdejager:feat/no-build-binary-to-cache
Aug 18, 2025
Merged

fix(pypi): now cache miss when a no-binary, no-build was found#4362
tdejager merged 8 commits intoprefix-dev:mainfrom
tdejager:feat/no-build-binary-to-cache

Conversation

@tdejager
Copy link
Copy Markdown
Contributor

@tdejager tdejager commented Aug 15, 2025

This PR adds the case where we are using a built or non-built version from cache and we have no specified we want a source or dont want a binary package.

This is kind of a corner case, but uv covers it so its nice to have :)

Testing

Its a bit hard to test but you can do the following, pixd is the debug-built version of pixi:

pixd init foobar
cd foobar
pixd add python
pixd add --pypi sdist
# This should all work

pixd clean
# This removes the .pixi folder
# add pypi-options
awk '/^\[tasks\]/ && !done {print "[pypi-options]"; print "no-build = [\"sdist\"]"; print ""; done=1} 1' pixi.toml > file.toml.tmp && mv file.toml.tmp pixi.toml
pixd install --frozen

This should give the error:

Error:   × Failed to update PyPI packages for environment 'default'
  ├─▶ Failed to prepare distributions
  ╰─▶ Building source distributions is disabled, but attempted to build `sdist`

While before this change you would get:

✔ The default environment has been installed.

Why?

  1. We use the --frozen so skip resolution, otherwise this would trigger an error.
  2. Then, because of this PR, we get a cache miss, when checking if we have an available wheel in the cache. In the old version it would be a hit.
  3. Then we try to prepare the wheel but we are not allowed, so we end up seeing that error.

@tdejager tdejager requested a review from nichmor August 15, 2025 13:27
@tdejager tdejager marked this pull request as ready for review August 15, 2025 14:01
@tdejager tdejager changed the title feat: produces a cache miss when a no-binary, no-build was found fix: produces a cache miss when a no-binary, no-build was found Aug 15, 2025
@tdejager tdejager changed the title fix: produces a cache miss when a no-binary, no-build was found fix(pypi): now cache miss when a no-binary, no-build was found Aug 15, 2025
Copy link
Copy Markdown
Contributor

@nichmor nichmor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

@ruben-arts ruben-arts added the pypi Issue related to PyPI dependencies label Aug 18, 2025
@tdejager tdejager merged commit 814e857 into prefix-dev:main Aug 18, 2025
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pypi Issue related to PyPI dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants