Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

CI Add CPython 3.13 free-threaded manylinux wheel #29247

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

Merged
merged 4 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions 13 .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ jobs:
python: 312
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
- os: ubuntu-latest
python: 313t
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
# TODO: remove next line when Python 3.13 is released
prerelease_pythons: True
lesteve marked this conversation as resolved.
Show resolved Hide resolved
free_threaded_support: True

# MacOS x86_64
- os: macos-12
Expand Down Expand Up @@ -154,7 +161,8 @@ jobs:

- name: Build and test wheels
env:
CIBW_PRERELEASE_PYTHONS: ${{ matrix.prerelease }}
Copy link
Member

Choose a reason for hiding this comment

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

What happened to the prerelease variable? Was it not used anywhere else?

It looked like this PR was renaming it from matrix.prerelease to matrix.prerelease_pythons which made me expect to see some other renames as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think matrix.prerelease was used at one point for Python 3.12 before Python 3.12 was released and then once Python 3.12 was released, the line was removed

CIBW_PRERELEASE_PYTHONS: ${{ matrix.prerelease_pythons }}
CIBW_FREE_THREADED_SUPPORT: ${{ matrix.free_threaded_support }}
CIBW_ENVIRONMENT: SKLEARN_SKIP_NETWORK_TESTS=1
SKLEARN_BUILD_PARALLEL=3
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
Expand All @@ -167,7 +175,8 @@ jobs:
CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir}
CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }}
CIBW_TEST_REQUIRES: pytest pandas
CIBW_TEST_REQUIRES: pytest
CIBW_BEFORE_TEST: bash {project}/build_tools/wheels/cibw_before_test.sh
CIBW_TEST_COMMAND: bash {project}/build_tools/wheels/test_wheels.sh
CIBW_TEST_COMMAND_WINDOWS: bash {project}/build_tools/github/test_windows_wheels.sh ${{ matrix.python }}
CIBW_BUILD_VERBOSITY: 1
Expand Down
7 changes: 7 additions & 0 deletions 7 build_tools/wheels/build_wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ if [[ "$GITHUB_EVENT_NAME" == "schedule" || "$CIRRUS_CRON" == "nightly" ]]; then
export CIBW_BUILD_FRONTEND='pip; args: --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"'
fi

if [[ "$CIBW_FREE_THREADED_SUPPORT" =~ [tT]rue ]]; then
Copy link
Member Author

@lesteve lesteve Jun 13, 2024

Choose a reason for hiding this comment

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

The regex here is because I am not too sure about yaml value plus its env var translation. It looks like you can use true and True in the yaml and the env variable will be "true". You could imagine using "True" (a string rather than a boolean) in the yaml and that should still work I think.

# Numpy, scipy, Cython only have free-threaded wheels on scientific-python-nightly-wheels
# TODO: remove this after CPython 3.13 is released (scheduled October 2024)
# and our dependencies have free-threaded wheels on PyPI
export CIBW_BUILD_FRONTEND='pip; args: --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"'
fi

# The version of the built dependencies are specified
# in the pyproject.toml file, while the tests are run
# against the most recent version of the dependencies
Expand Down
15 changes: 15 additions & 0 deletions 15 build_tools/wheels/cibw_before_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e
set -x

FREE_THREADED_BUILD="$(python -c"import sysconfig; print(bool(sysconfig.get_config_var('Py_GIL_DISABLED')))")"
if [[ $FREE_THREADED_BUILD == "True" ]]; then
# TODO: remove when numpy and scipy have releases with free-threaded wheels
python -m pip install --pre --extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy scipy
else
# There is no pandas free-threaded wheel at the time of writing, so we only
# install pandas in other builds
# TODO: adapt when there is a pandas free-threaded wheel
python -m pip install pandas
fi
8 changes: 8 additions & 0 deletions 8 build_tools/wheels/test_wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ set -x
python -c "import joblib; print(f'Number of cores (physical): \
{joblib.cpu_count()} ({joblib.cpu_count(only_physical_cores=True)})')"

FREE_THREADED_BUILD="$(python -c"import sysconfig; print(bool(sysconfig.get_config_var('Py_GIL_DISABLED')))")"
if [[ $FREE_THREADED_BUILD == "True" ]]; then
# TODO: delete when importing numpy no longer enables the GIL
# setting to zero ensures the GIL is disabled while running the
# tests under free-threaded python
export PYTHON_GIL=0
fi

# Test that there are no links to system libraries in the
# threadpoolctl output section of the show_versions output:
python -c "import sklearn; sklearn.show_versions()"
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.