-
Notifications
You must be signed in to change notification settings - Fork 950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GraalPy support #5141
Merged
Merged
Add GraalPy support #5141
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -692,6 +692,137 @@ jobs: | |
run: | | ||
.\uv.exe pip install anyio | ||
|
||
integration-test-graalpy-linux: | ||
needs: build-binary-linux | ||
name: "integration test | graalpy on ubuntu" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "graalpy24.0" | ||
|
||
- name: "Download binary" | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: uv-linux-${{ github.sha }} | ||
|
||
- name: "Prepare binary" | ||
run: chmod +x ./uv | ||
|
||
- name: Graalpy info | ||
run: | | ||
which graalpy | ||
echo "GRAAL_PYTHONHOME=$(graalpy -c 'print(__graalpython__.home)')" >> $GITHUB_ENV | ||
|
||
- name: "Create a virtual environment" | ||
run: | | ||
./uv venv -p $(which graalpy) | ||
|
||
- name: "Check for executables" | ||
run: | | ||
check_in_bin() { | ||
local executable_name=$1 | ||
local bin_path=".venv/bin" | ||
|
||
if [[ -x "$bin_path/$executable_name" ]]; then | ||
return 0 | ||
else | ||
echo "Executable '$executable_name' not found in folder '$bin_path'." | ||
return 1 | ||
fi | ||
} | ||
|
||
executables=("graalpy" "python3" "python") | ||
|
||
all_found=true | ||
for executable_name in "${executables[@]}"; do | ||
check_in_bin "$executable_name" "$folder_path" | ||
result=$? | ||
|
||
if [[ $result -ne 0 ]]; then | ||
all_found=false | ||
fi | ||
done | ||
|
||
if ! $all_found; then | ||
echo "One or more expected executables were not found." | ||
exit 1 | ||
fi | ||
|
||
- name: "Check version" | ||
run: | | ||
.venv/bin/graalpy --version | ||
.venv/bin/python3 --version | ||
.venv/bin/python --version | ||
|
||
- name: "Check install" | ||
run: | | ||
./uv pip install anyio | ||
|
||
integration-test-graalpy-windows: | ||
needs: build-binary-windows | ||
name: "integration test | graalpy on windows" | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: timfel/setup-python@fc9bcb4a04f5b1ea7d678c2ca7ea1c479a2468d7 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR to setup-python is open: actions/setup-python#880 |
||
with: | ||
python-version: "graalpy24.0" | ||
|
||
- name: "Download binary" | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: uv-windows-${{ github.sha }} | ||
|
||
- name: Graalpy info | ||
run: Get-Command graalpy | ||
|
||
- name: "Create a virtual environment" | ||
run: | | ||
$graalpy = (Get-Command graalpy).source | ||
.\uv.exe venv -p $graalpy | ||
|
||
- name: "Check for executables" | ||
shell: python | ||
run: | | ||
import sys | ||
from pathlib import Path | ||
|
||
def binary_exist(binary): | ||
binaries_path = Path(".venv\\Scripts") | ||
if (binaries_path / binary).exists(): | ||
return True | ||
print(f"Executable '{binary}' not found in folder '{binaries_path}'.") | ||
|
||
all_found = True | ||
expected_binaries = [ | ||
"graalpy.exe", | ||
"python.exe", | ||
"python3.exe", | ||
] | ||
for binary in expected_binaries: | ||
if not binary_exist(binary): | ||
all_found = False | ||
|
||
if not all_found: | ||
print("One or more expected executables were not found.") | ||
sys.exit(1) | ||
|
||
- name: "Check version" | ||
run: | | ||
& .venv\Scripts\graalpy.exe --version | ||
& .venv\Scripts\python3.exe --version | ||
& .venv\Scripts\python.exe --version | ||
|
||
- name: "Check install" | ||
env: | ||
# Avoid debug build stack overflows. | ||
UV_STACK_SIZE: 2000000 # 2 megabyte, double the default on windows | ||
run: | | ||
.\uv.exe pip install anyio | ||
|
||
integration-test-github-actions: | ||
needs: build-binary-linux | ||
name: "integration test | github actions" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1640,6 +1640,14 @@ mod tests { | |
PythonRequest::parse("pp"), | ||
PythonRequest::Implementation(ImplementationName::PyPy) | ||
); | ||
assert_eq!( | ||
PythonRequest::parse("graalpy"), | ||
PythonRequest::Implementation(ImplementationName::GraalPy) | ||
); | ||
assert_eq!( | ||
PythonRequest::parse("gp"), | ||
PythonRequest::Implementation(ImplementationName::GraalPy) | ||
); | ||
assert_eq!( | ||
PythonRequest::parse("cp"), | ||
PythonRequest::Implementation(ImplementationName::CPython) | ||
|
@@ -1658,6 +1666,20 @@ mod tests { | |
VersionRequest::from_str("3.10").unwrap() | ||
) | ||
); | ||
assert_eq!( | ||
PythonRequest::parse("graalpy3.10"), | ||
PythonRequest::ImplementationVersion( | ||
ImplementationName::GraalPy, | ||
VersionRequest::from_str("3.10").unwrap() | ||
) | ||
); | ||
assert_eq!( | ||
PythonRequest::parse("gp310"), | ||
PythonRequest::ImplementationVersion( | ||
ImplementationName::GraalPy, | ||
VersionRequest::from_str("3.10").unwrap() | ||
) | ||
); | ||
assert_eq!( | ||
PythonRequest::parse("cp38"), | ||
PythonRequest::ImplementationVersion( | ||
|
@@ -1679,6 +1701,20 @@ mod tests { | |
VersionRequest::from_str("3.10").unwrap() | ||
) | ||
); | ||
assert_eq!( | ||
PythonRequest::parse("[email protected]"), | ||
PythonRequest::ImplementationVersion( | ||
ImplementationName::GraalPy, | ||
VersionRequest::from_str("3.10").unwrap() | ||
) | ||
); | ||
assert_eq!( | ||
PythonRequest::parse("graalpy310"), | ||
PythonRequest::ImplementationVersion( | ||
ImplementationName::GraalPy, | ||
VersionRequest::from_str("3.10").unwrap() | ||
) | ||
); | ||
|
||
let tempdir = TempDir::new().unwrap(); | ||
assert_eq!( | ||
|
@@ -1749,6 +1785,18 @@ mod tests { | |
.to_canonical_string(), | ||
"[email protected]" | ||
); | ||
assert_eq!( | ||
PythonRequest::Implementation(ImplementationName::GraalPy).to_canonical_string(), | ||
"graalpy" | ||
); | ||
assert_eq!( | ||
PythonRequest::ImplementationVersion( | ||
ImplementationName::GraalPy, | ||
VersionRequest::from_str("3.10").unwrap() | ||
) | ||
.to_canonical_string(), | ||
"[email protected]" | ||
); | ||
|
||
let tempdir = TempDir::new().unwrap(); | ||
assert_eq!( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workaround for 24.0 bug (fixed in 24.1, due out in September)