File tree Expand file tree Collapse file tree 4 files changed +14
-13
lines changed Expand file tree Collapse file tree 4 files changed +14
-13
lines changed Original file line number Diff line number Diff line change 4
4
from contextlib import asynccontextmanager
5
5
from typing import Dict
6
6
7
+ import jinja2
7
8
import pystac
8
9
from eoapi .raster import __version__ as eoapi_raster_version
9
10
from eoapi .raster .config import ApiSettings
36
37
)
37
38
from titiler .pgstac .reader import PgSTACReader
38
39
39
- try :
40
- from importlib .resources import files as resources_files # type: ignore
41
- except ImportError :
42
- # Try backported to PY<39 `importlib_resources`.
43
- from importlib_resources import files as resources_files # type: ignore
44
-
45
40
logging .getLogger ("botocore.credentials" ).disabled = True
46
41
logging .getLogger ("botocore.utils" ).disabled = True
47
42
logging .getLogger ("rio-tiler" ).setLevel (logging .ERROR )
48
43
49
44
settings = ApiSettings ()
50
45
51
- # TODO: mypy fails in python 3.9, we need to find a proper way to do this
52
- templates = Jinja2Templates (directory = str (resources_files (__package__ ) / "templates" )) # type: ignore
46
+ jinja2_env = jinja2 .Environment (
47
+ loader = jinja2 .ChoiceLoader (
48
+ [
49
+ jinja2 .PackageLoader (__package__ , "templates" ),
50
+ ]
51
+ )
52
+ )
53
+ templates = Jinja2Templates (env = jinja2_env )
53
54
54
55
55
56
@asynccontextmanager
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ classifiers = [
19
19
]
20
20
dynamic = [" version" ]
21
21
dependencies = [
22
- " titiler.pgstac==1.0.0a3 " ,
22
+ " titiler.pgstac==1.1.0 " ,
23
23
" titiler.extensions" ,
24
24
" starlette-cramjam>=0.3,<0.4" ,
25
25
" importlib_resources>=1.1.0;python_version<'3.9'" ,
Original file line number Diff line number Diff line change @@ -64,15 +64,15 @@ async def lifespan(app: FastAPI):
64
64
)
65
65
66
66
# add eoapi_vector templates and tipg templates
67
- templates = Jinja2Templates ( # type: ignore
68
- directory = "" ,
67
+ jinja2_env = jinja2 .Environment (
69
68
loader = jinja2 .ChoiceLoader (
70
69
[
71
70
jinja2 .PackageLoader (__package__ , "templates" ),
72
71
jinja2 .PackageLoader ("tipg" , "templates" ),
73
72
]
74
- ),
73
+ )
75
74
)
75
+ templates = Jinja2Templates (env = jinja2_env )
76
76
77
77
# Register TiPg endpoints.
78
78
endpoints = TiPgEndpoints (
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ classifiers = [
19
19
]
20
20
dynamic = [" version" ]
21
21
dependencies = [
22
- " tipg==0.5 .0" ,
22
+ " tipg==0.6 .0" ,
23
23
]
24
24
25
25
[project .optional-dependencies ]
You can’t perform that action at this time.
0 commit comments