Skip to content
This repository was archived by the owner on Sep 19, 2023. It is now read-only.

Commit 9772a10

Browse files
committed
fix for python <3.12
1 parent e5003a2 commit 9772a10

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

src/titiler/extensions/pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ classifiers = [
3030
]
3131
dynamic = ["version"]
3232
dependencies = [
33-
"titiler-core==2.0.0dev0"
33+
"titiler-core==2.0.0dev0",
34+
"typing-extensions; python_version < '3.12'"
3435
]
3536

3637
[project.optional-dependencies]

src/titiler/extensions/titiler/extensions/stac.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
"""rio-stac Extension."""
22

3-
from typing import Annotated, Any, Literal, TypedDict
3+
import sys
4+
from typing import Annotated, Any, Literal
45

56
from attrs import define
67
from fastapi import Depends, Query
78

89
from titiler.core.factory import FactoryExtension, TilerFactory
910

11+
# Ref: https://docs.pydantic.dev/2.12/errors/usage_errors/#typed-dict-version
12+
if sys.version_info >= (3, 12):
13+
from typing import TypedDict
14+
else:
15+
from typing_extensions import TypedDict
16+
1017
try:
1118
import pystac
1219
from pystac.utils import datetime_to_str, str_to_datetime

src/titiler/xarray/titiler/xarray/extensions.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"""titiler.xarray Extensions."""
22

3+
import sys
34
import warnings
45
from collections.abc import Callable
5-
from typing import Annotated, TypedDict
6+
from typing import Annotated
67

78
import xarray
89
from attrs import define
@@ -17,6 +18,12 @@
1718
from titiler.xarray.factory import TilerFactory
1819
from titiler.xarray.io import X_DIM_NAMES, Y_DIM_NAMES, open_zarr
1920

21+
# Ref: https://docs.pydantic.dev/2.12/errors/usage_errors/#typed-dict-version
22+
if sys.version_info >= (3, 12):
23+
from typing import TypedDict
24+
else:
25+
from typing_extensions import TypedDict
26+
2027

2128
@define
2229
class VariablesExtension(FactoryExtension):

uv.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)