From 2eb8ef7fe31b71e1e33ea5ccfd54942bacbdeaec Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Fri, 22 Mar 2024 16:20:44 -0700 Subject: [PATCH 01/12] Extend support to Python 3.12 Bump Python version in CI to check if all tests pass and documentation builds properly in the latest version of Python. --- .github/workflows/docs.yml | 2 +- .github/workflows/style.yml | 2 +- .github/workflows/test.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d7b16bf47..b7e88604a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -33,7 +33,7 @@ jobs: runs-on: ubuntu-latest env: REQUIREMENTS: env/requirements-build.txt env/requirements-docs.txt - PYTHON: "3.11" + PYTHON: "3.12" steps: diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 8f21efc13..cb92f1fd5 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -27,7 +27,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Install requirements run: pip install -r env/requirements-style.txt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 35077777f..009ed23aa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,9 +46,9 @@ jobs: - dependencies: oldest python: "3.8" - dependencies: latest - python: "3.11" + python: "3.12" - dependencies: optional - python: "3.11" + python: "3.12" env: REQUIREMENTS: env/requirements-build.txt env/requirements-tests.txt # Used to tag codecov submissions From d2c0b85faa622780ebdc2a1aac40d6d9a090d3ab Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Fri, 22 Mar 2024 16:24:04 -0700 Subject: [PATCH 02/12] Bump Python version in pypi.yml --- .github/workflows/pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 2da07f1b8..dc183a538 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -49,7 +49,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.12" - name: Install requirements run: python -m pip install -r env/requirements-build.txt From 3d66f2b03b4bde0b4e8e1b9ddfaf16a54623cd4b Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Fri, 22 Mar 2024 16:24:19 -0700 Subject: [PATCH 03/12] Bump Python version in environment.yml --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index ce1534393..aa4d15cf8 100644 --- a/environment.yml +++ b/environment.yml @@ -2,7 +2,7 @@ name: harmonica channels: - conda-forge dependencies: - - python==3.10.* + - python==3.12.* - pip # Build - build From c5b74e0578010e7fe756ed4fbdd0e033609103cc Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Tue, 11 Jun 2024 15:01:09 -0700 Subject: [PATCH 04/12] Replace 3.11 for 3.12 in style Action --- .github/workflows/style.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index cb92f1fd5..d5829a710 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -49,7 +49,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Install requirements run: pip install -r env/requirements-style.txt From c8f29de460f12fea5b66d26b60357000b586a58f Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Tue, 11 Jun 2024 15:01:23 -0700 Subject: [PATCH 05/12] Add 3.12 to list of classifiers in pyproject.toml --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 5734f718f..ea961d9ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ] requires-python = ">=3.8" dependencies = [ From 5210afa532704126f4cfe01a5f4370070b9c5830 Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Tue, 11 Jun 2024 15:03:50 -0700 Subject: [PATCH 06/12] Require verde >= 1.8.1 --- environment.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index 5724510d4..56f6ccf7c 100644 --- a/environment.yml +++ b/environment.yml @@ -13,7 +13,7 @@ dependencies: - numba - scipy - scikit-learn - - verde>=1.7.0 + - verde>=1.8.1 - xarray - xrft>=1.0 - choclo>=0.1 diff --git a/pyproject.toml b/pyproject.toml index ea961d9ff..12c900d3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ dependencies = [ "scikit-learn >= 0.24", "numba >= 0.52", "xarray >= 0.16", - "verde >= 1.7", + "verde >= 1.8.1", "xrft >= 1.0", "choclo >= 0.1", ] From 96fbef1c724f216c98dccba37bae0fc0ba1164aa Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Mon, 17 Jun 2024 13:18:54 -0700 Subject: [PATCH 07/12] Bump Numpy minimum version to 1.23 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c955b7ee5..7cdd43eeb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] requires-python = ">=3.9" dependencies = [ - "numpy >= 1.21", + "numpy >= 1.23", "pandas >= 1.4", "scipy >= 1.9", "scikit-learn >= 0.24", From eaa73583bdc9bc2678c97286200fd73bf0c943c6 Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Mon, 17 Jun 2024 13:44:29 -0700 Subject: [PATCH 08/12] Bump minimum versions for sklearn and xarray Use the same minimum versions as Verde --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7cdd43eeb..bfd1ae1f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,9 +32,9 @@ dependencies = [ "numpy >= 1.23", "pandas >= 1.4", "scipy >= 1.9", - "scikit-learn >= 0.24", + "scikit-learn >= 1.0", "numba >= 0.53", - "xarray >= 0.16", + "xarray >= 2022.03", "verde >= 1.8.1", "xrft >= 1.0", "choclo >= 0.1", From a3370725c704dc5bac8d59b9b8a028786e7c5a18 Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Mon, 17 Jun 2024 15:41:17 -0700 Subject: [PATCH 09/12] Require Numpy < 2.0.0 We can fix the issues with Numpy 2.0.0 in a separate PR. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bfd1ae1f5..390256bbd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] requires-python = ">=3.9" dependencies = [ - "numpy >= 1.23", + "numpy >= 1.23 < 2.0.0", "pandas >= 1.4", "scipy >= 1.9", "scikit-learn >= 1.0", From 41c40041e5ecf6921ded29a731241d58a84f540b Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Mon, 17 Jun 2024 15:58:49 -0700 Subject: [PATCH 10/12] Fix syntax for specifying versions in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 390256bbd..20239bbc2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] requires-python = ">=3.9" dependencies = [ - "numpy >= 1.23 < 2.0.0", + "numpy >= 1.23, < 2.0.0", "pandas >= 1.4", "scipy >= 1.9", "scikit-learn >= 1.0", From 2083afe71b660821bd0c9855dc88adc926102f48 Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Tue, 18 Jun 2024 08:58:00 -0700 Subject: [PATCH 11/12] Update examples in docstrings to support Numpy 2 Convert Numpy scalars to Python numbers so the outputs of examples that are being compared when running doctests support Numpy>=2.0. --- harmonica/_equivalent_sources/gradient_boosted.py | 5 +++-- harmonica/_forward/prism_layer.py | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/harmonica/_equivalent_sources/gradient_boosted.py b/harmonica/_equivalent_sources/gradient_boosted.py index 2e8968978..336cb4537 100644 --- a/harmonica/_equivalent_sources/gradient_boosted.py +++ b/harmonica/_equivalent_sources/gradient_boosted.py @@ -142,7 +142,7 @@ def estimate_required_memory(self, coordinates): Returns ------- - memory_required : float + memory_required : int Amount of memory required to store the largest Jacobian matrix in bytes. @@ -157,7 +157,8 @@ def estimate_required_memory(self, coordinates): ... random_state=42, ... ) >>> eqs = EquivalentSourcesGB(window_size=2e3) - >>> eqs.estimate_required_memory(coordinates) + >>> n_bytes = eqs.estimate_required_memory(coordinates) + >>> int(n_bytes) 9800 """ # Build the sources and assign the points_ attribute diff --git a/harmonica/_forward/prism_layer.py b/harmonica/_forward/prism_layer.py index 4267c0147..1c73507d6 100644 --- a/harmonica/_forward/prism_layer.py +++ b/harmonica/_forward/prism_layer.py @@ -107,11 +107,13 @@ def prism_layer( coords_units: meters properties_units: SI >>> # Get the boundaries of the layer (will exceed the region) - >>> print(prisms.prism_layer.boundaries) - (-1.25, 11.25, 1.0, 9.0) + >>> boundaries = prisms.prism_layer.boundaries + >>> list(float(b) for b in boundaries) + [-1.25, 11.25, 1.0, 9.0] >>> # Get the boundaries of one of the prisms - >>> print(prisms.prism_layer.get_prism((0, 2))) - (3.75, 6.25, 1.0, 3.0, 0.0, 2.0) + >>> prism = prisms.prism_layer.get_prism((0, 2)) + >>> list(float(b) for b in prism) + [3.75, 6.25, 1.0, 3.0, 0.0, 2.0] """ # noqa: W505 dims = ("northing", "easting") # Initialize data and data_names as None From 1e6daf873ff56c5e253948354ab560b56c0785ac Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Tue, 18 Jun 2024 10:00:44 -0700 Subject: [PATCH 12/12] Unpin Numpy 2.0 in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 20239bbc2..bfd1ae1f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] requires-python = ">=3.9" dependencies = [ - "numpy >= 1.23, < 2.0.0", + "numpy >= 1.23", "pandas >= 1.4", "scipy >= 1.9", "scikit-learn >= 1.0",