Skip to content

Commit 4a392ca

Browse files
authored
Bump Python / Numpy supported versions (#166)
* python-wheels: bump action versions * bump supported Python versions Follow https://scientific-python.org/specs/spec-0000/ * bump python version in conda environments * support numpy 2.0 Already supported by recents versions of pybind11 and xtensor-python, but we need to build against numpy 2.x in order to make fastscapelib-python work with numpy 1.xx and 2.x. * support numpy 1.24 at minimum Follow https://scientific-python.org/specs/spec-0000/ * bump xtensor(-python) downloaded versions * make numba dependency optional Allow building python 3.13 wheels without support for numba flow kernels for now. * fix import error + fix typing issue * fix doc builds (API) * doc: fix doxygen warnings * misc fixes * ci: add numpy 1.xx compat test * try fix doc build error No such error when building locally?! * fix pip install numpy version * try tracking doc build error on RTD * try fix RTD - add numba to doc environment - revert api hidden (it works locally so it should work on RTD) - doc envrionment: bump python version to 3.11 (maybe will solve the annotation warning similar to sphinx-doc/sphinx#11460 ?)
1 parent 708cc57 commit 4a392ca

File tree

17 files changed

+171
-146
lines changed

17 files changed

+171
-146
lines changed

.github/workflows/python-wheels.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
run: pipx run build --sdist
2020

2121
- name: Upload SDist
22-
uses: actions/upload-artifact@v3
22+
uses: actions/upload-artifact@v4
2323
with:
2424
path: dist/*.tar.gz
2525

@@ -35,7 +35,7 @@ jobs:
3535
uses: actions/checkout@v4
3636

3737
- name: Build wheels
38-
uses: pypa/cibuildwheel@v2.16
38+
uses: pypa/cibuildwheel@v2.21
3939
env:
4040
# skip PyPy and muslinux (for now)
4141
CIBW_SKIP: "pp* *musllinux*"
@@ -60,7 +60,7 @@ jobs:
6060
if: github.event_name == 'release' && github.event.action == 'published'
6161
steps:
6262
- name: Get dist files
63-
uses: actions/download-artifact@v3
63+
uses: actions/download-artifact@v4
6464
with:
6565
name: artifact
6666
path: dist

.github/workflows/tests.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
fail-fast: false
6565
matrix:
6666
os: ["ubuntu-20.04", "ubuntu-latest", "macos-latest", "windows-latest"]
67-
python-version: ["3.9", "3.10", "3.11"]
67+
python-version: ["3.10", "3.11", "3.12"]
6868
steps:
6969
- name: Checkout repo
7070
uses: actions/checkout@v3
@@ -85,3 +85,24 @@ jobs:
8585
- name: Run tests
8686
run: |
8787
pytest python/fastscapelib/tests -vv --color=yes
88+
89+
test_npy:
90+
name: Test Python (Numpy 1.xx compat)
91+
runs-on: ubuntu-latest
92+
steps:
93+
- name: Checkout repo
94+
uses: actions/checkout@v3
95+
96+
- name: Setup Python
97+
uses: actions/setup-python@v5
98+
with:
99+
python-version: '3.12'
100+
101+
- name: Build and install Fastscapelib Python (Numpy 2.x)
102+
run: |
103+
python -m pip install . --config-settings=cmake.define.FS_DOWNLOAD_XTENSOR_PYTHON=ON
104+
105+
- name: Run tests (Numpy 1.xx)
106+
run: |
107+
python -m pip install numpy==1.26.4 pytest
108+
pytest python/fastscapelib/tests -vv --color=yes

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ if(SKBUILD AND FS_DOWNLOAD_XTENSOR_PYTHON)
3939

4040
FetchContent_Declare(xtensor
4141
GIT_REPOSITORY https://github.com/xtensor-stack/xtensor
42-
GIT_TAG 0.24.6
42+
GIT_TAG 0.25.0
4343
GIT_SHALLOW TRUE)
4444
set(CPP17 ON CACHE BOOL "Enable C++17 for xtensor" FORCE)
4545
FetchContent_MakeAvailable(xtensor)
4646

4747
FetchContent_Declare(xtensor-python
4848
GIT_REPOSITORY https://github.com/xtensor-stack/xtensor-python
49-
GIT_TAG 0.26.1
49+
GIT_TAG 0.27.0
5050
GIT_SHALLOW TRUE)
5151
FetchContent_MakeAvailable(xtensor-python)
5252

doc/environment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ name: fastscapelib-docs
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.9
5+
- python=3.11
66
- breathe
77
- cmake
88
- xtensor-python
99
- pybind11
1010
- scikit-build-core
1111
- numpy
12+
- numba
1213
- matplotlib-base
1314
- pygalmesh
1415
- sphinx

doc/source/api_python/hidden.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77

88
MSTMethod
99
MSTRouteMethod
10-
flow.numba_flow_kernel.NumbaFlowKernel
11-
flow.numba_flow_kernel.NumbaFlowKernelData
10+
flow.numba.flow_kernel.NumbaFlowKernel
11+
flow.numba.flow_kernel.NumbaFlowKernelData

doc/source/install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ options.
130130

131131
## Install the Python Library
132132

133-
Fastscapelib's Python package requires Python (3.9+) and [numpy].
133+
Fastscapelib's Python package requires Python (3.10+) and [numpy].
134134

135135
(install-python-binary)=
136136

environment-python-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: fastscapelib-python-dev
22
channels:
33
- conda-forge
44
dependencies:
5-
- python>=3.8
5+
- python>=3.10
66
- numpy
77
- numba
88
- xtensor-python

include/fastscapelib/flow/flow_graph.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ namespace fastscapelib
251251
* @tparam FK The flow kernel type.
252252
* @tparam FKD The flow kernel data type.
253253
* @param kernel The flow kernel object to apply along the graph.
254-
* @param kernel_data The object holding or referencing input and output data
254+
* @param data The object holding or referencing input and output data
255255
* used by the flow kernel.
256256
*
257257
*/

include/fastscapelib/utils/thread_pool.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ namespace fastscapelib
5757
* @param first_index_ The first index in the range.
5858
* @param index_after_last_ The index after the last index in the range.
5959
* @param num_blocks_ The desired number of blocks to divide the range into.
60+
* @param min_size_ The minimum size of each blocks (ignored if zero, default).
6061
*/
6162
blocks(const T& first_index_,
6263
const T& index_after_last_,

pyproject.toml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[build-system]
22
requires = [
33
"scikit-build-core",
4-
"pybind11",
5-
# TODO: replace by "numpy>=1.25.0,<2" when dropping py3.8 support.
6-
# https://github.com/scipy/oldest-supported-numpy/issues/76
7-
"oldest-supported-numpy",
4+
# pybind11 2.12 added support for numpy 2.0
5+
# pybind11 doesn't require numpy at build time, but xtensor-python does!
6+
# packages built with numpy 2.x are compatible with numpy 1.xx
7+
"pybind11>=2.12,<3",
8+
"numpy>=2.0,<3",
89
]
910
build-backend = "scikit_build_core.build"
1011

@@ -21,14 +22,17 @@ authors = [
2122
maintainers = [
2223
{name = "Fastscapelib contributors"},
2324
]
24-
requires-python = ">=3.8"
25-
dependencies = ["numpy", "numba"]
25+
requires-python = ">=3.10"
26+
dependencies = [
27+
"numpy>=1.24",
28+
]
2629

2730
[project.urls]
2831
Home = "https://fastscapelib.readthedocs.io"
2932
Repository = "https://github.com/fastscape-lem/fastscapelib"
3033

3134
[project.optional-dependencies]
35+
numba = ["numba"]
3236
test = ["pytest>=6.0"]
3337

3438
[tool.scikit-build]
@@ -40,6 +44,12 @@ test-extras = "test"
4044
test-command = "pytest {project}/python/fastscapelib/tests"
4145
build-verbosity = 1
4246

47+
[[tool.cibuildwheel.overrides]]
48+
# TODO: remove when numba supports python 3.13
49+
select = "cp3{10,11,12}-*"
50+
inherit.test-requires = "append"
51+
test-requires = ["numba"]
52+
4353
[tool.cibuildwheel.macos]
4454
environment = {SKBUILD_CMAKE_ARGS='-DFS_DOWNLOAD_XTENSOR_PYTHON=ON', MACOSX_DEPLOYMENT_TARGET=10.13}
4555

0 commit comments

Comments
 (0)