mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 02:48:17 +00:00
Add support for PyPy wheels (#1028)
## Summary
This PR adds support for PyPy wheels by changing the compatible tags
based on the implementation name and version of the current interpreter.
For now, we only support CPython and PyPy, and explicitly error out when
given other interpreters. (Is this right? Should we just fallback to
CPython tags...? Or skip the ABI-specific tags for unknown
interpreters?)
The logic is based on
4d85340613/src/packaging/tags.py (L247)
.
Note, however, that `packaging` uses the `EXT_SUFFIX` variable from
`sysconfig`... Instead, I looked at the way that PyPy formats the tags,
and recreated them based on the Python and implementation version. For
example, PyPy wheels look like
`cchardet-2.1.7-pp37-pypy37_pp73-win_amd64.whl` -- so that's `pp37` for
PyPy with Python version 3.7, and then `pypy37_pp73` for PyPy with
Python version 3.7 and PyPy version 7.3.
Closes https://github.com/astral-sh/puffin/issues/1013.
## Test Plan
I tested this manually, but I couldn't find macOS universal PyPy
wheels... So instead I added `cchardet` to a `requirements.in`, ran
`cargo run pip sync requirements.in --index-url
https://pypy.kmtea.eu/simple --verbose`, and added logging to verify
that the platform tags matched (even if the architecture didn't).
This commit is contained in:
parent
145ba0e5ab
commit
b0e73d796c
14 changed files with 165 additions and 57 deletions
|
@ -183,7 +183,7 @@ impl<'a> DistFinder<'a> {
|
|||
.requires_python
|
||||
.as_ref()
|
||||
.map_or(true, |requires_python| {
|
||||
requires_python.contains(self.interpreter.version())
|
||||
requires_python.contains(self.interpreter.python_version())
|
||||
})
|
||||
{
|
||||
continue;
|
||||
|
@ -219,7 +219,7 @@ impl<'a> DistFinder<'a> {
|
|||
.requires_python
|
||||
.as_ref()
|
||||
.map_or(true, |requires_python| {
|
||||
requires_python.contains(self.interpreter.version())
|
||||
requires_python.contains(self.interpreter.python_version())
|
||||
})
|
||||
{
|
||||
continue;
|
||||
|
|
|
@ -15,7 +15,7 @@ pub struct PythonRequirement {
|
|||
impl PythonRequirement {
|
||||
pub fn new(interpreter: &Interpreter, markers: &MarkerEnvironment) -> Self {
|
||||
Self {
|
||||
installed: interpreter.version().clone(),
|
||||
installed: interpreter.python_version().clone(),
|
||||
target: markers.python_full_version.version.clone(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -694,6 +694,8 @@ static TAGS_311: Lazy<Tags> = Lazy::new(|| {
|
|||
Arch::Aarch64,
|
||||
),
|
||||
(3, 11),
|
||||
"cpython",
|
||||
(3, 11),
|
||||
)
|
||||
.unwrap()
|
||||
});
|
||||
|
@ -724,6 +726,8 @@ static TAGS_310: Lazy<Tags> = Lazy::new(|| {
|
|||
Arch::Aarch64,
|
||||
),
|
||||
(3, 10),
|
||||
"cpython",
|
||||
(3, 10),
|
||||
)
|
||||
.unwrap()
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue