Skip to content

Commit

Permalink
update minimum python and build against numpy 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jcapriot committed Oct 12, 2024
1 parent 381ddf4 commit 0360d70
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 50 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/test_with_conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,5 @@ geoana/kernels/_extensions/potential_field_prism_api.h

# setuptools_scm
geoana/version.py

.idea/
38 changes: 3 additions & 35 deletions geoana/kernels/_extensions/meson.build
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]
Expand Down
15 changes: 5 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@
[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]
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 = '[email protected]'},
]
Expand All @@ -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",
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 0360d70

Please sign in to comment.