From 8e9d57c7160d700f16db5abd3adc3b55b9c1bcdf Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 6 Oct 2023 13:47:40 -0400 Subject: [PATCH] Add support for Python 3.12 and musllinux to main As part of the 0.13.2 release we added support for Python 3.12 and musllinux to rustworkx. However, these changes did not happen on main yet. This commit applies the necessary changes to the main branch for the 0.14.0 and future releases. Also to simplify the configuration of the cibuildwheel jobs this combines #753 into this PR so that the configuration is centralized in the pyproject.toml. --- .github/workflows/main.yml | 15 +--- .github/workflows/wheels.yml | 77 +++---------------- docs/source/install.rst | 8 ++ pyproject.toml | 22 +++++- .../platform-updates-e9b296144e633c95.yaml | 4 + setup.py | 1 + 6 files changed, 46 insertions(+), 81 deletions(-) create mode 100644 releasenotes/notes/platform-updates-e9b296144e633c95.yaml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f9d0b1c76..b03b7a8e7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,7 +57,7 @@ jobs: strategy: matrix: rust: [stable] - python-version: [3.8, 3.9, "3.10", "3.11"] + python-version: [3.8, 3.9, "3.10", "3.11", "3.12"] platform: [ { os: "macOS-latest", python-architecture: "x64", rust-target: "x86_64-apple-darwin" }, { os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" }, @@ -76,19 +76,6 @@ jobs: with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform.python-architecture }} - if: runner.os != 'Windows' - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: 3.7 - architecture: ${{ matrix.platform.python-architecture }} - if: ${{ runner.os == 'Windows' && matrix.python-version == '3.7.16' }} - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - architecture: ${{ matrix.platform.python-architecture }} - if: ${{ runner.os == 'Windows' && matrix.python-version != '3.7.16' }} - name: Install Rust toolchain uses: dtolnay/rust-toolchain@master diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 4312f16de..93920665a 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -55,20 +55,10 @@ jobs: - uses: dtolnay/rust-toolchain@stable - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==2.10.1 twine + python -m pip install cibuildwheel==2.16.2 twine - name: Build wheels run: | python -m cibuildwheel --output-dir wheelhouse - env: - CIBW_BEFORE_ALL_LINUX: "yum install -y wget && {package}/tools/install_rust.sh" - CIBW_ENVIRONMENT_LINUX: 'PATH="$PATH:$HOME/.cargo/bin"' - CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.9 - CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2014_x86_64:latest - CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux2014_i686:latest - CIBW_SKIP: cp36-* cp37-* pp* *win32 *musl* - CIBW_BEFORE_BUILD: pip install -U setuptools-rust - CIBW_TEST_REQUIRES: networkx testtools fixtures - CIBW_TEST_COMMAND: python -m unittest discover {project}/tests/rustworkx_tests - uses: actions/upload-artifact@v3 with: path: ./wheelhouse/*.whl @@ -97,20 +87,11 @@ jobs: platforms: all - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==2.10.1 twine + python -m pip install cibuildwheel==2.16.2 twine - name: Build wheels run: | python -m cibuildwheel --output-dir wheelhouse env: - CIBW_BEFORE_ALL_LINUX: "yum install -y wget && {package}/tools/install_rust.sh" - CIBW_ENVIRONMENT_LINUX: 'PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI="true"' - CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.9 - CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2014_x86_64:latest - CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux2014_i686:latest - CIBW_SKIP: cp36-* cp37-* pp* *win32 *musl* - CIBW_BEFORE_BUILD: pip install -U setuptools-rust - CIBW_TEST_REQUIRES: networkx scipy testtools fixtures - CIBW_TEST_COMMAND: python -m unittest discover {project}/tests/rustworkx_tests CIBW_ARCHS_LINUX: aarch64 - uses: actions/upload-artifact@v3 with: @@ -140,20 +121,12 @@ jobs: platforms: all - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==2.10.1 twine + python -m pip install cibuildwheel==2.16.2 twine - name: Build wheels run: | python -m cibuildwheel --output-dir wheelhouse env: - CIBW_BEFORE_ALL_LINUX: "yum install -y wget && {package}/tools/install_rust.sh" - CIBW_ENVIRONMENT_LINUX: 'PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI="true"' - CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.9 - CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2014_x86_64:latest - CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux2014_i686:latest - CIBW_SKIP: cp36-* cp37-* cp39-* cp310-* cp311-* pp* *win32 *musl* - CIBW_BEFORE_BUILD: pip install -U setuptools-rust - CIBW_TEST_REQUIRES: networkx testtools fixtures - CIBW_TEST_COMMAND: python -m unittest discover {project}/tests/rustworkx_tests + CIBW_SKIP: cp36-* cp37-* cp39-* cp310-* cp311-* pp* *win32 CIBW_ARCHS_LINUX: ppc64le - uses: actions/upload-artifact@v3 with: @@ -183,20 +156,12 @@ jobs: platforms: all - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==2.10.1 twine + python -m pip install cibuildwheel==2.16.2 twine - name: Build wheels run: | python -m cibuildwheel --output-dir wheelhouse env: - CIBW_BEFORE_ALL_LINUX: "yum install -y wget && {package}/tools/install_rust.sh" - CIBW_ENVIRONMENT_LINUX: 'PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI="true"' - CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.9 - CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2014_x86_64:latest - CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux2014_i686:latest - CIBW_SKIP: cp36-* cp37-* cp38-* pp* *win32 *musl* - CIBW_BEFORE_BUILD: pip install -U setuptools-rust - CIBW_TEST_REQUIRES: networkx testtools fixtures - CIBW_TEST_COMMAND: python -m unittest discover {project}/tests/rustworkx_tests + CIBW_SKIP: cp36-* cp37-* cp38-* cp312-* pp* *win32 *musl* CIBW_ARCHS_LINUX: ppc64le - uses: actions/upload-artifact@v3 with: @@ -226,20 +191,12 @@ jobs: platforms: all - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==2.10.1 twine + python -m pip install cibuildwheel==2.16.2 twine - name: Build wheels run: | python -m cibuildwheel --output-dir wheelhouse env: - CIBW_BEFORE_ALL_LINUX: "yum install -y wget && {package}/tools/install_rust.sh" - CIBW_ENVIRONMENT_LINUX: 'PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI="true"' - CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.9 - CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2014_x86_64:latest - CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux2014_i686:latest CIBW_SKIP: cp36-* cp37-* cp39-* cp310-* cp311-* pp* *win32 *musl* - CIBW_BEFORE_BUILD: pip install -U setuptools-rust - CIBW_TEST_REQUIRES: networkx testtools fixtures - CIBW_TEST_COMMAND: python -m unittest discover {project}/tests/rustworkx_tests CIBW_ARCHS_LINUX: s390x CIBW_TEST_SKIP: "*-*linux_s390x" - uses: actions/upload-artifact@v3 @@ -270,20 +227,12 @@ jobs: platforms: all - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==2.10.1 twine + python -m pip install cibuildwheel==2.16.2 twine - name: Build wheels run: | python -m cibuildwheel --output-dir wheelhouse env: - CIBW_BEFORE_ALL_LINUX: "yum install -y wget && {package}/tools/install_rust.sh" - CIBW_ENVIRONMENT_LINUX: 'PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI="true"' - CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.9 - CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2014_x86_64:latest - CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux2014_i686:latest - CIBW_SKIP: cp36-* cp37-* cp38-* pp* *win32 *musl* - CIBW_BEFORE_BUILD: pip install -U setuptools-rust - CIBW_TEST_REQUIRES: networkx testtools fixtures - CIBW_TEST_COMMAND: python -m unittest discover {project}/tests/rustworkx_tests + CIBW_SKIP: cp36-* cp37-* cp38-* cp312-* pp* *win32 *musl* CIBW_ARCHS_LINUX: s390x CIBW_TEST_SKIP: "*-*linux_s390x" - uses: actions/upload-artifact@v3 @@ -300,7 +249,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build wheels - uses: joerick/cibuildwheel@v2.10.1 + uses: joerick/cibuildwheel@v2.16.2 env: CIBW_BEFORE_ALL: rustup target add aarch64-apple-darwin CIBW_ARCHS_MACOS: arm64 universal2 @@ -338,16 +287,12 @@ jobs: run: rustup default stable-i686-pc-windows-msvc - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==2.10.1 twine + python -m pip install cibuildwheel==2.16.2 twine - name: Build wheels run: | python -m cibuildwheel --output-dir wheelhouse env: - CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.9 CIBW_SKIP: cp36-* cp37-* pp* *amd64 *musl* - CIBW_BEFORE_BUILD: pip install -U setuptools-rust - CIBW_TEST_REQUIRES: networkx testtools fixtures - CIBW_TEST_COMMAND: python -m unittest discover {project}/tests/rustworkx_tests - uses: actions/upload-artifact@v3 with: path: ./wheelhouse/*.whl diff --git a/docs/source/install.rst b/docs/source/install.rst index 0b44823f7..e7b36926e 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -89,6 +89,14 @@ source. - s390x - :ref:`tier-4` - Distributions compatible with the `manylinux 2014`_ packaging specification + * - Linux (musl) + - x86_64 + - :ref:`tier-3` + - + * - Linux (musl) + - aarch64 + - :ref:`tier-3` + - * - macOS (10.9 or newer) - x86_64 - :ref:`tier-1` diff --git a/pyproject.toml b/pyproject.toml index c348b0338..7c5d3241a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,4 +4,24 @@ build-backend = "setuptools.build_meta" [tool.black] line-length = 100 -target-version = ['py37', 'py38', 'py39', 'py310'] +target-version = ['py38', 'py39', 'py310', 'py311'] + +[tool.cibuildwheel] +manylinux-x86_64-image = "manylinux2014" +manylinux-i686-image = "manylinux2014" +skip = "pp* cp36-* cp37-* *win32" +test-requires = "networkx testtools fixtures" +test-command = "python -m unittest discover {project}/tests/rustworkx_tests" +before-build = "pip install -U setuptools-rust" + +[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"' + +[[tool.cibuildwheel.overrides]] +select = "*-musllinux*" +before-all = "apk add apk add --no-cache curl gcc && curl https://sh.rustup.rs -sSf | sh -s -- -y && source $HOME/.cargo/env && rustup install stable && rustup default stable" +test-skip = "cp37-* cp38-*" + +[tool.cibuildwheel.macos] +environment = "MACOSX_DEPLOYMENT_TARGET=10.9" diff --git a/releasenotes/notes/platform-updates-e9b296144e633c95.yaml b/releasenotes/notes/platform-updates-e9b296144e633c95.yaml new file mode 100644 index 000000000..78166052b --- /dev/null +++ b/releasenotes/notes/platform-updates-e9b296144e633c95.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Added support for musl Linux platforms on x86_64 and aarch64 at :ref:`tier 3`. diff --git a/setup.py b/setup.py index 815f17538..e734d8be1 100644 --- a/setup.py +++ b/setup.py @@ -68,6 +68,7 @@ def readme(): "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX :: Linux",