How to make "cibuildwheel" support for "cp313t" and "cp314t"

Now I use:

jobs:
  build-wheels:
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]

    steps:
      - uses: actions/checkout@v4

      - name: Setup Python (for cibuildwheel only)
        uses: actions/setup-python@v5
        with:
          python-version: "3.12"

      - name: Install cibuildwheel
        run: pip install cibuildwheel

      - name: Build wheels (CPython 3.10~3.14)
        run: python -m cibuildwheel --output-dir wheelhouse
        env:
          CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
          CIBW_PRERELEASE_PYTHONS: "1"

      - uses: actions/upload-artifact@v4
        with:
          name: wheels-${{ matrix.os }}
          path: wheelhouse

However, the “cp313-cp313t” and “cp314-cp314t” wheel are missing. How to build them in this yml?

In your “build wheels” step, you need to have:

        env:
          CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp313t-* cp314-* cp314t-*"
          CIBW_ENABLE: "cpython_freethreading"

I deleted - CIBW_PRERELEASE_PYTHONS since it isn’t necessary with your configuration I think.

Note that if you only want 3.14t wheels you don’t need to set cpython_freethreading in CIBW_ENABLE: cibuildwheel doesn’t need any special configuration to build 3.14t wheels.

See the cibuildwheel docs for CIBW_BUILD and CIBW_ENABLE.

The configuration you originally wrote doesn’t build 3.13t or 3.14t wheels because you’re telling cibuildwheel to build wheels based on ABI tags. The free-threaded build has a different ABI compared with the GIL-enabled build so it has its own ABI tags.

4 Likes