Skip to content

Commit

Permalink
Include 3.13 and numpy 2 support in binaries (#210)
Browse files Browse the repository at this point in the history
Updating to np 2 and 3.13.

Should close issues #205, #207.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
afedynitch and pre-commit-ci[bot] authored Nov 11, 2024
1 parent 3adc6b7 commit b7d7035
Show file tree
Hide file tree
Showing 29 changed files with 835 additions and 546 deletions.
123 changes: 62 additions & 61 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [native]
py: [cp310]
arch: [auto]
py: [cp313]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -37,19 +37,20 @@ jobs:
id: setup-fortran
with:
compiler: gcc
version: 11
version: 13

- name: cibuildwheel on Linux
uses: pypa/cibuildwheel@v2.16.5
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_BUILD: ${{ matrix.py }}-*
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_ENVIRONMENT_PASS_LINUX: CI
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: wheel-${{ matrix.py }}-${{ matrix.os }}-${{ matrix.arch }}



Expand All @@ -60,36 +61,39 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [native, arm64]
py: [cp39, cp310, cp311, cp312]
os: [ubuntu-latest, macos-13, macos-14] # windows-latest: Disable windows for now
arch: [auto, aarch64]
py: [cp39, cp310, cp311, cp312, cp313]
exclude:
- os: ubuntu-latest
arch: arm64
- os: windows-latest
arch: arm64
- os: windows-latest
arch: aarch64
- os: macos-13
arch: aarch64
- os: macos-14
arch: aarch64
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- if: ${{ matrix.arch == 'aarch64' }}
uses: docker/setup-qemu-action@v3

- name: Get latest CMake and Ninja
uses: lukka/get-cmake@latest

- if: ${{ matrix.arch == 'aarch64' }}
uses: docker/setup-qemu-action@v2
# Set deployment target env var on macos 13
- if: ${{ matrix.os == 'macos-13' }}
name: Set deployment target for MacOS-13
run: export MACOSX_DEPLOYMENT_TARGET=13.0

# Remove after January 16th 2023 when GA switches to 14.2 by default
# Remove someday when migration for all nodes will be finished
- if: ${{ matrix.os == 'macos-latest' }}
- if: ${{ matrix.os == 'macos-13'}}
name: Use a more legacy version of Xcode tools on MacOS-13
run: sudo xcode-select -s "/Applications/Xcode_14.2.app"

- if: ${{ matrix.os == 'macos-latest' && matrix.arch == 'native'}}
name: Install graphviz for tests on MacOS native
uses: tlylt/install-graphviz@v1

- if: ${{ matrix.os == 'macos-latest' && matrix.arch == 'native'}}
name: Setup gfortran for MacOS native
- if: ${{ matrix.os == 'macos-13'}}
name: Setup gfortran for MacOS 13
run: |
# Taken from https://github.com/numpy/numpy/tree/main/tools/wheels
set -xe
Expand All @@ -99,17 +103,22 @@ jobs:
gfortran --version
which gfortran
- if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' }}
name: Setup gfortran for Linux or Windows
uses: awvwgk/setup-fortran@main
- if: ${{ matrix.os != 'macos-13'}}
name: Setup gfortran
uses: awvwgk/setup-fortran@v1.6.1
id: setup-fortran
with:
compiler: gcc
version: 11
version: 13

- if: ${{ matrix.os != 'macos-13' }}
uses: ts-graphviz/setup-graphviz@v2
name: Install Graphviz


- if: ${{ matrix.os == 'windows-latest' }}
name: cibuildwheel on Windows
uses: pypa/cibuildwheel@v2.16.5
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_BUILD: ${{ matrix.py }}-*
CIBW_ARCHS: ${{ matrix.arch }}
Expand All @@ -118,52 +127,44 @@ jobs:

- if: ${{ matrix.os == 'ubuntu-latest' }}
name: cibuildwheel on Linux
uses: pypa/cibuildwheel@v2.16.5
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_BUILD: ${{ matrix.py }}-*
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_ENVIRONMENT_PASS_LINUX: CI
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
# Will avoid testing on emulated architectures
CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x,armv7l}"


- if: ${{ matrix.os == 'macos-latest' && matrix.arch == 'native' }}
name: cibuildwheel on MacOS native
uses: pypa/cibuildwheel@v2.16.5
- if: ${{ matrix.os == 'macos-13'}}
name: cibuildwheel on MacOS-13
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_BUILD: ${{ matrix.py }}-*
CIBW_ARCHS: ${{ matrix.arch }}
no_proxy: '*'
CHROMO_SKIP_GRAPHVIZ: 1

