From c59795f4f5b5a14d718b43eee12e462e1c712e53 Mon Sep 17 00:00:00 2001 From: Avasam Date: Sat, 12 Oct 2024 19:55:17 -0400 Subject: [PATCH] test free-threaded builds --- .github/workflows/main.yml | 47 ++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 09c98f48e3..f9a90f27f0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,13 +18,19 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] architecture: ["x64", "x86"] + free-threaded: [false] + include: + - python-version: "3.13" + architecture: "x64" + free-threaded: true steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} + if: ${{ ! matrix.free-threaded }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -33,6 +39,19 @@ jobs: cache-dependency-path: .github/workflows/main.yml check-latest: true + # From https://py-free-threading.github.io/ci/#windows-ci-setup-via-custom-powershell + # Until either the following are available: + # https://github.com/actions/setup-python/issues/771 + # https://github.com/astral-sh/uv/issues/7193 + - name: Set up Python 3.13t + if: ${{ matrix.free-threaded }} + run: | + $pythonInstallerUrl = "https://www.python.org/ftp/python/3.13.0/python-3.13.0-amd64.exe" + Invoke-WebRequest $pythonInstallerUrl -OutFile setup-python.exe + Start-Process "setup-python.exe" -argumentlist "/quiet PrependPath=1 TargetDir=C:\Python313 Include_freethreaded=1" -wait + C:\Python313\python3.13t.exe -m pip install -r requirements.txt + C:\Python313\python3.13t.exe -c "import sys; print(sys._is_gil_enabled())" + - name: Setup environment run: | python --version @@ -69,11 +88,17 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12", "3.13-dev"] + python-version: ["3.10", "3.11", "3.12", "3.13"] + free-threaded: [false] + include: + - python-version: "3.13" + free-threaded: true + steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} + if: ${{ ! matrix.free-threaded }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -82,6 +107,19 @@ jobs: cache-dependency-path: .github/workflows/main.yml check-latest: true + # From https://py-free-threading.github.io/ci/#windows-ci-setup-via-custom-powershell + # Until either the following are available: + # https://github.com/actions/setup-python/issues/771 + # https://github.com/astral-sh/uv/issues/7193 + - name: Set up Python 3.13t + if: ${{ matrix.free-threaded }} + run: | + $pythonInstallerUrl = "https://www.python.org/ftp/python/3.13.0/python-3.13.0-amd64.exe" + Invoke-WebRequest $pythonInstallerUrl -OutFile setup-python.exe + Start-Process "setup-python.exe" -argumentlist "/quiet PrependPath=1 TargetDir=C:\Python313 Include_freethreaded=1" -wait + C:\Python313\python3.13t.exe -m pip install -r requirements.txt + C:\Python313\python3.13t.exe -c "import sys; print(sys._is_gil_enabled())" + - name: Setup Environment run: | python --version @@ -135,8 +173,7 @@ jobs: fail-fast: false matrix: # mypy 1.5 dropped support for Python 3.7 - # mypy won't understand "3.13-dev", keeping the CI simple by just omitting it - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -154,7 +191,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5