From 12993487ec0035ae92892dc811a26f447291ac10 Mon Sep 17 00:00:00 2001 From: Francois Colleoni Date: Wed, 19 Jun 2024 15:10:15 +0200 Subject: [PATCH] MAINT: NumPy 2.0 compatibility --- .github/workflows/python-package.yml | 2 +- README.md | 2 +- examples/optional_string/test.py | 4 ++-- f90wrap/scripts/f2py_f90wrap.py | 2 +- pyproject.toml | 8 ++++++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 81a86606..164050ad 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.7, 3.8, 3.9, '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index 094ddc5b..ae75531a 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ please contact James Kermode Dependencies ------------ - 1. [Python](http://www.python.org) 3.7+ (Python 2.7 no longer supported) + 1. [Python](http://www.python.org) 3.8+ (Python 2.7 no longer supported) 2. Recent version of [numpy](http://www.numpy.org) which includes `f2py` 3. Fortran compiler - tested with `gfortran` 4.6+ and recent `ifort` 12+ diff --git a/examples/optional_string/test.py b/examples/optional_string/test.py index 07e95083..e597f79d 100644 --- a/examples/optional_string/test.py +++ b/examples/optional_string/test.py @@ -10,10 +10,10 @@ def test_string_in_1(self): m_string_test.string_in('yo') def test_string_in_2(self): - m_string_test.string_in(np.unicode_('yo')) + m_string_test.string_in(np.str_('yo')) def test_string_in_3(self): - m_string_test.string_in(np.string_('yo')) + m_string_test.string_in(np.bytes_('yo')) def test_string_to_string(self): in_string = 'yo' diff --git a/f90wrap/scripts/f2py_f90wrap.py b/f90wrap/scripts/f2py_f90wrap.py index 286a90ed..fdb555b2 100644 --- a/f90wrap/scripts/f2py_f90wrap.py +++ b/f90wrap/scripts/f2py_f90wrap.py @@ -72,7 +72,7 @@ def main(): if(sys.platform == 'win32'): includes_inject = includes_inject + "#include // fix https://github.com/jameskermode/f90wrap/issues/73 \n#include // fix https://github.com/jameskermode/f90wrap/issues/96\n" else: - includes_inject = includes_inject + "#include \n" + includes_inject = includes_inject + "#include \n#include \n" includes_inject = includes_inject + """ #define ABORT_BUFFER_SIZE 1024 diff --git a/pyproject.toml b/pyproject.toml index 9fedc543..3198b238 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,17 @@ [build-system] # Minimum requirements for the build system to execute. -requires = ["meson-python>=0.12.0", "oldest-supported-numpy"] +requires = [ + "meson-python>=0.12.0", + "oldest-supported-numpy; python_version=='3.8'", + "numpy>=2.0.0; python_version>='3.9'", +] build-backend = 'mesonpy' [project] name = "f90wrap" description = "Fortran to Python interface generator with derived type support" authors = [{name = "James Kermode", email = "james.kermode@gmail.com"}] -python-requires = ">=3.6" +python-requires = ">=3.8" urls = {Homepage = "https://github.com/jameskermode/f90wrap"} dependencies = ["numpy>=1.13", "packaging"] dynamic = ["version"]