From d38c55e4917a25d6e7795d1fedcd61ae31799119 Mon Sep 17 00:00:00 2001 From: Patrick Sanders Date: Fri, 12 May 2023 08:24:27 -0700 Subject: [PATCH] Build wheels for Apple Silicon macs, drop support for Python 3.6 (#37) This PR upgrades `cibuildwheel` to the latest version to support building macOS arm64 wheels. The first version of `cibuildwheel` to support Apple Silicon is [2.10.0](https://github.com/pypa/cibuildwheel/releases/tag/v2.10.0), while support for running with Python 3.6 was dropped in [v2.9.0](https://github.com/pypa/cibuildwheel/releases/tag/v2.9.0). Python 3.6 has been [EOL since the end of 2021](https://peps.python.org/pep-0494/), so I opted to remove support for 3.6. Hope that's okay. Fixes #34 Bump versions for cibuildwheel, setuptools-golang, and twine. --- .github/workflows/build.yml | 13 +++++++------ .github/workflows/test.yml | 2 +- Dockerfile | 7 ------- development.txt | 6 +++--- setup.py | 4 ++-- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e7105f..3a42c2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,16 +23,16 @@ jobs: with: python-version: '3.7' - - name: Install dependencies + - name: Install Python dependencies run: | python -m pip install --upgrade -r development.txt - - name: Install Visual C++ for Python 2.7 + - name: Install Windows dependencies if: runner.os == 'Windows' run: | - choco install vcpython27 -f -y choco install golang -f -y choco install mingw -f -y + pip install --force cibuildwheel==2.3.1 go get -d - name: Set up QEMU @@ -42,7 +42,7 @@ jobs: - name: Build Linux wheels and sdist if: runner.os == 'Linux' env: - CIBW_SKIP: "cp35-* *-win32 *-musllinux_i686 *-musllinux_aarch64 *-musllinux_ppc64le *-musllinux_s390x *-manylinux_i686 *-manylinux_aarch64 *-manylinux_ppc64le *-manylinux_s390x" + CIBW_SKIP: "cp35-* cp36-* *-win32 *-musllinux_i686 *-musllinux_aarch64 *-musllinux_ppc64le *-musllinux_s390x *-manylinux_i686 *-manylinux_aarch64 *-manylinux_ppc64le *-manylinux_s390x" CIBW_BUILD_VERBOSITY: 1 run: | python setup.py sdist @@ -67,15 +67,16 @@ jobs: - name: Build macOS wheels if: runner.os == 'macOS' env: - CIBW_SKIP: "cp35-* *-win32 *-manylinux_i686 *-manylinux_aarch64 *-manylinux_ppc64le *-manylinux_s390x" + CIBW_SKIP: "cp35-* cp36-* *-win32 *-manylinux_i686 *-manylinux_aarch64 *-manylinux_ppc64le *-manylinux_s390x" CIBW_BUILD_VERBOSITY: 1 + CIBW_ARCHS_MACOS: x86_64 arm64 run: | python3 -m cibuildwheel --output-dir wheelhouse - name: Build Windows wheels if: runner.os == 'Windows' env: - CIBW_SKIP: "cp35-* *-win32 *-manylinux_i686 *-manylinux_aarch64 *-manylinux_ppc64le *-manylinux_s390x" + CIBW_SKIP: "cp35-* cp36-* *-win32 *-manylinux_i686 *-manylinux_aarch64 *-manylinux_ppc64le *-manylinux_s390x" CIBW_BUILD_VERBOSITY: 1 run: | python -m cibuildwheel --output-dir wheelhouse diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9b9b6ba..55d284c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] name: Python ${{ matrix.python-version }} steps: diff --git a/Dockerfile b/Dockerfile index 7ea2ab3..faae35b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,3 @@ -FROM python:3.6-slim-buster as py36 -RUN apt-get update && apt-get install -y golang make build-essential libffi-dev git -WORKDIR /root -COPY . /root -RUN python setup.py bdist_wheel - - FROM python:3.7-slim-buster as py37 RUN apt-get update && apt-get install -y golang make build-essential libffi-dev git WORKDIR /root diff --git a/development.txt b/development.txt index d983667..4b9bff2 100644 --- a/development.txt +++ b/development.txt @@ -1,9 +1,9 @@ -setuptools-golang==2.3.0 +setuptools-golang==2.7.0 wheel==0.37.1 cffi==1.14.5 black==20.8b1 isort==5.6.4 -twine==3.1.1 +twine==4.0.2 pytest==6.2.5 psutil==5.7.3 -cibuildwheel==2.3.1 +cibuildwheel==2.12.3 diff --git a/setup.py b/setup.py index 9d96288..1b04f72 100644 --- a/setup.py +++ b/setup.py @@ -61,10 +61,10 @@ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ], - python_requires=">=3.6", + python_requires=">=3.7", # I'm not sure what this value is supposed to be build_golang={"root": "github.com/ColdHeat/pybluemonday"}, ext_modules=[setuptools.Extension("pybluemonday/bluemonday", ["bluemonday.go"])], - setup_requires=["setuptools-golang==2.3.0", "cffi~=1.1"], + setup_requires=["setuptools-golang==2.7.0", "cffi~=1.1"], install_requires=["cffi~=1.1"], )