- if: ${{ matrix.os == 'macos-latest' && matrix.arch == 'arm64' }}
name: cibuildwheel on MacOS arm64
id: cibw_step
uses: pypa/cibuildwheel@v2.16.5
- if: ${{ matrix.os == 'macos-14' }}
name: cibuildwheel on MacOS-14
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_BUILD: ${{ matrix.py }}-*
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_ARCHS_MACOS: arm64
CIBW_BEFORE_BUILD: |
# Taken from https://github.com/numpy/numpy/tree/main/tools/wheels
set -xe
export PLAT="arm64"
chmod +x .github/workflows/gfortran_utils.sh
source .github/workflows/gfortran_utils.sh
install_arm64_cross_gfortran
# Although FC is set in the CIBW_BEFORE_BUILD script above,
# it is not found by pip and cmake. So here FC is set by hand!!!
# It can be a problem if gfortran will be installed in different place.
FC: "/opt/gfortran-darwin-arm64-cross/bin/arm64-apple-darwin20.0.0-gfortran"
MACOSX_DEPLOYMENT_TARGET: "11.0"
no_proxy: '*'
MACOSX_DEPLOYMENT_TARGET: 14.0

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.py }}-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl

sdist:
name: source package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -173,17 +174,17 @@ jobs:
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.9'
python-version: '3.12'

- uses: tlylt/install-graphviz@v1
name: Install Graphviz

- run: python -m pip install --upgrade pip wheel
- run: python -m pip install numpy packaging
- run: python setup.py sdist
- run: python -m pip install --upgrade pip wheel setuptools
- run: pipx run build --sdist
- run: python -m pip install --prefer-binary -v `echo dist/chromo-*`[test]
- run: python -m pytest -vv
- run: python -m pytest -v

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz

Expand All @@ -194,13 +195,13 @@ jobs:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: Download files in artifact to "dist/" directory
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4.1.7
with:
name: artifact
path: dist

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1.6.4
uses: pypa/gh-action-pypi-publish@release/v1.8
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
Expand Down
33 changes: 22 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,48 @@ jobs:
matrix:
include:
# Python version number must be string, otherwise 3.10 becomes 3.1
- os: windows-latest
python-version: "3.12"
# Disable Windows for now, as long as numpy is buggy on Windows
# - os: windows-latest
# python-version: "3.12"
# installs: "numpy==1.26.4"

- os: macos-latest
- os: macos-14
python-version: "3.12"
installs: "numpy>=2"

- os: ubuntu-latest
python-version: "3.12"

python-version: "3.13"
installs: "numpy>=2"
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-python@v4
fetch-depth: 3
- name: Get latest CMake and Ninja
uses: lukka/get-cmake@latest
# must come after checkout
- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.python-version }}
- uses: astral-sh/setup-uv@v3
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: awvwgk/setup-fortran@main
id: setup-fortran
with:
compiler: gcc
version: 11
version: 13

- run: python -m pip install --upgrade pip

- if: ${{ matrix.os != 'windows-latest' }}
run: python -m pip install --prefer-binary -v .[test]
run: uv pip install --system -v .[test] ${{ matrix.installs }}

- if: ${{ matrix.os == 'windows-latest' }}
run: python -m pip install --prefer-binary -v .[test]
run: python -m pip install --prefer-binary -v .[test] ${{ matrix.installs }}
env:
CMAKE_GENERATOR: "MinGW Makefiles"
FC: ${{ steps.setup-fortran.outputs.fc }}
Expand Down
24 changes: 16 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-docstring-first
Expand All @@ -32,18 +32,26 @@ repos:

# Python formatting
- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black

# Python linter (Flake8)
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
# Ruff linter, replacement for flake8, pydocstyle, isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.6.9'
hooks:
- id: flake8
files: chromo/[^_].*\.py
args: [--config, setup.cfg]
- id: ruff
args: [--fix, --show-fixes]

# # CMake formatting
# - repo: https://github.com/cheshirekow/cmake-format-precommit
# rev: v0.6.13
# hooks:
# - id: cmake-format
# additional_dependencies: [pyyaml]
# types: [file]
# files: (\.cmake|CMakeLists.txt)(.in)?$

# # Enable the following later
# # Python docstring formatting
# - repo: https://github.com/pycqa/pydocstyle
Expand Down
Loading

0 comments on commit b7d7035

Please sign in to comment.