Add GraalPy support (#5141)

<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

Currently, `uv` refuses to install anything on GraalPy. This is
currently blocking GraalPy testing with cibuildwheel, since manylinux
includes both `uv` and `graalpy` (but doesn't test with `uv`), whereas
cibuildwheel defaults to `uv`. See e.g.
2750618295
where it gives
```
      + python -m build /project/sample_proj --wheel --outdir=/tmp/cibuildwheel/built_wheel --installer=uv
  * Creating isolated environment: venv+uv...
  * Using external uv from /usr/local/bin/uv
  * Installing packages in isolated environment:
    - setuptools >= 40.8.0
  > /usr/local/bin/uv pip install "setuptools >= 40.8.0"
  < error: Unknown implementation: `graalpy`
```

## Test Plan

I simply based the GraalPy support on PyPy and added some small tests.
I'm open to discussing how to test this. GraalPy is available for
manylinux images and with setup-python, so we should be able to add
tests against it to the CI. I locally confirmed by installing `uv` into
a GraalPy venv and then trying things like `uv pip install Pillow` and
testing those extensions.
This commit is contained in:
Tim Felgentreff 2024-07-19 02:28:28 +02:00 committed by GitHub
parent 54bca18184
commit 24a0268675
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 397 additions and 8 deletions

View file

@ -15,6 +15,7 @@ pub enum ImplementationName {
#[default]
CPython,
PyPy,
GraalPy,
}
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash)]
@ -25,13 +26,14 @@ pub enum LenientImplementationName {
impl ImplementationName {
pub(crate) fn possible_names() -> impl Iterator<Item = &'static str> {
["cpython", "pypy", "cp", "pp"].into_iter()
["cpython", "pypy", "graalpy", "cp", "pp", "gp"].into_iter()
}
pub fn pretty(self) -> &'static str {
match self {
Self::CPython => "CPython",
Self::PyPy => "PyPy",
Self::GraalPy => "GraalPy",
}
}
}
@ -50,6 +52,7 @@ impl From<&ImplementationName> for &'static str {
match v {
ImplementationName::CPython => "cpython",
ImplementationName::PyPy => "pypy",
ImplementationName::GraalPy => "graalpy",
}
}
}
@ -73,6 +76,7 @@ impl FromStr for ImplementationName {
match s.to_ascii_lowercase().as_str() {
"cpython" | "cp" => Ok(Self::CPython),
"pypy" | "pp" => Ok(Self::PyPy),
"graalpy" | "gp" => Ok(Self::GraalPy),
_ => Err(Error::UnknownImplementation(s.to_string())),
}
}