Skip to content

Commit 4b6f0f3

Browse files
mgornyAA-Turner
andauthored
Apply suggestions from code review
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
1 parent 0064073 commit 4b6f0f3

1 file changed

Lines changed: 39 additions & 36 deletions

File tree

peps/pep-0817.rst

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ proposes:
4646
dynamically detect platform attributes and select the most suitable
4747
wheel.
4848

49-
The goal is for a familiar ``[uv] pip install <package>`` to provide
50-
the best user experience.
49+
The goal is for the obvious installation commands (``{tool} install <package>``)
50+
to select the most appropriate wheel, and provide the best user experience.
5151

5252

5353
Motivation
@@ -73,7 +73,7 @@ These include maintaining separate package indexes for different
7373
hardware configurations, bundling all potential variants into a single
7474
wheel of considerable size, or using separate package names
7575
(``mypackage-gpu``, ``mypackage-cpu``, etc.). Each of these approaches
76-
has significant drawbacks.
76+
has significant drawbacks and potential security implications.
7777

7878
According to the `2024 Python Developers Survey
7979
<https://lp.jetbrains.com/python-developers-survey-2024/#purposes-for-using-python>`__,
@@ -144,13 +144,13 @@ tags:
144144
While these tags effectively handle traditional compatibility
145145
dimensions, they cannot express modern requirements:
146146

147-
**GPU Accelerated Frameworks:** A wheel filename like
147+
* **GPU Accelerated Frameworks:** A wheel filename like
148148
``torch-2.9.0-cp313-cp313-manylinux_2_28_x86_64.whl`` provides no
149149
indication whether it supports NVIDIA CUDA, AMD ROCm,
150150
Intel XPU, or is CPU-only. Users cannot determine compatibility
151151
with their GPU hardware or drivers.
152152

153-
**CPU Instruction Sets:** A wheel filename like
153+
* **CPU Instruction Sets:** A wheel filename like
154154
``numpy-2.3.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl``
155155
provides no indication whether it uses optimized instructions
156156
for modern processors with AVX512, SHA-NI, and other specialized
@@ -159,7 +159,7 @@ require specific CPU baseline. This forces maintainers to either use
159159
inconvenient runtime dispatching, or rely on the lowest common
160160
denominator, leaving performance improvements on the table.
161161

162-
**Runtime Dependencies:** Scientific computing packages often depend on
162+
* **Runtime Dependencies:** Scientific computing packages often depend on
163163
specific BLAS implementations (OpenBLAS vs Intel MKL), MPI providers
164164
(OpenMPI vs MPICH), or other system libraries that affect both
165165
functionality and performance. The current wheel format is not able to
@@ -191,8 +191,8 @@ Projects such as `PyTorch <https://pytorch.org/get-started/locally/>`__
191191
and `RAPIDS <https://docs.rapids.ai/install/#selector>`__
192192
currently distribute packages that approximate "variants" through
193193
separate package indexes with custom URLs. We will use the
194-
example of PyTorch, while the problem, the workarounds and the impact
195-
for users also apply to other packages.
194+
example of PyTorch, while the problem, the workarounds, and the impact
195+
on users also apply to other packages.
196196

197197
.. figure:: pep-0817/pytorch_variant_selector.png
198198
:alt: A grid-based selector for PyTorch versions. Individual rows
@@ -219,7 +219,7 @@ Tools need to implement special handling for the way PyTorch uses local
219219
version segments. These requirements break the pattern that packages
220220
are usually installed with. Problems with installing PyTorch
221221
are a very common point of user confusion. To quantify this, on
222-
2025-12-05, 552 out of 8136, or 6.8%, of issues on `uv's issue tracker
222+
2025-12-05, 552 out of 8136 (6.8%), of issues on `uv's issue tracker
223223
<https://github.com/astral-sh/uv/issues/>`__ contained the term "torch".
224224

225225
Wheel variants remove this special casing and make GPU and TPU packages
@@ -286,8 +286,7 @@ clearly highlights the limit of such an approach. End users need to
286286
carefully read the CuPy installation documentation to figure out
287287
which package they need. Continuously having to create new PyPI
288288
packages, request increasing limits and keep the build infrastructure
289-
and documentation in sync, requires significant effort from software
290-
maintainers.
289+
and documentation in sync, requires significant effort from maintainers.
291290

292291
.. code:: text
293292
@@ -305,8 +304,8 @@ maintainers.
305304
cupy-rocm-6-0 cupy-rocm-6-1 cupy-rocm-6-2 cupy-rocm-6-3
306305
307306
308-
Extra-Dependency as variants
309-
''''''''''''''''''''''''''''
307+
Package extras as variants
308+
''''''''''''''''''''''''''
310309

311310
`JAX <https://docs.jax.dev/en/latest/installation.html>`__ uses a
312311
plugin-based approach. The central ``jax`` package provides a number of
@@ -316,7 +315,7 @@ e.g. ``jax[cuda12]`` or ``jax[tpu]``. This is far from ideal as
316315
installation, and consequently dependency chains, a fundamental expected
317316
behavior in the Python ecosystem, are dysfunctional.
318317

319-
JAX includes 12 extra selectors to cover all use cases - many of which
318+
JAX includes 12 extras to cover all use cases - many of which
320319
overlap and could be misleading to users if they don't read the
321320
documentation in detail.
322321

@@ -376,18 +375,18 @@ preventing proper provenance tracking.
376375
Ecosystem fragmentation
377376
'''''''''''''''''''''''
378377

