Skip to content

Filter locked wheels by Python implementation - #23285

Closed
ZYZ666-RGB wants to merge 2 commits into
astral-sh:mainfrom
ZYZ666-RGB:cursor/implementation-name-lock-filter-29d4
Closed

ZYZ666-RGB wants to merge 2 commits into
astral-sh:mainfrom
ZYZ666-RGB:cursor/implementation-name-lock-filter-29d4

Conversation

@ZYZ666-RGB

Copy link
Copy Markdown

Summary

tool.uv.environments markers such as implementation_name == 'cpython' were applied while solving, but lockfile wheel selection only compared platform tags. PyPy wheels (for example numpy-…-pp311-pypy311_pp73-macosx_11_0_arm64.whl) stayed in uv.lock after uv lock, while Intel macOS wheels were dropped.

Language tags are now part of that same reachability check. A wheel remains in the lockfile only when at least one environment split can install that interpreter on that platform. platform_python_implementation is included, since it names the same interpreter (CPython, PyPy, or GraalPy's GraalVM). Generic py* and none wheels are unchanged, and the Windows ARM exception still keeps win_amd64 wheels for a compatible interpreter.

Fixes #23270

Test plan

  • Unit tests cover CPython, PyPy, GraalPy, and Pyston tags, mixed cp/pp tags, environment splits, and the Windows ARM win_amd64 exception.
  • Lock snapshots for a package that publishes both cp and pp wheels:
    • CPython environments drop PyPy wheels and still drop Intel macOS wheels. uv sync on CPython installs the CPython wheel.
    • A CPython-on-Linux / PyPy-on-macOS split keeps only the matching wheels.
    • platform_python_implementation == 'CPython' drops PyPy wheels.

Environment markers already drop wheels whose platform tags cannot be
installed. Language tags were ignored, so an environment limited to
CPython still recorded PyPy wheels.

A wheel stays in the lockfile only when some environment split can
install that interpreter on that platform. `implementation_name` and
`platform_python_implementation` are applied together with the existing
platform tags.
httpx's brotli extra depends on brotlicffi only when
platform_python_implementation is not CPython, and cffi is only pulled
in by that edge. CPython wheels for those packages cannot be installed
in the environments that need them, so the lock keeps brotlicffi's PyPy
wheels and cffi's source distribution.
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.

implementation_name filter doesn't work in environment

3 participants