Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: Nano wheels py312 #632

Closed
wants to merge 14 commits into from
26 changes: 16 additions & 10 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,28 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1

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

- name: Get package name and version (Linux / Mac)
if: ${{ ! startsWith(matrix.os, 'windows-') }}
run: |
echo PACKAGE_NAME=$( python setup.py --name ) >> $GITHUB_ENV
echo PACKAGE_VERSION=$( python setup.py --version ) >> $GITHUB_ENV
echo "PACKAGE_NAME=$( python -c "import toml; print(toml.load('pyproject.toml')['project']['name'])" )" >> $GITHUB_ENV
echo "PACKAGE_VERSION=$( python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])" )" >> $GITHUB_ENV

# Some shells require "-Encoding utf8" to append to GITHUB_ENV
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions?tool=powershell#environment-files
- name: Get package name and version (Windows)
if: startsWith(matrix.os, 'windows-')
run: |
echo "PACKAGE_NAME=$( python setup.py --name )" | Out-File -FilePath $env:GITHUB_ENV `
-Append
echo "PACKAGE_VERSION=$( python setup.py --version )" | Out-File -FilePath $env:GITHUB_ENV `
-Append
echo "PACKAGE_NAME=$( python -c "import toml; print(toml.load('pyproject.toml')['project']['name'])" )" | Out-File -FilePath $env:GITHUB_ENV ` -Append
echo "PACKAGE_VERSION=$( python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])" )" | Out-File -FilePath $env:GITHUB_ENV ` -Append

- name: Determine macOS version
if: startsWith(matrix.os, 'macos-')
run: |
macos_version=$(sw_vers -productVersion | awk -F '.' '{print $1".0"}')
echo "MACOSX_DEPLOYMENT_TARGET=${macos_version}" >> $GITHUB_ENV

- name: Build wheels
env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
Expand All @@ -158,16 +163,17 @@ jobs:
python -m pip install cmake ninja setuptools

CIBW_ARCHS_MACOS: ${{ matrix.arch }}

CIBW_ENVIRONMENT_MACOS: |
CMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} CMAKE_PREFIX_PATH=/usr/local

CIBW_BEFORE_ALL_MACOS: |
python -m pip install cmake ninja setuptools
brew update
if ! brew list libpng &>/dev/null; then
HOMEBREW_NO_AUTO_UPDATE=1 brew install libpng
fi

CIBW_ENVIRONMENT_MACOS: |
CMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} CMAKE_PREFIX_PATH=/usr/local

run: python -m cibuildwheel --output-dir wheelhouse/cp${{ matrix.cibw_python }}-${{matrix.platform_id }}

- name: Install and test (Linux / Mac)
Expand Down
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Try to import all Python components potentially needed by nanobind
find_package(Python 3.8
REQUIRED COMPONENTS Interpreter Development.Module
OPTIONAL_COMPONENTS Development.SABIModule)
REQUIRED COMPONENTS Interpreter Development.Module)

# Import nanobind through CMake's find_package mechanism
find_package(nanobind CONFIG REQUIRED)
Expand Down Expand Up @@ -43,7 +42,6 @@ target_link_libraries(imageMathUtilities ${ITK_LIBRARIES})

nanobind_add_module(
lib
STABLE_ABI
NB_STATIC
src/main.cpp
src/antscore/antsAffineInitializer.cxx
Expand Down
6 changes: 0 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,3 @@ build-verbosity = 1
test-command = "pytest {project}/tests"
test-requires = "pytest"

# Don't test Python 3.8 wheels on macOS/arm64
test-skip="cp38-macosx_*:arm64"

# Needed for full C++17 support
[tool.cibuildwheel.macos.environment]
MACOSX_DEPLOYMENT_TARGET = "10.14"
Loading