Skip to content

Commit

Permalink
Merge pull request #510 from ravnoor/py312_ci
Browse files Browse the repository at this point in the history
COMP: Add support for Python 3.12
  • Loading branch information
stnava committed Dec 21, 2023
2 parents b3eb9f7 + 4dea23e commit 49a6bc0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 34 deletions.
12 changes: 6 additions & 6 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:

build_and_store_wheels: &BUILD_AND_STORE_WHEELS
install_cibuildwheel_pipx_script:
- python -m pip install cibuildwheel==2.12.0 pipx jq
- python -m pip install cibuildwheel==2.16.2 jq pipx setuptools
- python -m pipx ensurepath
run_cibuildwheel_script:
- cibuildwheel
Expand Down Expand Up @@ -69,17 +69,16 @@ linux_aarch64_task:
# only_if: ${CIRRUS_BRANCH} == 'master' || ${CIRRUS_PR} != ''
env:
matrix:
- CIBW_BUILD: "cp36-manylinux*"
- CIBW_BUILD: "cp37-manylinux*"
- CIBW_BUILD: "cp38-manylinux*"
- CIBW_BUILD: "cp39-manylinux*"
- CIBW_BUILD: "cp310-manylinux*"
- CIBW_BUILD: "cp311-manylinux*"
- CIBW_BUILD: "cp312-manylinux*"
CIBW_ARCHS_LINUX: "auto"
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
CIBW_BEFORE_ALL_LINUX: >
yum install -y gcc-c++ libpng-devel libpng &&
python -m pip install cmake ninja
python -m pip install cmake ninja setuptools
CIBW_BEFORE_TEST: |
python -m pip install --find-links=wheelhouse/ -r requirements.txt
CIBW_TEST_COMMAND: bash {project}/tests/run_tests.sh
Expand Down Expand Up @@ -107,17 +106,18 @@ macos_arm64_task:
name: build_macos_arm64_wheels
# only_if: ${CIRRUS_BRANCH} == 'master' || ${CIRRUS_PR} != ''
macos_instance:
image: ghcr.io/cirruslabs/macos-monterey-xcode
image: ghcr.io/cirruslabs/macos-ventura-xcode:15
env:
matrix:
- CIBW_BUILD: cp38-macosx_arm64
- CIBW_BUILD: cp39-macosx_arm64
- CIBW_BUILD: cp310-macosx_arm64
- CIBW_BUILD: cp311-macosx_arm64
- CIBW_BUILD: cp312-macosx_arm64
CIBW_ARCHS_MACOS: arm64
CIBW_BEFORE_ALL_MACOS: >
python -m ensurepip --upgrade &&
conda install cmake ninja libpng
conda install cmake ninja libpng setuptools
CIBW_BEFORE_TEST: |
python -m pip install --find-links=wheelhouse/ -r requirements.txt
CIBW_TEST_COMMAND: bash {project}/tests/run_tests.sh
Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ jobs:
# Need to quote decimal versions as string to avoid the "Norway problem"

# Windows 64-bit
- os: windows-latest
python: '3.7'
cibw_python: 37
platform_id: win_amd64
- os: windows-latest
python: '3.8'
cibw_python: 38
Expand All @@ -43,12 +39,12 @@ jobs:
python: '3.11'
cibw_python: 311
platform_id: win_amd64
- os: windows-latest
python: '3.12'
cibw_python: 312
platform_id: win_amd64

# Linux 64-bit
- os: ubuntu-latest
python: '3.7'
cibw_python: 37
platform_id: manylinux_x86_64
- os: ubuntu-latest
python: '3.8'
cibw_python: 38
Expand All @@ -65,13 +61,12 @@ jobs:
python: '3.11'
cibw_python: 311
platform_id: manylinux_x86_64
- os: ubuntu-latest
python: '3.12'
cibw_python: 312
platform_id: manylinux_x86_64

