Skip to content

Commit

Permalink
Merge tag '0.1.5' into develop
Browse files Browse the repository at this point in the history
0.1.5
  • Loading branch information
oiffrig committed Nov 4, 2024
2 parents 2bf35db + 3a5deff commit 2e64589
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.1.5 - 2024-11-04

* Fix `ImportError` with Python >= 3.13

## 0.1.4 - 2024-10-21

* Add `--skip` options to `earthkit-dateseq previous/next`
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "earthkit-time"
version = "0.1.4"
version = "0.1.5"
requires-python = ">= 3.8"
description = "Date and time manipulation routines for the use of weather data"
license = {file = "LICENSE"}
Expand Down
12 changes: 8 additions & 4 deletions src/earthkit/time/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
import os
import pathlib
from importlib import resources
from typing import Optional, TextIO, Tuple
import types
from typing import Optional, TextIO, Tuple, Union

import yaml

# importlib.resources.Packages is removed from Python >= 3.13
Package = Union[types.ModuleType, str]

PACKAGE = "earthkit.time.data"


Expand All @@ -17,16 +21,16 @@ def _extract_package(path: str) -> Tuple[str, str]:
return (PACKAGE + "." + ".".join(parts[:-1])), parts[-1]


def _is_resource(package: resources.Package, name: str) -> bool:
def _is_resource(package: Package, name: str) -> bool:
if hasattr(resources, "files"): # Python >= 3.9
return resources.files(package).joinpath(name).is_file()
else:
return resources.is_resource(package, name)


def _open_text(
package: resources.Package,
resource: resources.Resource,
package: Package,
resource: str,
encoding: str = "utf-8",
errors: str = "strict",
) -> TextIO:
Expand Down

0 comments on commit 2e64589

Please sign in to comment.