Skip to content

Commit 9094e71

Browse files
authored
Bump min Python to 3.10 (#40)
And run `pyupgrade --py310-plus **/*.py`
1 parent 466152f commit 9094e71

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
os: [ubuntu-latest]
27-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
27+
python-version: ["3.10", "3.11", "3.12", "3.13"]
2828
environment-file: ["environment.yaml"]
2929
defaults:
3030
run:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies = [
1414
"xarray",
1515
"pystac>=1.0.1",
1616
]
17-
requires-python = ">=3.8"
17+
requires-python = ">=3.10"
1818
description = "Extend xarray.open_dataset to accept pystac objects"
1919
license = {text = "MIT"}
2020
readme = "README.md"

tests/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import importlib
2-
from typing import Optional
32

43
import pytest
54
from packaging.version import Version
65

76

87
# Copied from https://github.com/zarr-developers/VirtualiZarr/blob/9c3d0f90cc79fa20fe33833e244ae28a1ee91f17/virtualizarr/tests/__init__.py#L17-L34
98
def _importorskip(
10-
modname: str, minversion: Optional[str] = None
9+
modname: str, minversion: str | None = None
1110
) -> tuple[bool, pytest.MarkDecorator]:
1211
try:
1312
mod = importlib.import_module(modname)

xpystac/core.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import functools
2-
from typing import List, Literal, Mapping, Union
2+
from collections.abc import Mapping
3+
from typing import Literal
34

45
import pystac
56
import xarray
@@ -10,7 +11,7 @@
1011
@functools.singledispatch
1112
def to_xarray(
1213
obj,
13-
stacking_library: Union[Literal["odc.stac", "stackstac"], None] = None,
14+
stacking_library: Literal["odc.stac", "stackstac"] | None = None,
1415
**kwargs,
1516
) -> xarray.Dataset:
1617
"""Given a PySTAC object return an xarray dataset.
@@ -43,9 +44,9 @@ def to_xarray(
4344
@to_xarray.register(pystac.Item)
4445
@to_xarray.register(pystac.ItemCollection)
4546
def _(
46-
obj: Union[pystac.Item, pystac.ItemCollection],
47-
drop_variables: Union[str, List[str], None] = None,
48-
stacking_library: Union[Literal["odc.stac", "stackstac"], None] = None,
47+
obj: pystac.Item | pystac.ItemCollection,
48+
drop_variables: str | list[str] | None = None,
49+
stacking_library: Literal["odc.stac", "stackstac"] | None = None,
4950
**kwargs,
5051
) -> xarray.Dataset:
5152
if drop_variables is not None:
@@ -86,7 +87,7 @@ def _(
8687
@to_xarray.register
8788
def _(
8889
obj: pystac.Asset,
89-
stacking_library: Union[Literal["odc.stac", "stackstac"], None] = None,
90+
stacking_library: Literal["odc.stac", "stackstac"] | None = None,
9091
**kwargs,
9192
) -> xarray.Dataset:
9293
default_kwargs: Mapping = {"chunks": {}}

xpystac/xarray_plugin.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Iterable, Literal, Union
1+
from collections.abc import Iterable
2+
from typing import Any, Literal
23

34
import pystac
45
from xarray.backends import BackendEntrypoint
@@ -15,8 +16,8 @@ class STACBackend(BackendEntrypoint):
1516
def open_dataset(
1617
self,
1718
filename_or_obj: Any,
18-
drop_variables: Union[str, Iterable[str], None] = None,
19-
stacking_library: Union[Literal["odc.stac", "stackstac"], None] = None,
19+
drop_variables: str | Iterable[str] | None = None,
20+
stacking_library: Literal["odc.stac", "stackstac"] | None = None,
2021
**kwargs,
2122
):
2223
"""Given a PySTAC object return an xarray dataset

0 commit comments

Comments
 (0)