Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ jobs:
with:
python-version: '3.10'
- run: |
python -m pip install pylint
python -m pip install -e .
python -m pip install -e .[pylint]
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
with:
extra_args: pylint --all-files
Expand Down Expand Up @@ -44,7 +43,7 @@ jobs:
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
py: [cp310, cp311, cp312, cp313]
py: [cp310, cp311, cp312]
platform:
- { arch: x86_64, os: windows-latest, wheel_tag: win_amd64 }
- { arch: x86_64, os: macos-13, wheel_tag: macosx_x86_64 }
Expand Down Expand Up @@ -74,6 +73,35 @@ jobs:
name: ${{ matrix.py }}-${{ matrix.platform.wheel_tag }}
path: ./wheelhouse/*.whl

test_abi3_wheels:
needs: build_wheels
name: Test with Python ${{ matrix.py }} on ${{ matrix.platform.os }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
py: [ "3.13" ]
platform:
- { arch: x86_64, os: windows-latest, wheel_tag: win_amd64 }
- { arch: x86_64, os: macos-13, wheel_tag: macosx_x86_64 }
- { arch: arm64, os: macos-latest, wheel_tag: macosx_arm64 }
- { arch: x86_64, os: ubuntu-latest, wheel_tag: manylinux_x86_64 }
- { arch: aarch64, os: ubuntu-24.04-arm, wheel_tag: manylinux_aarch64 }
steps:
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
path: artifacts
merge-multiple: true
- name: Unpack source distribution
shell: bash
run: tar --strip-components 1 -xvf artifacts/*.tar.gz
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.py }}
- name: Install wheel and run tests
run: |
python -m pip install --no-index --find-links=artifacts pypcode
cd tests; python -m unittest discover -v .

build_docs:
name: Build docs
runs-on: ubuntu-latest
Expand All @@ -88,7 +116,7 @@ jobs:

upload_pypi:
name: Upload wheels to PyPI
needs: [lint, build_docs, build_sdist, build_wheels]
needs: [lint, build_docs, build_sdist, build_wheels, test_abi3_wheels]
environment:
name: pypi
url: https://pypi.org/p/pypcode
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ add_executable(sleigh
install(TARGETS sleigh DESTINATION bin)

nanobind_add_module(pypcode_native
STABLE_ABI
pypcode/pypcode_native.cpp
${SLEIGH_COMMON}
${ZLIB}
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ docs = [
"sphinx",
"sphinx-autodoc-typehints",
]
pylint = [ "pylint", "wheel" ]

[build-system]
requires = [ "setuptools", "nanobind", "cmake" ]
requires = [ "setuptools", "nanobind", "cmake", "wheel" ]
build-backend = "setuptools.build_meta"

[tool.setuptools]
Expand Down
18 changes: 17 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@
import sys
from setuptools import setup
from setuptools.command.build_ext import build_ext
from wheel.bdist_wheel import bdist_wheel


class bdist_wheel_abi3(bdist_wheel):
"""
Overrides bdist_wheel to provide stable ABI platform tag.
"""

def get_tag(self):
python, abi, plat = super().get_tag()

if python.startswith("cp") and sys.version_info >= (3, 12):
# on CPython, our wheels are abi3 and compatible back to 3.12
return "cp312", "abi3", plat

return python, abi, plat


class BuildExtension(build_ext):
Expand Down Expand Up @@ -99,5 +115,5 @@ def add_pkg_data_dirs(pkg, dirs):
package_data={
"pypcode": add_pkg_data_dirs("pypcode", ["bin", "docs", "processors"]) + ["py.typed", "pypcode_native.pyi"]
},
cmdclass={"build_ext": BuildExtension},
cmdclass={"build_ext": BuildExtension, "bdist_wheel": bdist_wheel_abi3},
)
Loading