ITADN

PEP 425 tag ordering example seems incorrect.

#4765Closedjsirois 创建于 2026-01-01
J
jsiroiscommented
Looking at the example here: https://github.com/python/peps/blob/152a687059b899e69f9e2a866c331c3cb86949e9/peps/pep-0425.rst?plain=1#L154-L173 The tag ordering matches: 1. The initial Pip commit (which I think the Pep was based off of): https://github.com/pypa/pip/commit/50c21119e5b54849f6b0a058684850be40e29516#diff-be6b193888b4e7a2aa955f0cdd33d27310a052729fc7e71650f4216d2f93bb98R89-R93 2. The initial packaging ingestion of the Pip code: https://github.com/pypa/packaging/pull/156 3. The modern packaging tag code: https://github.com/pypa/packaging/blob/e49f0fb5d1707bb1f34c834bac262e9a1e6d3d40/src/packaging/tags.py#L317-L329 and https://github.com/pypa/packaging/blob/e49f0fb5d1707bb1f34c834bac262e9a1e6d3d40/src/packaging/tags.py#L353-L354 That said, the tag ordering seems to violate the spirit at least of: > It is recommended that installers try to choose the most feature complete built distribution available (the one most specific to the installation environment) by default before falling back to pure Python versions published for older Python releases. In particular, the: sequence `py3<most-specific>-none-any`, `py3-none-any`, `py3<next-most-specific>-none-any`, ... seems like it should be `py3<most-specific>-none-any`, `py3<next-most-specific>-none-any`, ..., `py3-none-any`. For example, take a pure Python library that needs to parse toml as part of its larger responsibilities. Further, say the library supports Python>=3.9 and vendors `tomli` to support Python 3.9 and Python 3.10, but would like to ship without vendored `tomli` for Python>=3.11 where tomllib can be relied upon from the stdlib. Currently that library would need to produce these 2 wheels: 1. `py39.py310-none-any` (includes vendored `tomli`) 2. `py311-none-any` (does not include vendored `tomli`) Arguably, ideally, it could instead produce just: 1. `py3-none-any` (includes vendored `tomli`) 2. `py311-none-any` (does not include vendored `tomli`) This doesn't work optimally however for Python>=3.12 which will have the `py3-none-any` wheel selected for them with the current example and actual tag ordering. @pfmoore, @ncoghlan, @dholth or @brettcannon: is there a reason for injecting the least-specific version just after the head of the `none-any` sub-list that I'm missing?
关闭于 2026-01-04 10 条评论