Skip to content

Commit

Permalink
feat: add support to python 3.12
Browse files Browse the repository at this point in the history
Signed-off-by: Timon Wong <timon86.wang@gmail.com>
  • Loading branch information
timonwong committed Sep 25, 2024
1 parent 624ad66 commit ab6b2cd
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 134 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ jobs:
default: ""

machine:
image: ubuntu-2004:2022.04.1
image: ubuntu-2204:2023.07.1
resource_class: arm.medium

environment:
CIBW_SKIP: "<< parameters.skip >>"
CIBW_BUILD: "<< parameters.build >>"
CIBW_PRERELEASE_PYTHONS: "1"

steps:
- checkout
Expand Down
75 changes: 48 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,72 +7,93 @@ on:
pull_request: {}
workflow_dispatch: {}

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

env:
env:
FORCE_COLOR: "1"
# only affects Windows, but easiest to set here for now
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"

jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 20

strategy:
fail-fast: false
fail-fast: true
matrix:
include:
- os: macos-11
- os: macos-13
python: "3.7"

- os: macos-11
python: "3.10"
- os: macos-14
python: "3.12"

- os: macos-11
python: pypy-3.8
- os: macos-14
python: "3.13"

- os: ubuntu-18.04
python: "3.7"
- os: macos-13
python: pypy-3.9

- os: ubuntu-20.04
python: pypy-3.8
python: "3.7"

- os: ubuntu-20.04
- os: ubuntu-22.04
python: pypy-3.9

- os: ubuntu-22.04
python: pypy-3.7

# - os: ubuntu-20.04
# python: "3.7"
- os: ubuntu-22.04
python: "3.9"

# - os: ubuntu-20.04
# python: "3.8"
- os: ubuntu-22.04
python: "3.10"

# - os: ubuntu-20.04
# python: "3.9"
- os: ubuntu-22.04
python: "3.11"

# - os: ubuntu-20.04
# python: "3.10"
- os: ubuntu-22.04
python: "3.8"

- os: ubuntu-20.04
python: "3.11"
- os: ubuntu-22.04
python: "3.12"

- os: windows-2019
- os: ubuntu-22.04
python: "3.13"

- os: ubuntu-22.04
python: "3.13"

- os: windows-2022
python: "3.7"
arch: x86

- os: windows-2019
- os: windows-2022
python: "3.9"
arch: x64

- os: windows-2019
python: "3.10"
- os: windows-2022
python: "3.13"
arch: x64

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.arch || 'x64' }}
allow-prereleases: true
cache: pip

- name: install dependencies
run: |
pip install --upgrade pip wheel
pip install --upgrade pip wheel setuptools
pip install -r test-requirements.txt
- name: show environment
Expand Down
92 changes: 57 additions & 35 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,32 +46,38 @@ on:
- .github/workflows/wheels.yml
workflow_dispatch: {}

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

env:
PYTHONUNBUFFERED: "1"
TWINE_NONINTERACTIVE: "1"

jobs:
sdist:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.11"
cache: pip

