Create prerelease manylinux wheels with cibuildwheel

cibuildwheel version 2.23.2
I am building manylinux wheels in a github action see here

I would like to build prerelease wheels and have tried using both CIBW_PRERELEASE_PYTHONS and CIBW_ENABLE environment vars without success.

Below is the config of one build which I thought would allow the 3.14.0b python to be used. However, I don’t get any 3.14 wheels. I looked in one of the docker images used and /opt/python/cp314-cp314/bin/python works and is Python 3.14.0b2 so why no 3.14.0b2 builds?

 "/home/runner/work/_temp/cibw/bin/cibuildwheel" "." --output-dir "wheelhouse"   2>&1
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    CIBW_TEST_SKIP: *
    CIBW_TEST_COMMAND: 
    CIBW_BUILD_VERBOSITY: 3
    CIBW_ENABLE: cpython-prerelease
    RL_CACHE_DIR: /tmp/pycairo
    pythonLocation: /opt/hostedtoolcache/Python/3.13.3/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.13.3/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.13.3/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.13.3/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.13.3/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.13.3/x64/lib
    SETUP_VERBOSE: 3
    CIBW_BUILD: cp314* cp313* cp312* cp311* cp310* cp39*
    CIBW_SKIP: pp* cp36* cp37* cp38*
    CIBW_ARCHS_LINUX: auto64 ppc64le s390x
    CIBW_BEFORE_ALL: ./.github/workflows/add-cairo

fwiw here is the yml

# YAML see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: linux-wheels

on:
  push:
    branches:
      - main

concurrency:
  group: ${{ github.repository }}
  cancel-in-progress: true

jobs:
  build-wheels-linux:
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    env:
      CIBW_TEST_SKIP: "*"
      CIBW_TEST_COMMAND: ""
      CIBW_BUILD_VERBOSITY: 3
      CIBW_ENABLE: "cpython-prerelease"
      RL_CACHE_DIR: "/tmp/${{github.event.repository.name}}"
    strategy:
      fail-fast: true
      matrix:
        os: [ubuntu-latest, ubuntu-24.04-arm]
        #os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-14]

    steps:
      - uses: actions/checkout@v4

      - name: Set up QEMU
        if: runner.os == 'Linux'
        uses: docker/setup-qemu-action@v3
        with:
          platforms: all

      - uses: actions/setup-python@v5
        with:
          python-version: '3.13'

      - name: Build wheels
        uses: pypa/cibuildwheel@v2.23.2
        env:
          SETUP_VERBOSE: 3
          CIBW_BUILD: cp314* cp313* cp312* cp311* cp310* cp39*
          CIBW_SKIP: pp* cp36* cp37* cp38* 
          CIBW_ARCHS_LINUX: ${{ matrix.os == 'ubuntu-latest' && 'auto64 ppc64le s390x' || 'armv7l aarch64' }}
          CIBW_BEFORE_ALL: "./.github/workflows/add-cairo"
          CIBW_ENABLE: "cpython-prerelease"

      - uses: actions/upload-artifact@v4
        with:
          name: "${{ github.event.repository.name }}-${{ matrix.os }}-${{ strategy.job-index }}"
          path: ./wheelhouse/*.whl

You need to use a cibuildwheel 3.0 prerelease:

OK thanks. I guess I’ll leave the prerelease testing for now. Certainly don’t want to get in a death spiral with cibuildwheel as the main problem.

It is easier not to set CIBW_BUILD so you don’t have to update it in future and then cibuildwheel will read requires-python and use all available Python versions. Then you can have dependabot bump the cibuildwheel version and you only need to bump requires-python. I recommend setting things up with trusted publishing so that you can push these wheels straight to PyPI but for that it is recommended for security to pin the commit hash of cibuildwheel and other actions because it is a privileged job.

I find it easier to test prerelease CPython separately from the cibuildwheel configuration e.g. you can just have a CI job that uses actions/setup-python to choose 3.14 (allow-prereleases: true) and run the tests there. Otherwise you would need to add cpython-prerelease now but then remove it before releasing.

I started without CIBW_BUILD, but I kept getting messages about < 3.6 and 2.x.

cibuildwheel 2.x no longer supports Python < 3.6. Please use the 1.x series or update CIBW_SKIP

Perhaps they come because I was also skipping cp33-* cp34-* etc etc. I thought those should not raise any errors since the images don’t provide them.

If you don’t set CIBW_BUILD but put requires-python = ">= 3.9" in pyproject.toml then cibuildwheel will read that.

Unfortunately this solution is not right as pyproject.toml already has requires-python = ">=3.9". Perhaps I need to force it even more with CIBW_PROJECT_REQUIRES_PYTHON.

EDIT: removing CIBW_BUILD and adding CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9" seems to fix the warnings (at least in cibuildwheel 2.23.2.)

EDIT: I tried adding skips for cp35-* ie below cp36 and that caused warning annotations to appear.