379-
The lack of standardized variant support has led to ecosystem
380-
fragmentation:
378+
The lack of standardized support for solving against hardware
379+
and ABI requirements has led to ecosystem fragmentation:
381380

382-
**Inconsistent User Experience**: Each package uses different
383-
installation methods, creating confusion and reducing discoverability.
381+
* **Inconsistent User Experience**: Each project uses different
382+
installation methods, creating confusion and reducing discoverability.
384383

385-
**Development Tool Complications**: Installation tools, IDEs, and CI/CD
386-
systems struggle to handle non-standard installation requirements.
384+
* **Development Tool Complications**: Installers, IDEs, and CI/CD
385+
systems struggle to handle non-standard installation requirements.
387386

388-
**Error-proneness**: The established workarounds are often error-prone,
389-
and in the past they have lead to issues such as downloading incorrect
390-
artifacts.
387+
* **Fragility**: The established workarounds are often error-prone,
388+
and in the past they have lead to issues such as downloading incorrect
389+
artifacts.
391390

392391

393392
Impact on scientific computing and AI/ML workflows
@@ -736,18 +735,22 @@ end to ensure that the existing filename validation algorithms reject
736735
it:
737736

738737
- If both the build tag and the variant label are present, the filename
739-
contains too many components.
738+
contains too many components. Example:
740739

741-
Example:
742-
``numpy-2.3.2-1-cp313-cp313t-musllinux_1_2_x86_64-x86_64_v3.whl``
740+
.. code-block:: text
741+
742+
numpy-2.3.2-1-cp313-cp313t-musllinux_1_2_x86_64-x86_64_v3.whl
743+
^^^^^^^^^^
743744
744745
- If only the variant label is present, the Python tag at third position
745746
will be misinterpreted as a build number. Since the build number must
746747
start with a digit and no Python tags at the time start with digits,
747-
the filename is considered invalid.
748+
the filename is considered invalid. Example:
748749

749-
Example:
750-
``numpy-2.3.2-cp313-cp313t-musllinux_1_2_x86_64-x86_64_v3.whl``
750+
.. code-block:: text
751+
752+
numpy-2.3.2-cp313-cp313t-musllinux_1_2_x86_64-x86_64_v3.whl
753+
^^^^^
751754
752755
This behavior was confirmed for a number of existing tools:
753756
`auditwheel
@@ -760,7 +763,7 @@ This behavior was confirmed for a number of existing tools:
760763
<https://github.com/pypa/pip/blob/c46141c29c3646a3328bc4e51d354cc732fb1432/src/pip/_internal/models/wheel.py#L38-L46>`__,
761764
`poetry
762765
<https://github.com/python-poetry/poetry/blob/1c04c65149776ae4993fa508bef53373f45c66eb/src/poetry/utils/wheel.py#L23-L27>`__,
763-
`uv
766+
and `uv
764767
<https://github.com/astral-sh/uv/blob/f6a9b55eb73be4f1fb9831362a192cdd8312ab96/crates/uv-distribution-filename/src/wheel.rs#L182-L299>`__.
765768

766769

@@ -776,7 +779,7 @@ to group features defined by a single provider, and to avoid conflicts
776779
should multiple providers define a feature with the same name. This
777780
permits independent governance and evolution of every namespace.
778781

779-
The keys are restricted to lowercase letters, digits and underscores.
782+
The keys are restricted to lowercase letters, digits, and underscores.
780783
Uppercase characters are disallowed to avoid different spellings of the
781784
same name. The character set for values is more relaxed, to permit
782785
values resembling versions.
@@ -793,7 +796,7 @@ boolean logic.
793796
Variant properties are serialized into a structured 3-tuple format
794797
inspired by Trove Classifiers in :pep:`301`:
795798

796-
::
799+
.. code-block:: text
797800
798801
{namespace} :: {feature_name} :: {feature_value}
799802
@@ -1180,7 +1183,7 @@ dependencies pinned to different versions could prevent different
11801183
plugins from being installed simultaneously in the same environment.
11811184

11821185
It is recommended that these tools vendor, reimplement or lock the most
1183-
commonly used plugins to specific specific wheels after verifying
1186+
commonly used plugins to specific wheels after verifying
11841187
their trustworthiness, to enable the ability to securely install variant
11851188
wheels out-of-the-box. To reduce the maintenance costs, repositories of
11861189
such vetted plugins could be maintained collaboratively and shared
@@ -1253,7 +1256,7 @@ This is equivalent to the following regular expression:
12531256
``^[0-9a-z._]{1,16}$``.
12541257

12551258
Every label must uniquely correspond to a specific set of variant
1256-
properties, same for all wheels using the same label within a single
1259+
properties, which must be the same for all wheels using the same label within a single
12571260
package version. Variant labels should be specified at wheel build time,
12581261
as human-readable strings. The label ``null`` is reserved for the null
12591262
variant and must use an empty set of variant properties.
@@ -1370,8 +1373,8 @@ The top-level object is a dictionary rooted at a specific point in the
13701373
containing file. Its individual keys are sub-dictionaries that are
13711374
described in the subsequent sections, along with the requirements for
13721375
their presence. The tools must ignore unknown keys in the dictionaries
1373-
to permit future backwards compatible updates to the PEP. However, users
1374-
should not introduce custom keys to avoid potential future conflicts.
1376+
for forwards compatibility of updates to the PEP. However, users
1377+
MUST NOT use unsupported keys to avoid potential future conflicts.
13751378

13761379
A `JSON schema <https://json-schema.org/>`_ is included in the Appendix
13771380
of this PEP, to ease comprehension and validation of the metadata

0 commit comments

Comments
 (0)