From 0360d70edaf5d8c306371c8f7ded45f5c668e49f Mon Sep 17 00:00:00 2001 From: Joseph Capriotti Date: Sat, 12 Oct 2024 16:21:42 -0600 Subject: [PATCH] update minimum python and build against numpy 2.0 --- .github/workflows/test_with_conda.yml | 8 ++---- .gitignore | 2 ++ geoana/kernels/_extensions/meson.build | 38 ++------------------------ pyproject.toml | 15 ++++------ 4 files changed, 13 insertions(+), 50 deletions(-) diff --git a/.github/workflows/test_with_conda.yml b/.github/workflows/test_with_conda.yml index 2ffd461b..447bd031 100644 --- a/.github/workflows/test_with_conda.yml +++ b/.github/workflows/test_with_conda.yml @@ -28,14 +28,12 @@ jobs: environment-name: geoana-test create-args: >- python=${{ matrix.python-version }} - numpy>=1.20 + numpy>=2.0.0rc1 scipy>=1.8 libdlf - cython + cython>=3.0.8 setuptools_scm - meson-python>=0.14.0 - meson - ninja + meson-python>=0.15.0 build discretize matplotlib diff --git a/.gitignore b/.gitignore index 0ed7dd09..1c44a0ee 100644 --- a/.gitignore +++ b/.gitignore @@ -106,3 +106,5 @@ geoana/kernels/_extensions/potential_field_prism_api.h # setuptools_scm geoana/version.py + +.idea/ diff --git a/geoana/kernels/_extensions/meson.build b/geoana/kernels/_extensions/meson.build index ac2c4d0c..23e32aad 100644 --- a/geoana/kernels/_extensions/meson.build +++ b/geoana/kernels/_extensions/meson.build @@ -1,38 +1,7 @@ + # NumPy include directory -# The try-except is needed because when things are -# split across drives on Windows, there is no relative path and an exception -# gets raised. There may be other such cases, so add a catch-all and switch to -# an absolute path. Relative paths are needed when for example a virtualenv is -# placed inside the source tree; Meson rejects absolute paths to places inside -# the source tree. -# For cross-compilation it is often not possible to run the Python interpreter -# in order to retrieve numpy's include directory. It can be specified in the -# cross file instead: -# [properties] -# numpy-include-dir = /abspath/to/host-pythons/site-packages/numpy/core/include -# -# This uses the path as is, and avoids running the interpreter. -incdir_numpy = meson.get_external_property('numpy-include-dir', 'not-given') -if incdir_numpy == 'not-given' - incdir_numpy = run_command(py, - [ - '-c', - '''import os -import numpy as np -try: - incdir = os.path.relpath(np.get_include()) -except Exception: - incdir = np.get_include() -print(incdir) - ''' - ], - check: true - ).stdout().strip() -else - _incdir_numpy_abs = incdir_numpy -endif -inc_np = include_directories(incdir_numpy) -np_dep = declare_dependency(include_directories: inc_np) +np_dep = dependency('numpy') +numpy_nodepr_api = ['-DNPY_NO_DEPRECATED_API=NPY_1_9_API_VERSION'] # Deal with M_PI & friends; add `use_math_defines` to c_args or cpp_args # Cython doesn't always get this right itself (see, e.g., gh-16800), so @@ -44,7 +13,6 @@ else use_math_defines = [] endif -numpy_nodepr_api = '-DNPY_NO_DEPRECATED_API=NPY_1_9_API_VERSION' c_undefined_ok = ['-Wno-maybe-uninitialized'] cython_c_args = [numpy_nodepr_api, use_math_defines] diff --git a/pyproject.toml b/pyproject.toml index fb119ce1..38d6d115 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,13 +2,10 @@ [build-system] build-backend = 'mesonpy' requires = [ - "meson-python>=0.14.0", - "Cython>=0.29.35", # when updating version, also update check in meson.build + "meson-python>=0.15.0", + "Cython>=3.0.8", "setuptools_scm[toml]>=6.2", - - # This package automatically provides all of the numpy pinning for different python - # versions and runtime requirements. - "oldest-supported-numpy", + "numpy>=2.0.0rc1", ] [project] @@ -16,7 +13,7 @@ name = 'geoana' dynamic = ["version"] description = 'Analytic expressions for geophysical responses' readme = 'README.rst' -requires-python = '>=3.8' +requires-python = '>=3.10' authors = [ {name = 'SimPEG developers', email = 'lindseyheagy@gmail.com'}, ] @@ -28,8 +25,6 @@ keywords = [ # release branches, see: # https://scipy.github.io/devdocs/dev/core-dev/index.html#version-ranges-for-numpy-and-other-dependencies dependencies = [ - # TODO: update to "pin-compatible" once possible, see - # https://github.com/mesonbuild/meson-python/issues/29 "numpy>=1.22.4", "scipy>=1.8", "libdlf", @@ -95,7 +90,7 @@ Repository = 'https://github.com/simpeg/geoana.git' # skip building wheels for python 3.6, 3.7, all pypy versions, and specialty linux # processors (still does arm builds though). # skip windows 32bit -skip = "cp36-* cp37-* pp* *_ppc64le *_i686 *_s390x *-win32 cp38-musllinux_* *-musllinux_aarch64" +skip = "cp36-* cp37-* cp38-* cp39-* pp* *_ppc64le *_i686 *_s390x *-win32 cp38-musllinux_* *-musllinux_aarch64" build-verbosity = "3" # test importing geoana to make sure externals are loadable.