Skip to content

Commit

Permalink
Merge pull request #2964 from jeromekelleher/compile-numpy2
Browse files Browse the repository at this point in the history
Compile on numpy2
  • Loading branch information
benjeffery authored Jun 27, 2024
2 parents f467db6 + bb137ff commit beafeba
Show file tree
Hide file tree
Showing 32 changed files with 210 additions and 296 deletions.
17 changes: 7 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,12 @@ jobs:
command: |
cd python
rm -fR build
python setup.py sdist
python setup.py check
python -m twine check dist/*.tar.gz
python -m pip install build
python -m venv venv
source venv/bin/activate
pip install --upgrade setuptools pip wheel
python setup.py build_ext
python setup.py egg_info
python setup.py bdist_wheel
pip install dist/*.tar.gz
python -m build --sdist
python -m twine check dist/*.tar.gz
python -m build --wheel
pip install dist/*.whl
tskit --help
build-32:
Expand All @@ -218,6 +214,7 @@ workflows:
test:
jobs:
- build
- build-32
#Temporarily disabled due avoid compiling numpy on 32bit
# - build-32


9 changes: 3 additions & 6 deletions .github/workflows/docker/buildwheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ cd python
for V in "${PYTHON_VERSIONS[@]}"; do
PYBIN=/opt/python/$V/bin
rm -rf build/ # Avoid lib build by narrow Python is used by wide python
# Instead of letting setup.py install a newer numpy we install it here
# using the oldest supported version for ABI compatibility
$PYBIN/pip install oldest-supported-numpy
$PYBIN/python setup.py build_ext --inplace
$PYBIN/python setup.py bdist_wheel
$PYBIN/python -m pip install build
$PYBIN/python -m build --wheel
done

cd dist
for whl in *.whl; do
auditwheel repair "$whl"
rm "$whl"
done
done
2 changes: 1 addition & 1 deletion .github/workflows/docker/shared.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PYTHON_VERSIONS=(
cp312-cp312
cp311-cp311
cp310-cp310
cp39-cp39
cp38-cp38
)
40 changes: 24 additions & 16 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ on:

env:
COMMIT_EMAIL: [email protected]
DOXYGEN: true
MAKE_TARGET: -C python
OWNER: tskit-dev
REPO: tskit
REQUIREMENTS: python/requirements/CI-docs/requirements.txt
APTGET: doxygen

jobs:
build-deploy-docs:
name: Docs
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand All @@ -28,33 +29,40 @@ jobs:

- uses: actions/checkout@v4

- name: Install apt deps
if: env.APTGET
run: sudo apt-get install -y ${{env.APTGET}}
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: tskit-docs-env
use-mamba: true

- uses: actions/setup-python@v5
- name: Cache Conda env
uses: actions/cache@v3
with:
python-version: "3.10"
cache: 'pip'
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ hashFiles(env.REQUIREMENTS) }}-${{ env.CACHE_NUMBER }}
env:
CACHE_NUMBER: 0
id: cache

- name: Create venv and install deps
- name: Update environment
run: |
pip install --upgrade pip wheel
pip install -r ${{env.REQUIREMENTS}}
mamba install -y python=3.10 doxygen pip
pip install -r ${{ env.REQUIREMENTS }}
if: steps.cache.outputs.cache-hit != 'true'

- name: Build C module
if: env.MAKE_TARGET
run: |
make $MAKE_TARGET
run: make $MAKE_TARGET

- name: Build Docs
run: |
make -C docs
run: make -C docs

- name: Trigger docs site rebuild
if: github.ref == 'refs/heads/main'
run: |
curl -X POST https://api.github.com/repos/tskit-dev/tskit-site/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u AdminBot-tskit:${{ secrets.ADMINBOT_TOKEN }} \
--data '{"event_type":"build-docs"}'
--data '{"event_type":"build-docs"}'
8 changes: 1 addition & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [ 3.8, 3.9, "3.11" ]
python: [ 3.9, 3.12 ]
os: [ macos-latest, ubuntu-latest, windows-latest ]
defaults:
run:
Expand Down Expand Up @@ -121,7 +121,6 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
shell: bash -l {0}
run: |
pip install setuptools==57.5.0 #v58 broke some deps https://setuptools.pypa.io/en/latest/history.html#v58-0-0
pip install -r python/requirements/CI-tests-pip/requirements.txt
# Remove tskit installed by conda
pip uninstall -y tskit
Expand All @@ -133,11 +132,6 @@ jobs:
conda activate anaconda-client-env
python setup.py build_ext --inplace
- name: Remove py311 incompatible tests (lack of numba support for 3.11, needed for lshmm)
if: matrix.python == '3.11'
run: |
rm python/tests/test_*matching*
- name: Run tests
working-directory: python
run: |
Expand Down
55 changes: 17 additions & 38 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
python: [3.8, 3.9, "3.10", 3.11]
python: [3.9, "3.10", 3.11, 3.12]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -25,21 +25,11 @@ jobs:
python-version: ${{ matrix.python }}
- name: Install deps
run: |
# Upgrade pip to get bdist_wheel
pip install --upgrade pip
pip install setuptools wheel
# Instead of letting setup.py install a newer numpy we install it here
# using the oldest supported version for ABI compatibility
pip install oldest-supported-numpy
- name: Build C extension
run: |
cd python
python -VV
python setup.py build_ext --inplace
pip install build
- name: Build Wheel
run: |
cd python
python setup.py bdist_wheel
python -m build --wheel
- name: Delocate to bundle dynamic libs
run: |
cd python
Expand All @@ -55,7 +45,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python: [3.8, 3.9, "3.10", 3.11]
python: [3.9, "3.10", 3.11, 3.12]
wordsize: [64]
steps:
- name: Checkout
Expand All @@ -66,12 +56,8 @@ jobs:
shell: bash
run: |
set -ex
${PYTHON} -m pip install --upgrade pip
${PYTHON} -m pip install setuptools wheel
# Instead of letting setup.py install a newer numpy we install it here
# using the oldest supported version for ABI compatibility
${PYTHON} -m pip install oldest-supported-numpy
- name: Build C Extension
${PYTHON} -m pip install build
- name: Build Wheel
env:
PYTHON: "py -${{ matrix.python }}-${{ matrix.wordsize }}"
shell: bash
Expand All @@ -86,15 +72,7 @@ jobs:
cp -r --dereference ../c/subprojects lib/.
cp -r --dereference ../c/tskit lib/.
cp ../c/tskit.h lib/.
${PYTHON} setup.py build_ext --inplace
- name: Build Wheel
env:
PYTHON: "py -${{ matrix.python }}-${{ matrix.wordsize }}"
shell: bash
run: |
set -ex
cd python
${PYTHON} setup.py bdist_wheel
${PYTHON} -m build --wheel
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
Expand All @@ -107,16 +85,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9

- name: Build sdist
shell: bash
run: |
cd python
python setup.py sdist
python -m pip install build
python -m build --sdist
- name: Upload sdist
uses: actions/upload-artifact@v4
Expand All @@ -140,7 +119,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
python: [3.8, 3.9, "3.10", 3.11]
python: [3.9, "3.10", 3.11, 3.12]
steps:
- name: Download wheels
uses: actions/download-artifact@v4
Expand All @@ -162,7 +141,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python: [3.8, 3.9, "3.10", 3.11]
python: [3.9, "3.10", 3.11, 3.12]
wordsize: [64]
steps:
- name: Download wheels
Expand All @@ -186,17 +165,17 @@ jobs:
needs: ['manylinux']
strategy:
matrix:
python: [3.8, 3.9, "3.10", 3.11]
python: [3.9, "3.10", 3.11, 3.12]
include:

- python: 3.8
wheel: cp38
- python: 3.9
wheel: cp39
- python: "3.10"
wheel: cp310
- python: 3.11
wheel: cp311
- python: 3.12
wheel: cp312
steps:
- name: Download wheels
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -234,4 +213,4 @@ jobs:
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution to PRODUCTION PyPI
if: github.event_name == 'release' && !startsWith(github.event.release.tag_name, 'C_')
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@release/v1
18 changes: 6 additions & 12 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ queue_rules:
- "#changes-requested-reviews-by=0"
- status-success=Docs
- status-success=Lint
- status-success=Python (3.8, macos-latest)
- status-success=Python (3.9, macos-latest)
- status-success=Python (3.11, macos-latest)
- status-success=Python (3.8, ubuntu-latest)
- status-success=Python (3.12, macos-latest)
- status-success=Python (3.9, ubuntu-latest)
- status-success=Python (3.11, ubuntu-latest)
- status-success=Python (3.8, windows-latest)
- status-success=Python (3.12, ubuntu-latest)
- status-success=Python (3.9, windows-latest)
- status-success=Python (3.11, windows-latest)
- status-success=Python (3.12, windows-latest)
- "status-success=ci/circleci: build"
pull_request_rules:
- name: Automatic rebase, CI and merge
Expand All @@ -25,15 +22,12 @@ pull_request_rules:
- label=AUTOMERGE-REQUESTED
- status-success=Docs
- status-success=Lint
- status-success=Python (3.8, macos-latest)
- status-success=Python (3.9, macos-latest)
- status-success=Python (3.11, macos-latest)
- status-success=Python (3.8, ubuntu-latest)
- status-success=Python (3.12, macos-latest)
- status-success=Python (3.9, ubuntu-latest)
- status-success=Python (3.11, ubuntu-latest)
- status-success=Python (3.8, windows-latest)
- status-success=Python (3.12, ubuntu-latest)
- status-success=Python (3.9, windows-latest)
- status-success=Python (3.11, windows-latest)
- status-success=Python (3.12, windows-latest)
- "status-success=ci/circleci: build"
#- status-success=codecov/patch
#- status-success=codecov/project/c-tests
Expand Down
2 changes: 1 addition & 1 deletion c/tests/test_minimal_cpp.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* * MIT License
*
* Copyright (c) 2019-2023 Tskit Developers
* Copyright (c) 2019-2024 Tskit Developers
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion c/tskit.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2019 Tskit Developers
* Copyright (c) 2019-2024 Tskit Developers
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion c/tskit/tables.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2019-2023 Tskit Developers
* Copyright (c) 2019-2024 Tskit Developers
* Copyright (c) 2017-2018 University of Oxford
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
2 changes: 1 addition & 1 deletion python/lwt_interface/dict_encoding_testlib.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2018-2022 Tskit Developers
# Copyright (c) 2018-2024 Tskit Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit beafeba

Please sign in to comment.