# macOS on Intel 64-bit
- os: macos-latest
python: '3.7'
cibw_python: 37
arch: x86_64
platform_id: macosx_x86_64
- os: macos-latest
python: '3.8'
cibw_python: 38
Expand All @@ -92,6 +87,11 @@ jobs:
cibw_python: 311
arch: x86_64
platform_id: macosx_x86_64
- os: macos-latest
python: '3.12'
cibw_python: 312
arch: x86_64
platform_id: macosx_x86_64

# macOS on Apple M1 64-bit
# - os: macos-latest
Expand All @@ -116,11 +116,11 @@ jobs:
# platform_id: macosx_arm64

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python host for cibuildwheel
with:
python-version: ${{ matrix.python }}
Expand All @@ -131,7 +131,7 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.12.1
run: python -m pip install cibuildwheel==2.16.2 setuptools

- name: Get package name and version (Linux / Mac)
if: ${{ ! startsWith(matrix.os, 'windows-') }}
Expand Down Expand Up @@ -159,14 +159,14 @@ jobs:

CIBW_BEFORE_ALL_LINUX: |
yum install -y gcc-c++ libpng-devel libpng
pip install cmake ninja
python -m pip install cmake ninja setuptools
CIBW_BEFORE_ALL_WINDOWS: |
pip install cmake ninja
python -m pip install cmake ninja setuptools
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
CIBW_BEFORE_ALL_MACOS: |
pip install cmake ninja
python -m pip install cmake ninja setuptools
CIBW_ENVIRONMENT_MACOS: |
CMAKE_OSX_ARCHITECTURES=${{ matrix.arch }}
Expand All @@ -176,7 +176,7 @@ jobs:
- name: Install and test (Linux / Mac)
if: ${{ ! startsWith(matrix.os, 'windows-') }}
run: |
pip install wheelhouse/cp${{ matrix.cibw_python }}-${{matrix.platform_id }}/*.whl
python -m pip install wheelhouse/cp${{ matrix.cibw_python }}-${{matrix.platform_id }}/*.whl
tests/run_tests.sh
- name: Install and test (Windows)
Expand Down
17 changes: 13 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Note: QEMU emulated ppc64le build might take ~6 hours

# Use conda to resolve dependencies cross-platform
FROM continuumio/miniconda3:22.11.1 as builder
FROM debian:bookworm-slim as builder

# install libpng to system for cross-architecture support
# https://github.com/ANTsX/ANTs/issues/1069#issuecomment-681131938
Expand All @@ -11,12 +11,21 @@ RUN apt-get update && \
apt-transport-https \
bash \
build-essential \
ca-certificates \
git \
libpng-dev
libpng-dev \
wget

# install miniconda3
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-py310_23.11.0-1-Linux-$(uname -m).sh \
&& /bin/bash Miniconda3-py310_23.11.0-1-Linux-$(uname -m).sh -b -p /opt/conda \
&& rm Miniconda3-py310_23.11.0-1-Linux-$(uname -m).sh
ENV PATH=/opt/conda/bin:$PATH

# install cmake binary using conda for multi-arch support
# apt install fails because libssl1.0.0 is not available for newer Debian
RUN conda install -c anaconda cmake
RUN conda update -c defaults conda
RUN conda install -c conda-forge cmake

WORKDIR /usr/local/src
COPY environment.yml .
Expand All @@ -31,6 +40,6 @@ RUN pip --no-cache-dir -v install .
RUN bash tests/run_tests.sh

# optimize layers
FROM debian:bullseye-20230109-slim
FROM debian:bookworm-slim
COPY --from=builder /opt/conda /opt/conda
ENV PATH=/opt/conda/bin:$PATH
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import subprocess
import sys
import time
from distutils.version import LooseVersion
from functools import cmp_to_key

import setuptools
Expand Down Expand Up @@ -106,9 +105,7 @@ def run(self):
+ ", ".join(e.name for e in self.extensions)
)

cmake_version = LooseVersion(
re.search(r"version\s*([\d.]+)", out.decode()).group(1)
)
cmake_version = re.search(r"version\s*([\d.]+)", out.decode()).group(1)
if cmake_version < "3.10.0":
raise RuntimeError("CMake >= 3.10.0 is required")

Expand Down

0 comments on commit 49a6bc0

Please sign in to comment.