From 90f5bf65b39b1fc6f097e94553b7c3a46189d887 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 29 Jun 2025 02:53:03 -0400 Subject: [PATCH] Experiment with cibuildwheel --- .github/workflows/build-wheels.yml | 63 ---------------------------- .github/workflows/build.yml | 36 ++++++++++++++++ appveyor.yml | 84 -------------------------------------- pyproject.toml | 3 ++ scripts/win_wrapper.cmd | 55 ------------------------- 5 files changed, 39 insertions(+), 202 deletions(-) delete mode 100644 .github/workflows/build-wheels.yml create mode 100644 .github/workflows/build.yml delete mode 100644 appveyor.yml delete mode 100644 scripts/win_wrapper.cmd diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml deleted file mode 100644 index 7b6b3a1..0000000 --- a/.github/workflows/build-wheels.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Build wheels -on: push - -jobs: - build-linux: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Build manylinux2014 x86-64 wheels - uses: earwig/python-wheels-manylinux-build@latest-manylinux2014_x86_64 - with: - python-versions: 'cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313' - - name: Build manylinux 2014 aarch64 wheels - uses: earwig/python-wheels-manylinux-build@latest-manylinux2014_aarch64 - with: - python-versions: 'cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313' - - uses: actions/upload-artifact@v4 - with: - name: wheels-linux - path: dist/*.whl - - name: Publish package to PyPI - # Only actually publish if a new tag was pushed - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@37e305e7413032d8422456179fee28fac7d25187 - with: - user: __token__ - password: ${{ secrets.pypi_password }} - - build-macos: - runs-on: macos-latest - strategy: - matrix: - python-version: - - '3.9' - - '3.10' - - '3.11' - - '3.12' - - '3.13' - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Build wheels - run: | - python -m pip install --upgrade pip wheel setuptools - pip wheel . -w dist/ - ls dist/ - - uses: actions/upload-artifact@v4 - with: - name: wheels-macos-${{ matrix.python-version }} - path: dist/*.whl - - name: Publish package to PyPI - # Only actually publish if a new tag was pushed - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - # We can't use the pypa action because of https://github.com/pypa/gh-action-pypi-publish/issues/15 - run: | - pip install twine - TWINE_USERNAME="__token__" \ - TWINE_PASSWORD="${{ secrets.pypi_password }}" \ - twine upload dist/* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..9c50cb7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build +on: [push, pull_request] + +jobs: + build-wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + - windows-latest + - macos-13 # intel + - macos-latest # arm64 + + steps: + - uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v3.0.0 + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl + + # - name: Publish package to PyPI + # # Only actually publish if a new tag was pushed + # if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') + # # We can't use the pypa action because of https://github.com/pypa/gh-action-pypi-publish/issues/15 + # run: | + # pip install twine + # TWINE_USERNAME="__token__" \ + # TWINE_PASSWORD="${{ secrets.pypi_password }}" \ + # twine upload dist/* diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 81fe53c..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,84 +0,0 @@ -# This config file is used by appveyor.com to build Windows release binaries - -version: 0.7.1.dev0-b{build} - -branches: - only: - - main - - /v\d+(\.\d+)*/ - -image: Visual Studio 2022 - -environment: - global: - # See: http://stackoverflow.com/a/13751649/163740 - WRAPPER: "cmd /E:ON /V:ON /C .\\scripts\\win_wrapper.cmd" - PYEXE: "%WRAPPER% %PYTHON%\\python.exe" - SETUPPY: "%PYEXE% setup.py --with-extension" - PIP: "%PYEXE% -m pip" - TWINE: "%PYEXE% -m twine" - PYPI_TOKEN: - secure: w9ql7j0y9fatBSCgsUn1MDFsDvc0WXY88K8hNBHZzq6uBPxWMd7ZblMZSJv4Nywr6ViudQCn4qM/Emm7R8UgKGnHeSX+B8V41ywKgbszEh9wKtuMWI5htsfjaD3Yib/dz/ynGDKEf3nkE6rP2j9bfVLMUARHmvztL+G2rUrjj2GQTqs0ddJ16OudDo2aA/ClsW1Zexc5GPgkun5+JFneUeVV59/bwORGfSjgEtoMyIQ8mdFs/My4sImC+jXFfSHD6s08anIuNX5KO6SSg5mwcxZq+1PweceHivJ87VvCI7w= - - matrix: - - PYTHON: "C:\\Python39" - PYTHON_VERSION: "3.9" - PYTHON_ARCH: "32" - - - PYTHON: "C:\\Python39-x64" - PYTHON_VERSION: "3.9" - PYTHON_ARCH: "64" - - - PYTHON: "C:\\Python310" - PYTHON_VERSION: "3.10" - PYTHON_ARCH: "32" - - - PYTHON: "C:\\Python310-x64" - PYTHON_VERSION: "3.10" - PYTHON_ARCH: "64" - - - PYTHON: "C:\\Python311" - PYTHON_VERSION: "3.11" - PYTHON_ARCH: "32" - - - PYTHON: "C:\\Python311-x64" - PYTHON_VERSION: "3.11" - PYTHON_ARCH: "64" - - - PYTHON: "C:\\Python312" - PYTHON_VERSION: "3.12" - PYTHON_ARCH: "32" - - - PYTHON: "C:\\Python312-x64" - PYTHON_VERSION: "3.12" - PYTHON_ARCH: "64" - - - PYTHON: "C:\\Python313" - PYTHON_VERSION: "3.13" - PYTHON_ARCH: "32" - - - PYTHON: "C:\\Python313-x64" - PYTHON_VERSION: "3.13" - PYTHON_ARCH: "64" - -install: - - "%PIP% install --disable-pip-version-check --user --upgrade pip" - - "%PIP% install setuptools wheel twine pytest" - -build_script: - - "%SETUPPY% build" - - "%SETUPPY% develop --user" - -test_script: - - "%PYEXE% -m pytest" - -after_test: - - "%SETUPPY% bdist_wheel" - -on_success: - - "IF %APPVEYOR_REPO_TAG%==true %TWINE% upload dist\\* -u __token__ -p %PYPI_TOKEN%" - -artifacts: - - path: dist\* - -deploy: off diff --git a/pyproject.toml b/pyproject.toml index 24d1889..bc2cf77 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,6 +72,9 @@ optional = true [tool.setuptools_scm] +[tool.cibuildwheel] +build = ["cp3{9,10,11,12,13}-*"] + [tool.pyright] pythonVersion = "3.9" typeCheckingMode = "standard" diff --git a/scripts/win_wrapper.cmd b/scripts/win_wrapper.cmd deleted file mode 100644 index 3a590df..0000000 --- a/scripts/win_wrapper.cmd +++ /dev/null @@ -1,55 +0,0 @@ -:: To build extensions for 64 bit Python 3, we need to configure environment -:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) -:: -:: To build extensions for 64 bit Python 2, we need to configure environment -:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) -:: -:: 32 bit builds do not require specific environment configurations. -:: -:: Note: this script needs to be run with the /E:ON and /V:ON flags for the -:: cmd interpreter, at least for (SDK v7.0) -:: -:: More details at: -:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows -:: http://stackoverflow.com/a/13751649/163740 -:: -:: Author: Olivier Grisel -:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ -@ECHO OFF - -SET COMMAND_TO_RUN=%* -SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows -SET WIN_WDK=c:\Program Files (x86)\Windows Kits\10\Include\wdf - -SET MAJOR_PYTHON_VERSION=%PYTHON_VERSION:~0,1% -SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2% - -IF %MAJOR_PYTHON_VERSION% == 2 ( - SET WINDOWS_SDK_VERSION="v7.0" -) ELSE IF %MAJOR_PYTHON_VERSION% == 3 ( - SET WINDOWS_SDK_VERSION="v7.1" - IF %MINOR_PYTHON_VERSION% GEQ 5 ( - SET NO_SET_SDK_64=Y - ) -) ELSE ( - ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" - EXIT 1 -) - -IF "%PYTHON_ARCH%"=="32" ( - call %COMMAND_TO_RUN% || EXIT 1 -) ELSE IF "%NO_SET_SDK_64%"=="Y" ( - IF EXIST "%WIN_WDK%" ( - :: See: https://connect.microsoft.com/VisualStudio/feedback/details/1610302/ - REN "%WIN_WDK%" 0wdf - ) - call %COMMAND_TO_RUN% || EXIT 1 -) ELSE ( - SET DISTUTILS_USE_SDK=1 - SET MSSdk=1 - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release - call %COMMAND_TO_RUN% || EXIT 1 -)