diff --git a/.ci/install.sh b/.ci/install.sh index 1eb098be9c1..8e65f64c447 100755 --- a/.ci/install.sh +++ b/.ci/install.sh @@ -37,12 +37,18 @@ python3 -m pip install -U pytest-timeout python3 -m pip install pyroma if [[ $(uname) != CYGWIN* ]]; then - python3 -m pip install numpy + # TODO Update condition when NumPy supports free-threading + if [[ "$PYTHON_GIL" == "0" ]]; then + python3 -m pip install numpy --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple + else + python3 -m pip install numpy + fi # PyQt6 doesn't support PyPy3 if [[ $GHA_PYTHON_VERSION == 3.* ]]; then sudo apt-get -qq install libegl1 libxcb-cursor0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxkbcommon-x11-0 - python3 -m pip install pyqt6 + # TODO Update condition when pyqt6 supports free-threading + if ! [[ "$PYTHON_GIL" == "0" ]]; then python3 -m pip install pyqt6 ; fi fi # Pyroma uses non-isolated build and fails with old setuptools diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0972459b0fb..6e63333b0da 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,26 +50,24 @@ jobs: "3.9", ] include: - - python-version: "3.11" - PYTHONOPTIMIZE: 1 - REVERSE: "--reverse" - - python-version: "3.10" - PYTHONOPTIMIZE: 2 + - { python-version: "3.11", PYTHONOPTIMIZE: 1, REVERSE: "--reverse" } + - { python-version: "3.10", PYTHONOPTIMIZE: 2 } + # Free-threaded + - { os: "ubuntu-latest", python-version: "3.13-dev", disable-gil: true } # M1 only available for 3.10+ - - os: "macos-13" - python-version: "3.9" + - { os: "macos-13", python-version: "3.9" } 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 }} + name: ${{ matrix.os }} Python ${{ matrix.python-version }} ${{ matrix.disable-gil && 'free-threaded' || '' }} steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 + if: "${{ !matrix.disable-gil }}" with: python-version: ${{ matrix.python-version }} allow-prereleases: true @@ -78,6 +76,18 @@ jobs: ".ci/*.sh" "pyproject.toml" + - name: Set up Python ${{ matrix.python-version }} (free-threaded) + uses: deadsnakes/action@v3.1.0 + if: "${{ matrix.disable-gil }}" + with: + python-version: ${{ matrix.python-version }} + nogil: ${{ matrix.disable-gil }} + + - name: Set PYTHON_GIL + if: "${{ matrix.disable-gil }}" + run: | + echo "PYTHON_GIL=0" >> $GITHUB_ENV + - name: Build system information run: python3 .github/workflows/system-info.py