From 353ba7d8ea20307e8b444ead69098cdde9114b62 Mon Sep 17 00:00:00 2001 From: Tennessee Leeuwenburg Date: Fri, 24 Apr 2026 13:56:38 +1000 Subject: [PATCH 1/5] Updates for the 0.6.0 release to work around what I think is a way to create a copy of a dataset --- CITATION.cff | 2 +- .../src/pyearthtools/data/transforms/mask.py | 6 ++-- .../pipeline/operations/xarray/reshape.py | 3 +- .../operations/xarray/test_xarray_reshape.py | 5 ---- pyproject.toml | 30 +++++++++---------- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 0b69a54d..232df0de 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -82,4 +82,4 @@ license: message: If you use this software, please cite it using the metadata from this file. title: "PyEarthTools: Machine learning for Earth system science" type: software -version: 0.5.1 +version: 0.6.0 diff --git a/packages/data/src/pyearthtools/data/transforms/mask.py b/packages/data/src/pyearthtools/data/transforms/mask.py index b6f14854..eb9286c7 100644 --- a/packages/data/src/pyearthtools/data/transforms/mask.py +++ b/packages/data/src/pyearthtools/data/transforms/mask.py @@ -108,9 +108,11 @@ def __filter( operator_package = np if isinstance(data, (xr.Dataset, xr.DataArray)): operator_package = xr - data = type(data)(data) # type: ignore + # data = type(data)(data) # type: ignore + data = data.copy() if search_data is not None: - search_data = type(search_data)(search_data) # type: ignore + # search_data = type(search_data)(search_data) # type: ignore + search_data = search_data.copy() operations_dict = { ">": operator.gt, diff --git a/packages/pipeline/src/pyearthtools/pipeline/operations/xarray/reshape.py b/packages/pipeline/src/pyearthtools/pipeline/operations/xarray/reshape.py index d748672a..4c469669 100644 --- a/packages/pipeline/src/pyearthtools/pipeline/operations/xarray/reshape.py +++ b/packages/pipeline/src/pyearthtools/pipeline/operations/xarray/reshape.py @@ -214,7 +214,8 @@ def __init__(self, coordinate: Hashable): self._coordinate = coordinate def apply_func(self, dataset: xr.Dataset) -> xr.Dataset | xr.DataArray: - dataset = type(dataset)(dataset) + # dataset = type(dataset)(dataset) # this is the problem line + dataset = dataset.copy() for coord in self._coordinate: dtype = dataset.attrs.get(f"{coord}-dtype", "int32") diff --git a/packages/pipeline/tests/operations/xarray/test_xarray_reshape.py b/packages/pipeline/tests/operations/xarray/test_xarray_reshape.py index 3c275da9..250bc494 100644 --- a/packages/pipeline/tests/operations/xarray/test_xarray_reshape.py +++ b/packages/pipeline/tests/operations/xarray/test_xarray_reshape.py @@ -118,11 +118,6 @@ def test_CoordinateFlatten_skip_missing(): def test_undo_CoordinateFlatten(): - - import sys - - print(f"Recursion limit set to {str(sys.getrecursionlimit())}") - f = reshape.CoordinateFlatten(["height"]) f_output = f.apply(SIMPLE_DS2) f_undone = f.undo(f_output) diff --git a/pyproject.toml b/pyproject.toml index cf05f1d9..97af055c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,35 +26,35 @@ PyEarthTools: Machine learning for Earth system science. version = "0.6.0" dependencies = [ -"pyearthtools-utils>=0.5.1", -"pyearthtools-data>=0.5.1", -"pyearthtools-pipeline>=0.5.1", -"pyearthtools-training>=0.5.1", -"pyearthtools-zoo>=0.5.1", +"pyearthtools-utils>=0.6.0", +"pyearthtools-data>=0.6.0", +"pyearthtools-pipeline>=0.6.0", +"pyearthtools-training>=0.6.0", +"pyearthtools-zoo>=0.6.0", ] [project.optional-dependencies] utils = [ - "pyearthtools-utils>=0.5.1", + "pyearthtools-utils>=0.6.0", ] data = [ - "pyearthtools-data>=0.5.1", + "pyearthtools-data>=0.6.0", ] pipeline = [ - "pyearthtools-pipeline>=0.5.1", + "pyearthtools-pipeline>=0.6.0", ] training = [ - "pyearthtools-training>=0.5.1", + "pyearthtools-training>=0.6.0", ] zoo = [ - "pyearthtools-zoo>=0.5.1", + "pyearthtools-zoo>=0.6.0", ] all = [ - "pyearthtools-utils>=0.5.1", - "pyearthtools-data[all]>=0.5.1", - "pyearthtools-pipeline[all]>=0.5.1", - "pyearthtools-training[all]>=0.5.1", - "pyearthtools-zoo>=0.5.1", + "pyearthtools-utils>=0.6.0", + "pyearthtools-data[all]>=0.6.0", + "pyearthtools-pipeline[all]>=0.6.0", + "pyearthtools-training[all]>=0.6.0", + "pyearthtools-zoo>=0.6.0", ] test = ["pytest", "pytest-cov", "pytest-xdist"] dev = ["pre-commit", "black==25.1.0", "interrogate", "ruff", "pudb"] From 3fc26abe081d320b26658356b61f4324bfd2ec9d Mon Sep 17 00:00:00 2001 From: Tennessee Leeuwenburg Date: Fri, 24 Apr 2026 14:56:45 +1000 Subject: [PATCH 2/5] Small code tidyups --- packages/data/src/pyearthtools/data/transforms/mask.py | 1 - packages/pipeline/src/pyearthtools/pipeline/exceptions.py | 3 --- .../src/pyearthtools/pipeline/operations/xarray/reshape.py | 1 - 3 files changed, 5 deletions(-) diff --git a/packages/data/src/pyearthtools/data/transforms/mask.py b/packages/data/src/pyearthtools/data/transforms/mask.py index eb9286c7..f796df46 100644 --- a/packages/data/src/pyearthtools/data/transforms/mask.py +++ b/packages/data/src/pyearthtools/data/transforms/mask.py @@ -108,7 +108,6 @@ def __filter( operator_package = np if isinstance(data, (xr.Dataset, xr.DataArray)): operator_package = xr - # data = type(data)(data) # type: ignore data = data.copy() if search_data is not None: # search_data = type(search_data)(search_data) # type: ignore diff --git a/packages/pipeline/src/pyearthtools/pipeline/exceptions.py b/packages/pipeline/src/pyearthtools/pipeline/exceptions.py index 09a8f40c..d7c3fc0f 100644 --- a/packages/pipeline/src/pyearthtools/pipeline/exceptions.py +++ b/packages/pipeline/src/pyearthtools/pipeline/exceptions.py @@ -102,9 +102,6 @@ def __enter__(self): def __exit__(self, exc_type, exc_val, traceback): - # if exc_type: - # import pudb; pudb.set_trace() - if exc_type in self._exceptions: self._count += 1 self._messages.append(str(exc_val)) diff --git a/packages/pipeline/src/pyearthtools/pipeline/operations/xarray/reshape.py b/packages/pipeline/src/pyearthtools/pipeline/operations/xarray/reshape.py index 4c469669..89959b92 100644 --- a/packages/pipeline/src/pyearthtools/pipeline/operations/xarray/reshape.py +++ b/packages/pipeline/src/pyearthtools/pipeline/operations/xarray/reshape.py @@ -214,7 +214,6 @@ def __init__(self, coordinate: Hashable): self._coordinate = coordinate def apply_func(self, dataset: xr.Dataset) -> xr.Dataset | xr.DataArray: - # dataset = type(dataset)(dataset) # this is the problem line dataset = dataset.copy() for coord in self._coordinate: From d351c45348b7a9147cfee53304bcbdf67cecbde6 Mon Sep 17 00:00:00 2001 From: Tennessee Leeuwenburg Date: Tue, 28 Apr 2026 21:32:09 +1000 Subject: [PATCH 3/5] Skip installing dependencies during run-pre-commit, think this should happen later --- .github/workflows/run-pre-commit.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/run-pre-commit.yml b/.github/workflows/run-pre-commit.yml index 48a16282..12323ded 100644 --- a/.github/workflows/run-pre-commit.yml +++ b/.github/workflows/run-pre-commit.yml @@ -23,7 +23,6 @@ jobs: run: | python -m pip install --upgrade pip pip install pyogrio - pip install .[dev] - name: pre-commit checks run: | pre-commit run black --all-files From df174dae197d7db2735569ebf5e1d13b7fc58a1c Mon Sep 17 00:00:00 2001 From: Tennessee Leeuwenburg Date: Tue, 28 Apr 2026 21:34:51 +1000 Subject: [PATCH 4/5] Remove 'interrogate' workflow - not being utilised --- .github/workflows/interrogate.yml | 39 ------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 .github/workflows/interrogate.yml diff --git a/.github/workflows/interrogate.yml b/.github/workflows/interrogate.yml deleted file mode 100644 index 319a3dd1..00000000 --- a/.github/workflows/interrogate.yml +++ /dev/null @@ -1,39 +0,0 @@ -# This workflow will install and run the interrogate package to check for missing docstrings - -name: Run interrogate - -on: pull_request - -permissions: - contents: read - -jobs: - interrogate: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: "3.13" - - name: Install dev dependencies - run: | - python -m pip install --upgrade pip - pip install pyogrio - pip install .[dev] - - name: interrogate checks - run: | - interrogate -v --fail-under 40 --exclude "*/__init__.py" --exclude "*/__main__.py" --output docstring-coverage.txt --generate-badge interrogate-badge.svg - ls -l - - name: Upload docstring-coverage - uses: actions/upload-artifact@v4 - with: - name: docstring-coverage - path: docstring-coverage.txt - if-no-files-found: warn - - name: Upload interrogate badge - uses: actions/upload-artifact@v4 - with: - name: interrogate-badge - path: interrogate-badge.svg - if-no-files-found: warn From cacb950fa4d89d099a807daa7dff5d1398aaa43a Mon Sep 17 00:00:00 2001 From: Tennessee Leeuwenburg Date: Tue, 28 Apr 2026 21:40:10 +1000 Subject: [PATCH 5/5] Updates to install pre-commit dependencies directly in the workflow rather than leveraging pyproject.toml --- .github/workflows/run-pre-commit.yml | 1 + pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-pre-commit.yml b/.github/workflows/run-pre-commit.yml index 12323ded..4bfd98fe 100644 --- a/.github/workflows/run-pre-commit.yml +++ b/.github/workflows/run-pre-commit.yml @@ -23,6 +23,7 @@ jobs: run: | python -m pip install --upgrade pip pip install pyogrio + pip install pre-commit ruff black - name: pre-commit checks run: | pre-commit run black --all-files diff --git a/pyproject.toml b/pyproject.toml index 97af055c..631ec0d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ all = [ "pyearthtools-zoo>=0.6.0", ] test = ["pytest", "pytest-cov", "pytest-xdist"] -dev = ["pre-commit", "black==25.1.0", "interrogate", "ruff", "pudb"] +dev = ["pre-commit", "black==25.1.0", "ruff", "pudb"] docs = [ "sphinx", "myst-parser",