Skip to content
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

Test 3.13 free-threaded build on CI #8200

Merged
merged 7 commits into from
Jul 8, 2024

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Jul 4, 2024

For #8199.

Currently GitHub's actions/setup-python does not yet support free-threading but it has been requested: actions/setup-python#771 (give it a 👍)

However, it is available via deadsnakes/action:

This PR adds an Ubuntu 3.13-dev job to the matrix, to run tests with a free-threaded build.

The build actually runs with the GIL enabled, we'll need to explicitly indicate in the extensions that they should run with it disabled. This will be changed in a follow-up PR.

We can check if Python is built with free-threaded mode by looking for "experimental free-threading build" in python --version --version. On the CI we can see it under "Build system information":

sys.version		 ['3.13.0b2+ experimental free-threading build (main, Jun 27 2024, 08:49:18) [GCC 11.4.0]']

https://github.com/python-pillow/Pillow/actions/runs/9794942077/job/27045976814#step:5:10

Compared to the regular build:

sys.version		 ['3.13.0b3 (main, Jun 28 2024, 13:42:44) [GCC 11.4.0]']

https://github.com/python-pillow/Pillow/actions/runs/9794942077/job/27045975199#step:5:16

@hugovk hugovk added Testing Free-threading PEP 703 support labels Jul 4, 2024
Copy link
Contributor

@lysnikolaou lysnikolaou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left one comment regarding NumPy versioning.

The build actually runs with the GIL enabled, we'll need to explicitly indicate in the extensions that they should run with it disabled.

I would recomment adding the PYTHON_GIL=0 environment variable to keep the GIL disabled and test against that. It's still going to be some time before we can run without the GIL without the environment variable, since extension modules in dependencies (NumPy for example) can enable it as well.

.ci/install.sh Outdated Show resolved Hide resolved
@hugovk
Copy link
Member Author

hugovk commented Jul 4, 2024

Thanks for the review, how does this look?

Copy link
Contributor

@lysnikolaou lysnikolaou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just one nit in case you find it useful as well.

exclude:
- os: "macos-14"
python-version: "3.9"
- { os: "macos-14", python-version: "3.9" }

runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe include free-threading in the name for the free-threaded run?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added:
image

Copy link
Contributor

@lysnikolaou lysnikolaou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants