Skip to content

Commit 56dff33

Browse files
authored
Merge pull request #206 from bluescarni/pr/numpy2
Support for numpy 2
2 parents e6d7588 + 2e2609a commit 56dff33

26 files changed

+323
-398
lines changed

.circleci/config.yml

+12-30
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,34 @@
11
version: 2.1
22

33
jobs:
4-
conda_heyoka_head_39:
4+
conda_x86_64_heyoka_head_312:
55
docker:
66
- image: cimg/base:current
77
resource_class: large
88
steps:
99
- checkout
1010
- run:
1111
name: Build and test
12-
command: bash ./tools/circleci_conda_heyoka_head_39.sh
13-
- store_artifacts:
14-
path: doc/_build/html
15-
conda_heyoka_head_310:
16-
docker:
17-
- image: cimg/base:current
18-
resource_class: large
19-
steps:
20-
- checkout
21-
- run:
22-
name: Build and test
23-
command: bash ./tools/circleci_conda_heyoka_head_310.sh
24-
- store_artifacts:
25-
path: doc/_build/html
26-
conda_heyoka_head_312:
27-
docker:
28-
- image: cimg/base:current
29-
resource_class: large
30-
steps:
31-
- checkout
32-
- run:
33-
name: Build and test
34-
command: bash ./tools/circleci_conda_heyoka_head_312.sh
35-
ubuntu_arm64:
12+
command: bash ./tools/conda_docs.sh
13+
environment:
14+
HEYOKA_PY_PY_VERSION: "3.12"
15+
HEYOKA_PY_CONDA_ARCH: "Linux-x86_64"
16+
conda_arm64_heyoka_head_312:
3617
machine:
3718
image: ubuntu-2204:current
3819
resource_class: arm.large
3920
steps:
4021
- checkout
4122
- run:
4223
name: Build and test
43-
command: bash ./tools/circleci_ubuntu_arm64.sh
24+
command: bash ./tools/conda_docs.sh
25+
environment:
26+
HEYOKA_PY_PY_VERSION: "3.12"
27+
HEYOKA_PY_CONDA_ARCH: "Linux-aarch64"
4428

4529
workflows:
4630
version: 2.1
4731
all_builds:
4832
jobs:
49-
- conda_heyoka_head_39
50-
- conda_heyoka_head_310
51-
- conda_heyoka_head_312
52-
- ubuntu_arm64
33+
- conda_x86_64_heyoka_head_312
34+
- conda_arm64_heyoka_head_312

.github/workflows/gh_actions_ci.yml

