diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 4669320b3..b8328e063 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -29,7 +29,7 @@ jobs: - uses: actions/setup-python@v5 name: Install Python with: - python-version: '3.8' + python-version: '3.10' - name: Install deps run: pip install -U setuptools-rust - name: Build sdist @@ -37,6 +37,7 @@ jobs: - uses: actions/upload-artifact@v4 with: path: ./dist/* + name: sdist-rustworkx - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 build_wheels: @@ -52,18 +53,18 @@ jobs: - uses: actions/setup-python@v5 name: Install Python with: - python-version: '3.8' + python-version: '3.10' - uses: dtolnay/rust-toolchain@stable - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==2.16.5 + python -m pip install cibuildwheel==2.17.0 - name: Build wheels run: | python -m cibuildwheel --output-dir wheelhouse - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl - name: shared-wheel-builds + name: shared-wheel-builds-${{ matrix.os }} upload_shared_wheels: name: Upload shared build wheels runs-on: ubuntu-latest @@ -72,9 +73,10 @@ jobs: id-token: write needs: ["build_wheels", "build-win32-wheels"] steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: - name: shared-wheel-builds + pattern: shared-wheel-builds-* + merge-multiple: true path: deploy - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 @@ -95,44 +97,7 @@ jobs: - uses: actions/setup-python@v5 name: Install Python with: - python-version: '3.8' - - uses: dtolnay/rust-toolchain@stable - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: all - - name: Install cibuildwheel - run: | - python -m pip install cibuildwheel==2.16.5 - - name: Build wheels - run: | - python -m cibuildwheel --output-dir wheelhouse - env: - CIBW_ARCHS_LINUX: aarch64 - CIBW_SKIP: cp36-* cp37-* cp311-* cp312-* pp* *musl* - - uses: actions/upload-artifact@v4 - with: - path: ./wheelhouse/*.whl - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: wheelhouse/ - build_wheels_aarch64_part_2: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - environment: release - permissions: - id-token: write - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - name: Install Python - with: - python-version: '3.8' + python-version: '3.10' - uses: dtolnay/rust-toolchain@stable - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -140,16 +105,17 @@ jobs: platforms: all - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==2.16.5 + python -m pip install cibuildwheel==2.17.0 - name: Build wheels run: | python -m cibuildwheel --output-dir wheelhouse env: CIBW_ARCHS_LINUX: aarch64 - CIBW_SKIP: cp36-* cp37-* cp38-* cp39-* cp310-* pp* *musl* + CIBW_SKIP: cp36-* cp37-* pp* *musl* - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl + name: wheel-builds-aarch64 - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: @@ -169,45 +135,7 @@ jobs: - uses: actions/setup-python@v5 name: Install Python with: - python-version: '3.8' - - uses: dtolnay/rust-toolchain@stable - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: all - - name: Install cibuildwheel - run: | - python -m pip install cibuildwheel==2.16.5 - - name: Build wheels - run: | - python -m cibuildwheel --output-dir wheelhouse - env: - CIBW_ARCHS_LINUX: aarch64 - CIBW_SKIP: cp36-* cp37-* cp311-* cp312-* *many* - CIBW_TEST_SKIP: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* *many* - - uses: actions/upload-artifact@v4 - with: - path: ./wheelhouse/*.whl - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: wheelhouse/ - build_wheels_musl_aarch64_part_2: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - environment: release - permissions: - id-token: write - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - name: Install Python - with: - python-version: '3.8' + python-version: '3.10' - uses: dtolnay/rust-toolchain@stable - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -215,17 +143,18 @@ jobs: platforms: all - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==2.16.5 + python -m pip install cibuildwheel==2.17.0 - name: Build wheels run: | python -m cibuildwheel --output-dir wheelhouse env: CIBW_ARCHS_LINUX: aarch64 - CIBW_SKIP: cp36-* cp37-* cp38-* cp39-* cp310-* *many* + CIBW_SKIP: cp36-* cp37-* *many* CIBW_TEST_SKIP: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* *many* - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl + name: wheel-builds-musl-aarch64 - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: @@ -245,44 +174,7 @@ jobs: - uses: actions/setup-python@v5 name: Install Python with: - python-version: '3.8' - - uses: dtolnay/rust-toolchain@stable - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: all - - name: Install cibuildwheel - run: | - python -m pip install cibuildwheel==2.16.5 - - name: Build wheels - run: | - python -m cibuildwheel --output-dir wheelhouse - env: - CIBW_SKIP: cp36-* cp37-* cp39-* cp310-* cp311-* pp* *win32 *musl* - CIBW_ARCHS_LINUX: ppc64le - - uses: actions/upload-artifact@v4 - with: - path: ./wheelhouse/*.whl - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: wheelhouse/ - build_wheels_ppc64le_part2: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - environment: release - permissions: - id-token: write - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - name: Install Python - with: - python-version: '3.8' + python-version: '3.10' - uses: dtolnay/rust-toolchain@stable - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -290,16 +182,17 @@ jobs: platforms: all - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==2.16.5 + python -m pip install cibuildwheel==2.17.0 - name: Build wheels run: | python -m cibuildwheel --output-dir wheelhouse env: - CIBW_SKIP: cp36-* cp37-* cp38-* cp312-* pp* *win32 *musl* + CIBW_SKIP: cp36-* cp37-* pp* *win32 *musl* CIBW_ARCHS_LINUX: ppc64le - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl + name: wheel-builds-ppc64le - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: @@ -319,44 +212,7 @@ jobs: - uses: actions/setup-python@v5 name: Install Python with: - python-version: '3.8' - - uses: dtolnay/rust-toolchain@stable - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: all - - name: Install cibuildwheel - run: | - python -m pip install cibuildwheel==2.16.5 - - name: Build wheels - run: | - python -m cibuildwheel --output-dir wheelhouse - env: - CIBW_SKIP: cp36-* cp37-* cp39-* cp310-* cp311-* pp* *win32 *musl* - CIBW_ARCHS_LINUX: s390x - - uses: actions/upload-artifact@v4 - with: - path: ./wheelhouse/*.whl - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: wheelhouse/ - build_wheels_s390x_part2: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - environment: release - permissions: - id-token: write - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - name: Install Python - with: - python-version: '3.8' + python-version: '3.10' - uses: dtolnay/rust-toolchain@stable - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -364,16 +220,17 @@ jobs: platforms: all - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==2.16.5 + python -m pip install cibuildwheel==2.17.0 - name: Build wheels run: | python -m cibuildwheel --output-dir wheelhouse env: - CIBW_SKIP: cp36-* cp37-* cp38-* cp312-* pp* *win32 *musl* + CIBW_SKIP: cp36-* cp37-* pp* *win32 *musl* CIBW_ARCHS_LINUX: s390x - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl + name: wheel-builds-s390x - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: @@ -387,7 +244,7 @@ jobs: - uses: actions/setup-python@v5 name: Install Python with: - python-version: '3.8' + python-version: '3.10' architecture: 'x86' - uses: dtolnay/rust-toolchain@stable with: @@ -396,7 +253,7 @@ jobs: run: rustup default stable-i686-pc-windows-msvc - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==2.16.5 + python -m pip install cibuildwheel==2.17.0 - name: Build wheels run: | python -m cibuildwheel --output-dir wheelhouse @@ -405,7 +262,7 @@ jobs: - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl - name: shared-wheel-builds + name: shared-wheel-builds-win32 retworkx-compat-build: name: Build retworkx runs-on: ubuntu-latest @@ -428,5 +285,6 @@ jobs: - uses: actions/upload-artifact@v4 with: path: ./dist/* + name: sdist-retworkx - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/Cargo.toml b/Cargo.toml index 44cb3dedc..91e5817bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,7 +61,7 @@ rustworkx-core = { path = "rustworkx-core", version = "=0.15.0" } [dependencies.pyo3] version = "0.21.1" -features = ["extension-module", "hashbrown", "num-bigint", "num-complex", "indexmap"] +features = ["abi3-py38", "extension-module", "hashbrown", "num-bigint", "num-complex", "indexmap"] [dependencies.ndarray] version = "^0.15.6" diff --git a/pyproject.toml b/pyproject.toml index 92de906ba..a7da3f16c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,6 +35,7 @@ test-skip = "cp38-*musllinux* *linux_s390x *ppc64le" [tool.cibuildwheel.linux] before-all = "yum install -y wget && {package}/tools/install_rust.sh" environment = 'PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI="true"' +repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel} && pipx run abi3audit==0.0.9 --strict --report {wheel}" [[tool.cibuildwheel.overrides]] select = "*-musllinux*" @@ -46,3 +47,7 @@ before-test = 'python -m pip install numpy --config-settings=setup-args="-Dallow [tool.cibuildwheel.macos] environment = "MACOSX_DEPLOYMENT_TARGET=10.12" +repair-wheel-command = "brew install pipx && pipx ensurepath && pipx run --spec delocate==0.11.0 delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} && pipx run abi3audit==0.0.9 --strict --report {wheel}" + +[tool.cibuildwheel.windows] +repair-wheel-command = "cp {wheel} {dest_dir}/. && pipx run abi3audit==0.0.9 --strict --report {wheel}" \ No newline at end of file diff --git a/releasenotes/notes/stable-abi-python-4c883bc4edaf8354.yaml b/releasenotes/notes/stable-abi-python-4c883bc4edaf8354.yaml new file mode 100644 index 000000000..5b06382d0 --- /dev/null +++ b/releasenotes/notes/stable-abi-python-4c883bc4edaf8354.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + rustworkx wheels are now built against Python's stable + Application Binary Interface (ABI). For rustworkx users, this means + that wheels distributed by us via PyPI will continue to work with + newer versions of Python without having to recompile the code. + This change will also simplify the release process for the developers + and reduce the storage size required to mirror rustworkx wheels. diff --git a/setup.py b/setup.py index ddb33c4a6..82a390d7e 100644 --- a/setup.py +++ b/setup.py @@ -31,6 +31,7 @@ def readme(): PKG_INSTALL_REQUIRES = ["numpy>=1.16.0,<2"] RUST_EXTENSIONS = [RustExtension("rustworkx.rustworkx", "Cargo.toml", binding=Binding.PyO3, debug=rustworkx_debug)] +RUST_OPTS ={"bdist_wheel": {"py_limited_api": "cp38"}} retworkx_readme_compat = """# retworkx @@ -91,5 +92,6 @@ def readme(): "mpl": mpl_extras, "graphviz": graphviz_extras, "all": mpl_extras + graphviz_extras, - } + }, + options=RUST_OPTS, )