From 09781f48b365bac989e9aab8167d62848bdda3c9 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 | 48 ++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 09c98f48e3..f75132393b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,13 +18,20 @@ 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: + - free-threaded: true + architecture: "x64" + python-version: "3.13" + 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 +40,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/python-3.13-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 +89,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: + - free-threaded: true + python-version: "3.13" + 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 +108,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/python-3.13-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 +174,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 +192,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