Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump min Python to 3.10 #40

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
environment-file: ["environment.yaml"]
defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies = [
"xarray",
"pystac>=1.0.1",
]
requires-python = ">=3.8"
requires-python = ">=3.10"
description = "Extend xarray.open_dataset to accept pystac objects"
license = {text = "MIT"}
readme = "README.md"
Expand Down
3 changes: 1 addition & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import importlib
from typing import Optional

import pytest
from packaging.version import Version


# Copied from https://github.com/zarr-developers/VirtualiZarr/blob/9c3d0f90cc79fa20fe33833e244ae28a1ee91f17/virtualizarr/tests/__init__.py#L17-L34
def _importorskip(
modname: str, minversion: Optional[str] = None
modname: str, minversion: str | None = None
) -> tuple[bool, pytest.MarkDecorator]:
try:
mod = importlib.import_module(modname)
Expand Down
13 changes: 7 additions & 6 deletions xpystac/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import functools
from typing import List, Literal, Mapping, Union
from collections.abc import Mapping
from typing import Literal

import pystac
import xarray
Expand All @@ -10,7 +11,7 @@
@functools.singledispatch
def to_xarray(
obj,
stacking_library: Union[Literal["odc.stac", "stackstac"], None] = None,
stacking_library: Literal["odc.stac", "stackstac"] | None = None,
**kwargs,
) -> xarray.Dataset:
"""Given a PySTAC object return an xarray dataset.
Expand Down Expand Up @@ -43,9 +44,9 @@ def to_xarray(
@to_xarray.register(pystac.Item)
@to_xarray.register(pystac.ItemCollection)
def _(
obj: Union[pystac.Item, pystac.ItemCollection],
drop_variables: Union[str, List[str], None] = None,
stacking_library: Union[Literal["odc.stac", "stackstac"], None] = None,
obj: pystac.Item | pystac.ItemCollection,
drop_variables: str | list[str] | None = None,
stacking_library: Literal["odc.stac", "stackstac"] | None = None,
**kwargs,
) -> xarray.Dataset:
if drop_variables is not None:
Expand Down Expand Up @@ -86,7 +87,7 @@ def _(
@to_xarray.register
def _(
obj: pystac.Asset,
stacking_library: Union[Literal["odc.stac", "stackstac"], None] = None,
stacking_library: Literal["odc.stac", "stackstac"] | None = None,
**kwargs,
) -> xarray.Dataset:
default_kwargs: Mapping = {"chunks": {}}
Expand Down
7 changes: 4 additions & 3 deletions xpystac/xarray_plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Iterable, Literal, Union
from collections.abc import Iterable
from typing import Any, Literal

import pystac
from xarray.backends import BackendEntrypoint
Expand All @@ -15,8 +16,8 @@ class STACBackend(BackendEntrypoint):
def open_dataset(
self,
filename_or_obj: Any,
drop_variables: Union[str, Iterable[str], None] = None,
stacking_library: Union[Literal["odc.stac", "stackstac"], None] = None,
drop_variables: str | Iterable[str] | None = None,
stacking_library: Literal["odc.stac", "stackstac"] | None = None,
**kwargs,
):
"""Given a PySTAC object return an xarray dataset
Expand Down