- name: install dependencies
run: |
pip install --upgrade pip build
pip install --upgrade pip build pytest setuptools
pip install -r tools/wheel-requirements.txt
- name: build sdist
run: |
python setup.py build --with-cython
python -m build --sdist .
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: sdist
path: "dist/*.tar.gz"
Expand All @@ -87,66 +93,66 @@ jobs:
twine upload --skip-existing dist/*.tar.gz
wheel:
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}

env:
MACOSX_DEPLOYMENT_TARGET: "10.9"
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: "pytest -v {package}/tests"
CIBW_BUILD: "${{ matrix.cibw.build || '*' }}"
# Skip building on CPython 3.6 on all platforms
CIBW_SKIP: "cp36-* *-manylinux_i686 *-musllinux_i686 ${{ matrix.cibw.skip || '' }}"
CIBW_ARCHS_LINUX: "${{ matrix.cibw.arch || 'auto' }}"
CIBW_ARCHS_MACOS: "${{ matrix.cibw.arch || 'auto' }}"
CIBW_SKIP: "${{ matrix.cibw.skip || '' }}"
CIBW_ARCHS: "${{ matrix.cibw.arch || 'auto' }}"
CIBW_MANYLINUX_X86_64_IMAGE: "${{ matrix.cibw.manylinux_x86_64_image || '' }}"

strategy:
fail-fast: false
matrix:
include:
- os: macos-11
- os: macos-12
name: mac-cpython
cibw:
build: "cp*"

- os: macos-11
- os: macos-12
name: mac-pypy
cibw:
build: "pp*"

- os: macos-11
- os: macos-14
name: mac-arm
cibw:
arch: universal2
build: "cp*"

- os: ubuntu-20.04
name: manylinux-x86_64
- name: manylinux-x86_64
cibw:
arch: x86_64
build: "*manylinux*"

# - os: ubuntu-20.04
# name: manylinux-aarch64
# cibw:
# arch: aarch64
# build: "*manylinux*"
- name: manylinux-i686
cibw:
arch: i686
build: "*manylinux*"

- os: ubuntu-20.04
name: musllinux
# additional manylinux variants, not specified in pyproject.toml:
# build with newer 2_28 for cpython >= 3.10, pypy 3.9
- name: manylinux-x86_64-2_28
cibw:
build: "*musllinux*"
arch: x86_64
build: "cp31*-manylinux* pp39-manylinux*"
manylinux_x86_64_image: manylinux_2_28

# - os: ubuntu-20.04
# name: musllinux-arrch64
# cibw:
# arch: aarch64
# build: "*musllinux*"
- name: musllinux
cibw:
build: "*musllinux*"

- os: windows-2019
name: win32
- name: win32
os: windows-2019
architecture: x86
cibw:
build: "cp*win32"
# free-threaded doesn't seem to work on Windows
skip: "*t-win*"

- os: windows-2019
name: win-pypy
Expand All @@ -159,9 +165,20 @@ jobs:
architecture: x64
cibw:
build: "cp*win_amd64"
# free-threaded doesn't seem to work on Windows
skip: "*t-win*"

- os: windows-2022
name: win_arm64
architecture: x64
cibw:
arch: ARM64
# free-threaded doesn't seem to work on Windows
skip: "cp37* *t-win*"


steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# - name: Set up qemu
# id: qemu
Expand All @@ -171,11 +188,16 @@ jobs:
# platforms: arm64

- name: setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.11"
architecture: ${{ matrix.architecture }}

- name: locate windows-arm vcredist
if: matrix.name == 'win_arm64'
run: |
python tools/find_vcredist.py
- name: customize mac-arm-64
if: contains(matrix.os, 'macos') && matrix.cibw.arch
run: |
Expand Down Expand Up @@ -207,7 +229,7 @@ jobs:
run: |
python -m cibuildwheel .
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.name }}
path: "wheelhouse/*"
Expand Down
37 changes: 13 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,42 +37,31 @@ build-backend = "setuptools.build_meta"
build-verbosity = "1"

[tool.cibuildwheel.linux]
environment.CFLAGS = "-Wl,-strip-all"
environment.CXXFLAGS = "-Wl,-strip-all"

manylinux-x86_64-image = "manylinux2014"
manylinux-i686-image = "manylinux2014"
manylinux-aarch64-image = "manylinux2014"
musllinux-aarch64-image = "musllinux_1_1"
musllinux-i686-image = "musllinux_1_1"
musllinux-x86_64-image = "musllinux_1_1"

[tool.cibuildwheel.linux.environment]
CFLAGS = "-Wl,-strip-all"
CXXFLAGS = "-Wl,-strip-all"

[tool.cibuildwheel.macos]
environment.MACOSX_DEPLOYMENT_TARGET = "10.9"
[tool.cibuildwheel.macos.environment]
# note: everything here needs to also be duplicated in overrides below
MACOSX_DEPLOYMENT_TARGET = "10.9"

# mac-arm target is 10.15
[[tool.cibuildwheel.overrides]]
select = "*macos*{universal2,arm64}*"
environment.MACOSX_DEPLOYMENT_TARGET = "10.15"

# manylinux1 for old Python
[[tool.cibuildwheel.overrides]]
select = "cp3{67}-*"
manylinux-x86_64-image = "manylinux1"
manylinux-i686-image = "manylinux1"
environment = { MACOSX_DEPLOYMENT_TARGET = "10.15" }

# manylinux2010 for cp38-9, pp37-8
# manylinux2010 for (less) old cp37-9, pp37-8
[[tool.cibuildwheel.overrides]]
select = "cp3{8,9}-* pp3{7,8}-*"
select = "cp3{7,8,9}-* pp3{7,8}-*"
manylinux-x86_64-image = "manylinux2010"
manylinux-i686-image = "manylinux2010"

# manylinux2014 for cp310, pp39
[[tool.cibuildwheel.overrides]]
select = "cp310-* pp39-*"
manylinux-x86_64-image = "manylinux2014"
manylinux-i686-image = "manylinux2014"

# manylinux_2_28 for cp311
[[tool.cibuildwheel.overrides]]
select = "cp311-*"
manylinux-x86_64-image = "manylinux_2_28"
# note: manylinux_2_28 builds are added
# in .github/workflows/wheels.yml
Loading

0 comments on commit ab6b2cd

Please sign in to comment.