Skip to content

Commit bb137ff

Browse files
jeromekelleherbenjeffery
authored andcommitted
Change build-time dependency to numpy 2, Drop Python 3.8, add 3.12, Add pyproject.toml
1 parent f467db6 commit bb137ff

32 files changed

+210
-296
lines changed

.circleci/config.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,12 @@ jobs:
183183
command: |
184184
cd python
185185
rm -fR build
186-
python setup.py sdist
187-
python setup.py check
188-
python -m twine check dist/*.tar.gz
186+
python -m pip install build
189187
python -m venv venv
190-
source venv/bin/activate
191-
pip install --upgrade setuptools pip wheel
192-
python setup.py build_ext
193-
python setup.py egg_info
194-
python setup.py bdist_wheel
195-
pip install dist/*.tar.gz
188+
python -m build --sdist
189+
python -m twine check dist/*.tar.gz
190+
python -m build --wheel
191+
pip install dist/*.whl
196192
tskit --help
197193
198194
build-32:
@@ -218,6 +214,7 @@ workflows:
218214
test:
219215
jobs:
220216
- build
221-
- build-32
217+
#Temporarily disabled due avoid compiling numpy on 32bit
218+
# - build-32
222219

223220

.github/workflows/docker/buildwheel.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,12 @@ cd python
1313
for V in "${PYTHON_VERSIONS[@]}"; do
1414
PYBIN=/opt/python/$V/bin
1515
rm -rf build/ # Avoid lib build by narrow Python is used by wide python
16-
# Instead of letting setup.py install a newer numpy we install it here
17-
# using the oldest supported version for ABI compatibility
18-
$PYBIN/pip install oldest-supported-numpy
19-
$PYBIN/python setup.py build_ext --inplace
20-
$PYBIN/python setup.py bdist_wheel
16+
$PYBIN/python -m pip install build
17+
$PYBIN/python -m build --wheel
2118
done
2219

2320
cd dist
2421
for whl in *.whl; do
2522
auditwheel repair "$whl"
2623
rm "$whl"
27-
done
24+
done

.github/workflows/docker/shared.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PYTHON_VERSIONS=(
2+
cp312-cp312
23
cp311-cp311
34
cp310-cp310
45
cp39-cp39
5-
cp38-cp38
66
)

.github/workflows/docs.yml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ on:
99

1010
env:
1111
COMMIT_EMAIL: [email protected]
12-
DOXYGEN: true
1312
MAKE_TARGET: -C python
1413
OWNER: tskit-dev
1514
REPO: tskit
1615
REQUIREMENTS: python/requirements/CI-docs/requirements.txt
17-
APTGET: doxygen
1816

1917
jobs:
2018
build-deploy-docs:
2119
name: Docs
2220
runs-on: ubuntu-latest
21+
defaults:
22+
run:
23+
shell: bash -l {0}
2324
steps:
2425
- name: Cancel Previous Runs
2526
uses: styfle/[email protected]
@@ -28,33 +29,40 @@ jobs:
2829

2930
- uses: actions/checkout@v4
3031

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

35-
- uses: actions/setup-python@v5
40+
- name: Cache Conda env
41+
uses: actions/cache@v3
3642
with:
37-
python-version: "3.10"
38-
cache: 'pip'
43+
path: ${{ env.CONDA }}/envs
44+
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ hashFiles(env.REQUIREMENTS) }}-${{ env.CACHE_NUMBER }}
45+
env:
46+
CACHE_NUMBER: 0
47+
id: cache
3948

40-
- name: Create venv and install deps
49+
- name: Update environment
4150
run: |
42-
pip install --upgrade pip wheel
43-
pip install -r ${{env.REQUIREMENTS}}
51+
mamba install -y python=3.10 doxygen pip
52+
pip install -r ${{ env.REQUIREMENTS }}
53+
if: steps.cache.outputs.cache-hit != 'true'
4454

4555
- name: Build C module
4656
if: env.MAKE_TARGET
47-
run: |
48-
make $MAKE_TARGET
57+
run: make $MAKE_TARGET
4958

5059
- name: Build Docs
51-
run: |
52-
make -C docs
60+
run: make -C docs
5361

5462
- name: Trigger docs site rebuild
5563
if: github.ref == 'refs/heads/main'
5664
run: |
5765
curl -X POST https://github.com/api/repos/tskit-dev/tskit-site/dispatches \
5866
-H 'Accept: application/vnd.github.everest-preview+json' \
5967
-u AdminBot-tskit:${{ secrets.ADMINBOT_TOKEN }} \
60-
--data '{"event_type":"build-docs"}'
68+
--data '{"event_type":"build-docs"}'

.github/workflows/tests.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
strategy:
6161
fail-fast: false
6262
matrix:
63-
python: [ 3.8, 3.9, "3.11" ]
63+
python: [ 3.9, 3.12 ]
6464
os: [ macos-latest, ubuntu-latest, windows-latest ]
6565
defaults:
6666
run:
@@ -121,7 +121,6 @@ jobs:
121121
if: steps.cache.outputs.cache-hit != 'true'
122122
shell: bash -l {0}
123123
run: |
124-
pip install setuptools==57.5.0 #v58 broke some deps https://setuptools.pypa.io/en/latest/history.html#v58-0-0
125124
pip install -r python/requirements/CI-tests-pip/requirements.txt
126125
# Remove tskit installed by conda
127126
pip uninstall -y tskit
@@ -133,11 +132,6 @@ jobs:
133132
conda activate anaconda-client-env
134133
python setup.py build_ext --inplace
135134
136-
- name: Remove py311 incompatible tests (lack of numba support for 3.11, needed for lshmm)
137-
if: matrix.python == '3.11'
138-
run: |
139-
rm python/tests/test_*matching*
140-
141135
- name: Run tests
142136
working-directory: python
143137
run: |

.github/workflows/wheels.yml

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: macos-latest
1616
strategy:
1717
matrix:
18-
python: [3.8, 3.9, "3.10", 3.11]
18+
python: [3.9, "3.10", 3.11, 3.12]
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v4
@@ -25,21 +25,11 @@ jobs:
2525
python-version: ${{ matrix.python }}
2626
- name: Install deps
2727
run: |
28-
# Upgrade pip to get bdist_wheel
29-
pip install --upgrade pip
30-
pip install setuptools wheel
31-
# Instead of letting setup.py install a newer numpy we install it here
32-
# using the oldest supported version for ABI compatibility
33-
pip install oldest-supported-numpy
34-
- name: Build C extension
35-
run: |
36-
cd python
37-
python -VV
38-
python setup.py build_ext --inplace
28+
pip install build
3929
- name: Build Wheel
4030
run: |
4131
cd python
42-
python setup.py bdist_wheel
32+
python -m build --wheel
4333
- name: Delocate to bundle dynamic libs
4434
run: |
4535
cd python
@@ -55,7 +45,7 @@ jobs:
5545
runs-on: windows-latest
5646
strategy:
5747
matrix:
58-
python: [3.8, 3.9, "3.10", 3.11]
48+
python: [3.9, "3.10", 3.11, 3.12]
5949
wordsize: [64]
6050
steps:
6151
- name: Checkout
@@ -66,12 +56,8 @@ jobs:
6656
shell: bash
6757
run: |
6858
set -ex
69-
${PYTHON} -m pip install --upgrade pip
70-
${PYTHON} -m pip install setuptools wheel
71-
# Instead of letting setup.py install a newer numpy we install it here
72-
# using the oldest supported version for ABI compatibility
73-
${PYTHON} -m pip install oldest-supported-numpy
74-
- name: Build C Extension
59+
${PYTHON} -m pip install build
60+
- name: Build Wheel
7561
env:
7662
PYTHON: "py -${{ matrix.python }}-${{ matrix.wordsize }}"
7763
shell: bash
@@ -86,15 +72,7 @@ jobs:
8672
cp -r --dereference ../c/subprojects lib/.
8773
cp -r --dereference ../c/tskit lib/.
8874
cp ../c/tskit.h lib/.
89-
${PYTHON} setup.py build_ext --inplace
90-
- name: Build Wheel
91-
env:
92-
PYTHON: "py -${{ matrix.python }}-${{ matrix.wordsize }}"
93-
shell: bash
94-
run: |
95-
set -ex
96-
cd python
97-
${PYTHON} setup.py bdist_wheel
75+
${PYTHON} -m build --wheel
9876
- name: Upload Wheels
9977
uses: actions/upload-artifact@v4
10078
with:
@@ -107,16 +85,17 @@ jobs:
10785
- name: Checkout
10886
uses: actions/checkout@v4
10987

110-
- name: Set up Python 3.8
88+
- name: Set up Python 3.9
11189
uses: actions/setup-python@v5
11290
with:
113-
python-version: 3.8
91+
python-version: 3.9
11492

11593
- name: Build sdist
11694
shell: bash
11795
run: |
11896
cd python
119-
python setup.py sdist
97+
python -m pip install build
98+
python -m build --sdist
12099
121100
- name: Upload sdist
122101
uses: actions/upload-artifact@v4
@@ -140,7 +119,7 @@ jobs:
140119
runs-on: macos-latest
141120
strategy:
142121
matrix:
143-
python: [3.8, 3.9, "3.10", 3.11]
122+
python: [3.9, "3.10", 3.11, 3.12]
144123
steps:
145124
- name: Download wheels
146125
uses: actions/download-artifact@v4
@@ -162,7 +141,7 @@ jobs:
162141
runs-on: windows-latest
163142
strategy:
164143
matrix:
165-
python: [3.8, 3.9, "3.10", 3.11]
144+
python: [3.9, "3.10", 3.11, 3.12]
166145
wordsize: [64]
167146
steps:
168147
- name: Download wheels
@@ -186,17 +165,17 @@ jobs:
186165
needs: ['manylinux']
187166
strategy:
188167
matrix:
189-
python: [3.8, 3.9, "3.10", 3.11]
168+
python: [3.9, "3.10", 3.11, 3.12]
190169
include:
191170

192-
- python: 3.8
193-
wheel: cp38
194171
- python: 3.9
195172
wheel: cp39
196173
- python: "3.10"
197174
wheel: cp310
198175
- python: 3.11
199176
wheel: cp311
177+
- python: 3.12
178+
wheel: cp312
200179
steps:
201180
- name: Download wheels
202181
uses: actions/download-artifact@v4
@@ -234,4 +213,4 @@ jobs:
234213
repository_url: https://test.pypi.org/legacy/
235214
- name: Publish distribution to PRODUCTION PyPI
236215
if: github.event_name == 'release' && !startsWith(github.event.release.tag_name, 'C_')
237-
uses: pypa/gh-action-pypi-publish@release/v1
216+
uses: pypa/gh-action-pypi-publish@release/v1

.mergify.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@ queue_rules:
55
- "#changes-requested-reviews-by=0"
66
- status-success=Docs
77
- status-success=Lint
8-
- status-success=Python (3.8, macos-latest)
98
- status-success=Python (3.9, macos-latest)
10-
- status-success=Python (3.11, macos-latest)
11-
- status-success=Python (3.8, ubuntu-latest)
9+
- status-success=Python (3.12, macos-latest)
1210
- status-success=Python (3.9, ubuntu-latest)
13-
- status-success=Python (3.11, ubuntu-latest)
14-
- status-success=Python (3.8, windows-latest)
11+
- status-success=Python (3.12, ubuntu-latest)
1512
- status-success=Python (3.9, windows-latest)
16-
- status-success=Python (3.11, windows-latest)
13+
- status-success=Python (3.12, windows-latest)
1714
- "status-success=ci/circleci: build"
1815
pull_request_rules:
1916
- name: Automatic rebase, CI and merge
@@ -25,15 +22,12 @@ pull_request_rules:
2522
- label=AUTOMERGE-REQUESTED
2623
- status-success=Docs
2724
- status-success=Lint
28-
- status-success=Python (3.8, macos-latest)
2925
- status-success=Python (3.9, macos-latest)
30-
- status-success=Python (3.11, macos-latest)
31-
- status-success=Python (3.8, ubuntu-latest)
26+
- status-success=Python (3.12, macos-latest)
3227
- status-success=Python (3.9, ubuntu-latest)
33-
- status-success=Python (3.11, ubuntu-latest)
34-
- status-success=Python (3.8, windows-latest)
28+
- status-success=Python (3.12, ubuntu-latest)
3529
- status-success=Python (3.9, windows-latest)
36-
- status-success=Python (3.11, windows-latest)
30+
- status-success=Python (3.12, windows-latest)
3731
- "status-success=ci/circleci: build"
3832
#- status-success=codecov/patch
3933
#- status-success=codecov/project/c-tests

c/tests/test_minimal_cpp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* * MIT License
22
*
3-
* Copyright (c) 2019-2023 Tskit Developers
3+
* Copyright (c) 2019-2024 Tskit Developers
44
*
55
* Permission is hereby granted, free of charge, to any person obtaining a copy
66
* of this software and associated documentation files (the "Software"), to deal

c/tskit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* MIT License
33
*
4-
* Copyright (c) 2019 Tskit Developers
4+
* Copyright (c) 2019-2024 Tskit Developers
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal

c/tskit/tables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* MIT License
33
*
4-
* Copyright (c) 2019-2023 Tskit Developers
4+
* Copyright (c) 2019-2024 Tskit Developers
55
* Copyright (c) 2017-2018 University of Oxford
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy

python/lwt_interface/dict_encoding_testlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2018-2022 Tskit Developers
3+
# Copyright (c) 2018-2024 Tskit Developers
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)