+29-20
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,38 @@ jobs:
2121
- uses: actions/checkout@v4
2222
- name: Build
2323
run: bash tools/gha_conda_static.sh
24-
osx_heyoka_head:
25-
runs-on: macos-latest
24+
osx_heyoka_head_x86_64:
25+
runs-on: macos-13
26+
env:
27+
HEYOKA_PY_PY_VERSION: "3.12"
28+
HEYOKA_PY_CONDA_ARCH: "MacOSX-x86_64"
2629
steps:
2730
- uses: actions/checkout@v4
2831
- name: Build
2932
run: bash tools/gha_osx_heyoka_head.sh
30-
osx_heyoka_head_static:
31-
runs-on: macos-latest
33+
osx_heyoka_head_x86_64_static:
34+
runs-on: macos-13
35+
env:
36+
HEYOKA_PY_PY_VERSION: "3.12"
37+
HEYOKA_PY_CONDA_ARCH: "MacOSX-x86_64"
38+
steps:
39+
- uses: actions/checkout@v4
40+
- name: Build
41+
run: bash tools/gha_osx_heyoka_head_static.sh
42+
osx_heyoka_head_arm64:
43+
runs-on: macos-14
44+
env:
45+
HEYOKA_PY_PY_VERSION: "3.12"
46+
HEYOKA_PY_CONDA_ARCH: "MacOSX-arm64"
47+
steps:
48+
- uses: actions/checkout@v4
49+
- name: Build
50+
run: bash tools/gha_osx_heyoka_head.sh
51+
osx_heyoka_head_arm64_static:
52+
runs-on: macos-14
53+
env:
54+
HEYOKA_PY_PY_VERSION: "3.12"
55+
HEYOKA_PY_CONDA_ARCH: "MacOSX-arm64"
3256
steps:
3357
- uses: actions/checkout@v4
3458
- name: Build
@@ -124,21 +148,6 @@ jobs:
124148
with:
125149
name: wheel_39
126150
path: repaired_wheel/*.whl
127-
manylinux228_x86_64-py38:
128-
runs-on: ubuntu-latest
129-
container:
130-
image: pagmo2/manylinux228_x86_64_with_deps:latest
131-
env:
132-
HEYOKA_PY_BUILD_TYPE: "Python38"
133-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
134-
steps:
135-
- uses: actions/checkout@v4
136-
- name: Build
137-
run: bash tools/gha_manylinux.sh
138-
- uses: actions/upload-artifact@v4
139-
with:
140-
name: wheel_38
141-
path: repaired_wheel/*.whl
142151
windows_2022_heyoka_head:
143152
runs-on: windows-2022
144153
steps:
@@ -153,7 +162,7 @@ jobs:
153162
- name: Build
154163
shell: pwsh
155164
run: |
156-
conda install -y python=3.12 git pybind11 numpy<2 cmake llvmdev tbb-devel tbb astroquery libboost-devel fmt skyfield spdlog sleef sympy cloudpickle zlib libzlib 'mppp=1.*' numba
165+
conda install -y python=3.12 git pybind11 numpy>=2 cmake llvmdev tbb-devel tbb astroquery libboost-devel fmt skyfield spdlog sleef sympy cloudpickle zlib libzlib 'mppp=2.*' numba
157166
git clone --depth 1 https://github.com/bluescarni/heyoka.git heyoka_cpp
158167
cd heyoka_cpp
159168
mkdir build

.github/workflows/static.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@ jobs:
2727
name: github-pages
2828
url: ${{ steps.deployment.outputs.page_url }}
2929
runs-on: ubuntu-latest
30+
env:
31+
HEYOKA_PY_PY_VERSION: "3.12"
32+
HEYOKA_PY_CONDA_ARCH: "Linux-x86_64"
3033
steps:
3134
- name: Checkout
3235
uses: actions/checkout@v4
3336
- name: Setup Pages
3437
uses: actions/configure-pages@v4
3538
- name: Build docs
36-
run: bash tools/gha_conda_docs.sh
39+
run: bash tools/conda_docs.sh
3740
- name: Upload docs
3841
uses: actions/upload-pages-artifact@v3
3942
with:

CMakeLists.txt

+14-12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
# required by heyoka.
33
cmake_minimum_required(VERSION 3.18.0)
44

5+
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.31.0)
6+
# NOTE: adopt the new behaviour for this policy:
7+
# https://cmake.org/cmake/help/latest/policy/CMP0177.html
8+
cmake_policy(SET CMP0177 NEW)
9+
endif()
10+
511
# Set default build type to "Release".
612
# NOTE: this should be done before the project command since the latter can set
713
# CMAKE_BUILD_TYPE itself (it does so for nmake).
@@ -11,7 +17,7 @@ if(NOT CMAKE_BUILD_TYPE)
1117
FORCE)
1218
endif()
1319

14-
project(heyoka.py VERSION 6.1.3 LANGUAGES CXX C)
20+
project(heyoka.py VERSION 7.0.0 LANGUAGES CXX C)
1521

1622
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/yacma")
1723

@@ -118,7 +124,7 @@ find_package(fmt REQUIRED CONFIG)
118124
message(STATUS "fmt version: ${fmt_VERSION}")
119125

120126
# heyoka.
121-
find_package(heyoka 6.1.0 REQUIRED CONFIG)
127+
find_package(heyoka 7.0.0 REQUIRED CONFIG)
122128

123129
# Python.
124130

@@ -144,17 +150,13 @@ find_package(Python3 QUIET REQUIRED COMPONENTS ${_HEYOKA_PY_PYTHON3_COMPONENTS})
144150

145151
message(STATUS "Python3 interpreter: ${Python3_EXECUTABLE}")
146152
message(STATUS "Python3 installation directory: ${Python3_SITEARCH}")
147-
if(${Python3_VERSION_MINOR} LESS 5)
148-
message(FATAL_ERROR "The minimum supported version of Python is 3.5, but version 3.${Python3_VERSION_MINOR} was found instead")
149-
endif()
150-
# NOTE: mppp::real support requires NumPy 1.22 at least.
151-
if(heyoka_WITH_REAL AND ${Python3_NumPy_VERSION} LESS 1.22)
152-
message(FATAL_ERROR "The minimum version of NumPy required for supporting arbitrary-precision computations is 1.22, but version ${Python3_NumPy_VERSION} was found instead")
153+
# NOTE: Python 3.9 seems like the absolute minimum for NumPy 2.
154+
if(${Python3_VERSION_MINOR} LESS 9)
155+
message(FATAL_ERROR "The minimum supported version of Python is 3.9, but version 3.${Python3_VERSION_MINOR} was found instead")
153156
endif()
154-
# NOTE: NumPy 2 not supported yet if we are building with support
155-
# for mppp::real or mppp::real128.
156-
if((heyoka_WITH_REAL OR heyoka_WITH_REAL128) AND ${Python3_NumPy_VERSION} VERSION_GREATER_EQUAL 2)
157-
message(FATAL_ERROR "NumPy 2 is not supported when building with support for quadruple-precision or arbitrary-precision computations")
157+
# We support only NumPy>=2.
158+
if((heyoka_WITH_REAL OR heyoka_WITH_REAL128) AND ${Python3_NumPy_VERSION} VERSION_LESS 2)
159+
message(FATAL_ERROR "NumPy>=2 is required when building with support for quadruple-precision or arbitrary-precision computations")
158160
endif()
159161
message(STATUS "NumPy version: ${Python3_NumPy_VERSION}")
160162
unset(_HEYOKA_PY_PYTHON3_COMPONENTS)

doc/breaking_changes.rst

+13-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ Breaking changes
55

66
.. currentmodule:: heyoka
77

8+
.. _bchanges_7_0_0:
9+
10+
7.0.0
11+
-----
12+
13+
Updated Python dependencies
14+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
15+
16+
heyoka.py now depends on NumPy>=2. This is due to changes introduced by NumPy 2 in the DType API,
17+
which make it unfeasible to support both NumPy 1 and 2 at the same time.
18+
As a further consequence, support for Python<3.9 has also been dropped.
19+
820
.. _bchanges_6_0_0:
921

1022
6.0.0
@@ -206,7 +218,7 @@ before invoking ``propagate_grid()``.
206218
the ``propagate_until()`` method, but an integral value was passed instead.
207219
The solution is to use ``propagate_until(10.)`` instead.
208220
In a similar fashion, if your code
209-
is raising :py:exc:`TypeError` exceptions with heyoka.py >=0.19,
221+
is raising :py:exc:`TypeError` exceptions with heyoka.py>=0.19,
210222
the solution is to ensure that values of the correct
211223
type are passed to the heyoka.py API (especially whenever floating-point arguments
212224
are expected).

doc/changelog.rst

+14-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Changelog
44
=========
55

6-
6.1.3 (unreleased)
6+
7.0.0 (unreleased)
77
------------------
88

99
New
@@ -12,6 +12,19 @@ New
1212
- Upload the source distribution to PyPI
1313
(`#203 <https://github.com/bluescarni/heyoka.py/pull/203>`__).
1414

15+
Changes
16+
~~~~~~~
17+
18+
- heyoka.py now requires version 7.0.0 of the
19+
heyoka C++ library
20+
(`#206 <https://github.com/bluescarni/heyoka.py/pull/206>`__).
21+
- **BREAKING**: heyoka.py now requires Python >= 3.9
22+
(`#206 <https://github.com/bluescarni/heyoka.py/pull/206>`__).
23+
This is a :ref:`breaking change <bchanges_7_0_0>`.
24+
- **BREAKING**: heyoka.py now requires NumPy >= 2
25+
(`#206 <https://github.com/bluescarni/heyoka.py/pull/206>`__).
26+
This is a :ref:`breaking change <bchanges_7_0_0>`.
27+
1528
6.1.2 (2024-10-10)
1629
------------------
1730

doc/install.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Dependencies
99
heyoka.py has several Python and C++ dependencies. On the C++ side, heyoka.py depends on:
1010

1111
* the `heyoka C++ library <https://github.com/bluescarni/heyoka>`__,
12-
version 6.1.x (**mandatory**),
12+
version 7.0.x (**mandatory**),
1313
* the `Boost <https://www.boost.org/>`__ C++ libraries (**mandatory**),
1414
* the `{fmt} <https://fmt.dev/latest/index.html>`__ library (**mandatory**),
1515
* the `TBB <https://github.com/oneapi-src/oneTBB>`__ library (**mandatory**),
@@ -21,9 +21,9 @@ heyoka.py has several Python and C++ dependencies. On the C++ side, heyoka.py de
2121
:ref:`heyoka <hy:installation>` and :ref:`mp++ <mppp:installation>` installation
2222
instructions).
2323

24-
On the Python side, heyoka.py requires at least Python 3.5 and depends on:
24+
On the Python side, heyoka.py requires at least Python 3.9 and depends on:
2525

26-
* `NumPy <https://numpy.org/>`__ (version <2, **mandatory**),
26+
* `NumPy <https://numpy.org/>`__ (version >=2, **mandatory**),
2727
* `cloudpickle <https://github.com/cloudpipe/cloudpickle>`__ (**mandatory**),
2828
* `SymPy <https://www.sympy.org/en/index.html>`__ (version >=1.13.0) and `mpmath <https://mpmath.org/>`__
2929
(*optional*, for converting heyoka.py expressions to/from SymPy expressions),

doc/notebooks/arbitrary_precision.ipynb

+5-5
Large diffs are not rendered by default.

doc/notebooks/ext_precision.ipynb

+7-11
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)