From 6fe4a09d5d418981e4b8e8825e88abefa9d5b8af Mon Sep 17 00:00:00 2001 From: dcherian Date: Tue, 31 Jan 2023 15:20:55 -0700 Subject: [PATCH 01/12] Drop 3.8, support 3.11 --- .github/workflows/ci.yaml | 4 ++-- ci/doc.yml | 2 +- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2ed8a66c..563b8be1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,7 +27,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest"] - python-version: ["3.8", "3.10"] + python-version: ["3.9", "3.11"] steps: - uses: actions/checkout@v3 with: @@ -133,7 +133,7 @@ jobs: run: shell: bash -l {0} env: - PYTHON_VERSION: "3.10" + PYTHON_VERSION: "3.11" steps: - uses: actions/checkout@v3 with: diff --git a/ci/doc.yml b/ci/doc.yml index 4b8620ce..4ed670a8 100644 --- a/ci/doc.yml +++ b/ci/doc.yml @@ -3,7 +3,7 @@ channels: - conda-forge dependencies: - pip - - python=3.8 + - python=3.11 - matplotlib-base - netcdf4 - pooch diff --git a/pyproject.toml b/pyproject.toml index a9044ec3..1d0c404d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,9 +11,9 @@ classifiers = [ "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", ] dependencies = [ "xarray", From 12e96b3f2591b862b3fa5b4b7028174b61f1a102 Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Thu, 2 Feb 2023 09:41:57 -0700 Subject: [PATCH 02/12] Update pyproject.toml --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0d3a611c..67c0a12f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,10 +55,10 @@ write_to_template= '__version__ = "{version}"' tag_regex= "^(?Pv)?(?P[^\\+]+)(?P.*)?$" [tool.black] -target-version = ["py38"] +target-version = ["py39"] [tool.ruff] -target-version = "py38" +target-version = "py39" builtins = ["ellipsis"] exclude = [ ".eggs", From 828558985083260ba9f21d8cafae42a8d9de06ae Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 2 Feb 2023 16:42:38 +0000 Subject: [PATCH 03/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- cf_xarray/accessor.py | 3 +-- cf_xarray/criteria.py | 4 ++-- cf_xarray/utils.py | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cf_xarray/accessor.py b/cf_xarray/accessor.py index cc8617d9..0a5a7599 100644 --- a/cf_xarray/accessor.py +++ b/cf_xarray/accessor.py @@ -12,7 +12,6 @@ Callable, Hashable, Iterable, - List, Mapping, MutableMapping, Sequence, @@ -66,7 +65,7 @@ ATTRS["vertical"] = ATTRS["Z"] # Type for Mapper functions -Mapper = Callable[[Union[DataArray, Dataset], Hashable], List[Hashable]] +Mapper = Callable[[Union[DataArray, Dataset], Hashable], list[Hashable]] # Type for decorators F = TypeVar("F", bound=Callable[..., Any]) diff --git a/cf_xarray/criteria.py b/cf_xarray/criteria.py index be65592d..07ab4412 100644 --- a/cf_xarray/criteria.py +++ b/cf_xarray/criteria.py @@ -6,13 +6,13 @@ import re -from typing import Mapping, MutableMapping, Tuple +from typing import Mapping, MutableMapping cf_role_criteria: Mapping[str, Mapping[str, str]] = { k: {"cf_role": k} for k in ("timeseries_id", "profile_id", "trajectory_id") } -coordinate_criteria: MutableMapping[str, MutableMapping[str, Tuple]] = { +coordinate_criteria: MutableMapping[str, MutableMapping[str, tuple]] = { "latitude": { "standard_name": ("latitude",), "units": ( diff --git a/cf_xarray/utils.py b/cf_xarray/utils.py index 9322effc..8f79c882 100644 --- a/cf_xarray/utils.py +++ b/cf_xarray/utils.py @@ -1,6 +1,6 @@ import os from collections import defaultdict -from typing import Any, Dict, Iterable +from typing import Any, Iterable from xml.etree import ElementTree import numpy as np @@ -43,7 +43,7 @@ def _is_datetime_like(da: DataArray) -> bool: return False -def parse_cell_methods_attr(attr: str) -> Dict[str, str]: +def parse_cell_methods_attr(attr: str) -> dict[str, str]: """ Parse cell_methods attributes (format is 'measure: name'). From fd57bce7313920600d7572a38a190443107da1b3 Mon Sep 17 00:00:00 2001 From: dcherian Date: Fri, 3 Feb 2023 08:58:42 -0700 Subject: [PATCH 04/12] Revert "Update pyproject.toml" This reverts commit 12e96b3f2591b862b3fa5b4b7028174b61f1a102. --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 67c0a12f..0d3a611c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,10 +55,10 @@ write_to_template= '__version__ = "{version}"' tag_regex= "^(?Pv)?(?P[^\\+]+)(?P.*)?$" [tool.black] -target-version = ["py39"] +target-version = ["py38"] [tool.ruff] -target-version = "py39" +target-version = "py38" builtins = ["ellipsis"] exclude = [ ".eggs", From 9aaae66c453805978bed4e479ab4e1d95fb5b603 Mon Sep 17 00:00:00 2001 From: dcherian Date: Fri, 3 Feb 2023 08:58:51 -0700 Subject: [PATCH 05/12] Revert "[pre-commit.ci] auto fixes from pre-commit.com hooks" This reverts commit 828558985083260ba9f21d8cafae42a8d9de06ae. --- cf_xarray/accessor.py | 3 ++- cf_xarray/criteria.py | 4 ++-- cf_xarray/utils.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cf_xarray/accessor.py b/cf_xarray/accessor.py index 0a5a7599..cc8617d9 100644 --- a/cf_xarray/accessor.py +++ b/cf_xarray/accessor.py @@ -12,6 +12,7 @@ Callable, Hashable, Iterable, + List, Mapping, MutableMapping, Sequence, @@ -65,7 +66,7 @@ ATTRS["vertical"] = ATTRS["Z"] # Type for Mapper functions -Mapper = Callable[[Union[DataArray, Dataset], Hashable], list[Hashable]] +Mapper = Callable[[Union[DataArray, Dataset], Hashable], List[Hashable]] # Type for decorators F = TypeVar("F", bound=Callable[..., Any]) diff --git a/cf_xarray/criteria.py b/cf_xarray/criteria.py index 07ab4412..be65592d 100644 --- a/cf_xarray/criteria.py +++ b/cf_xarray/criteria.py @@ -6,13 +6,13 @@ import re -from typing import Mapping, MutableMapping +from typing import Mapping, MutableMapping, Tuple cf_role_criteria: Mapping[str, Mapping[str, str]] = { k: {"cf_role": k} for k in ("timeseries_id", "profile_id", "trajectory_id") } -coordinate_criteria: MutableMapping[str, MutableMapping[str, tuple]] = { +coordinate_criteria: MutableMapping[str, MutableMapping[str, Tuple]] = { "latitude": { "standard_name": ("latitude",), "units": ( diff --git a/cf_xarray/utils.py b/cf_xarray/utils.py index 8f79c882..9322effc 100644 --- a/cf_xarray/utils.py +++ b/cf_xarray/utils.py @@ -1,6 +1,6 @@ import os from collections import defaultdict -from typing import Any, Iterable +from typing import Any, Dict, Iterable from xml.etree import ElementTree import numpy as np @@ -43,7 +43,7 @@ def _is_datetime_like(da: DataArray) -> bool: return False -def parse_cell_methods_attr(attr: str) -> dict[str, str]: +def parse_cell_methods_attr(attr: str) -> Dict[str, str]: """ Parse cell_methods attributes (format is 'measure: name'). From dd372a6b17ec08d58e1a59f513587ca8241a38b4 Mon Sep 17 00:00:00 2001 From: dcherian Date: Fri, 3 Feb 2023 09:02:15 -0700 Subject: [PATCH 06/12] Keep 3.8 --- .github/workflows/ci.yaml | 11 +++++------ .github/workflows/upstream-dev-ci.yaml | 2 +- pyproject.toml | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 563b8be1..430420f5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,7 +27,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest"] - python-version: ["3.9", "3.11"] + python-version: ["3.8", "3.11"] steps: - uses: actions/checkout@v3 with: @@ -116,8 +116,6 @@ jobs: environment-file: ci/environment-no-optional-deps.yml environment-name: cf_xarray_test cache-env: true - extra-specs: | - python="${{ matrix.python-version }}" - name: Install cf_xarray run: | python -m pip install --no-deps -e . @@ -132,8 +130,9 @@ jobs: defaults: run: shell: bash -l {0} - env: - PYTHON_VERSION: "3.11" + strategy: + matrix: + python-version: ["3.8", "3.11"] steps: - uses: actions/checkout@v3 with: @@ -145,7 +144,7 @@ jobs: environment-name: cf_xarray_test cache-env: true extra-specs: | - python="${{ env.PYTHON_VERSION }}" + python="${{ matrix.python-version }}" - name: Install cf_xarray run: | python -m pip install --no-deps -e . diff --git a/.github/workflows/upstream-dev-ci.yaml b/.github/workflows/upstream-dev-ci.yaml index 2905475d..134d1710 100644 --- a/.github/workflows/upstream-dev-ci.yaml +++ b/.github/workflows/upstream-dev-ci.yaml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10"] + python-version: ["3.11"] steps: - uses: actions/checkout@v3 with: diff --git a/pyproject.toml b/pyproject.toml index 0d3a611c..7eb6bbb0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,7 @@ classifiers = [ "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", + "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", From d9f0ea4b11a11992a872963227890c9199aec6f0 Mon Sep 17 00:00:00 2001 From: dcherian Date: Fri, 3 Feb 2023 09:08:17 -0700 Subject: [PATCH 07/12] Try again --- ci/environment.yml | 1 + ci/upstream-dev-env.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ci/environment.yml b/ci/environment.yml index 7f1d6f75..05495fed 100644 --- a/ci/environment.yml +++ b/ci/environment.yml @@ -14,6 +14,7 @@ dependencies: - pint - pooch - regex + - rich - scipy - shapely - xarray diff --git a/ci/upstream-dev-env.yml b/ci/upstream-dev-env.yml index 8e0b5b9b..81cc3051 100644 --- a/ci/upstream-dev-env.yml +++ b/ci/upstream-dev-env.yml @@ -10,7 +10,9 @@ dependencies: - netcdf4 - pandas - pooch + - rich - shapely + - pip - pip - pytest-pretty - git+https://github.com/pydata/xarray From 5b9ed9d48d676c25047b38873ec6df2d9b6e2467 Mon Sep 17 00:00:00 2001 From: dcherian Date: Fri, 3 Feb 2023 09:12:01 -0700 Subject: [PATCH 08/12] Try again --- .github/workflows/upstream-dev-ci.yaml | 2 +- ci/upstream-dev-env.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/upstream-dev-ci.yaml b/.github/workflows/upstream-dev-ci.yaml index e08089c8..13cd1922 100644 --- a/.github/workflows/upstream-dev-ci.yaml +++ b/.github/workflows/upstream-dev-ci.yaml @@ -42,9 +42,9 @@ jobs: with: environment-file: ci/upstream-dev-env.yml environment-name: cf_xarray_test + cache-env: False extra-specs: | python="${{ matrix.python-version }}" - pytest-reportlog - name: Install cf_xarray run: | python -m pip install --no-deps -e . diff --git a/ci/upstream-dev-env.yml b/ci/upstream-dev-env.yml index 81cc3051..eb7aae75 100644 --- a/ci/upstream-dev-env.yml +++ b/ci/upstream-dev-env.yml @@ -5,6 +5,7 @@ dependencies: - pytest-cov - pytest - pytest-xdist + - pytest-reportlog - dask - matplotlib-base - netcdf4 From bff65690d68c51cda9fb54cbf9bb0efeddfa4950 Mon Sep 17 00:00:00 2001 From: dcherian Date: Fri, 3 Feb 2023 09:14:00 -0700 Subject: [PATCH 09/12] Fix again --- ci/upstream-dev-env.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/upstream-dev-env.yml b/ci/upstream-dev-env.yml index eb7aae75..be53fdf8 100644 --- a/ci/upstream-dev-env.yml +++ b/ci/upstream-dev-env.yml @@ -16,6 +16,6 @@ dependencies: - pip - pip - pytest-pretty - - git+https://github.com/pydata/xarray - - git+https://github.com/dcherian/flox - - git+https://github.com/hgrecco/pint + - git+https://github.com/pydata/xarray.git + - git+https://github.com/dcherian/flox.git + - git+https://github.com/hgrecco/pint.git From 59a5df1443f323f6ea8bbd47b0f978b730258365 Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Fri, 3 Feb 2023 09:23:58 -0700 Subject: [PATCH 10/12] Update upstream-dev-ci.yaml --- .github/workflows/upstream-dev-ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upstream-dev-ci.yaml b/.github/workflows/upstream-dev-ci.yaml index 13cd1922..37b7df5d 100644 --- a/.github/workflows/upstream-dev-ci.yaml +++ b/.github/workflows/upstream-dev-ci.yaml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.11"] + python-version: ["3.10"] steps: - uses: actions/checkout@v3 with: From d5cf69c35b4ececee1859939bdd766634d934446 Mon Sep 17 00:00:00 2001 From: dcherian Date: Fri, 3 Feb 2023 12:07:40 -0700 Subject: [PATCH 11/12] Fix typo --- ci/upstream-dev-env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/upstream-dev-env.yml b/ci/upstream-dev-env.yml index be53fdf8..364b071e 100644 --- a/ci/upstream-dev-env.yml +++ b/ci/upstream-dev-env.yml @@ -14,7 +14,7 @@ dependencies: - rich - shapely - pip - - pip + - pip: - pytest-pretty - git+https://github.com/pydata/xarray.git - git+https://github.com/dcherian/flox.git From 55ec0839196f3e6bf6ec8053a0819fe2591ce45c Mon Sep 17 00:00:00 2001 From: dcherian Date: Fri, 3 Feb 2023 12:10:46 -0700 Subject: [PATCH 12/12] try 3.11 --- .github/workflows/upstream-dev-ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upstream-dev-ci.yaml b/.github/workflows/upstream-dev-ci.yaml index 37b7df5d..13cd1922 100644 --- a/.github/workflows/upstream-dev-ci.yaml +++ b/.github/workflows/upstream-dev-ci.yaml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10"] + python-version: ["3.11"] steps: - uses: actions/checkout@v3 with: