File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44from contextlib import asynccontextmanager
55from typing import Dict
66
7+ import jinja2
78import pystac
89from eoapi .raster import __version__ as eoapi_raster_version
910from eoapi .raster .config import ApiSettings
3637)
3738from titiler .pgstac .reader import PgSTACReader
3839
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-
4540logging .getLogger ("botocore.credentials" ).disabled = True
4641logging .getLogger ("botocore.utils" ).disabled = True
4742logging .getLogger ("rio-tiler" ).setLevel (logging .ERROR )
4843
4944settings = ApiSettings ()
5045
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 )
5354
5455
5556@asynccontextmanager
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ classifiers = [
1919]
2020dynamic = [" version" ]
2121dependencies = [
22- " titiler.pgstac==1.0.0a3 " ,
22+ " titiler.pgstac==1.1.0 " ,
2323 " titiler.extensions" ,
2424 " starlette-cramjam>=0.3,<0.4" ,
2525 " 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):
6464)
6565
6666# add eoapi_vector templates and tipg templates
67- templates = Jinja2Templates ( # type: ignore
68- directory = "" ,
67+ jinja2_env = jinja2 .Environment (
6968 loader = jinja2 .ChoiceLoader (
7069 [
7170 jinja2 .PackageLoader (__package__ , "templates" ),
7271 jinja2 .PackageLoader ("tipg" , "templates" ),
7372 ]
74- ),
73+ )
7574)
75+ templates = Jinja2Templates (env = jinja2_env )
7676
7777# Register TiPg endpoints.
7878endpoints = TiPgEndpoints (
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ classifiers = [
1919]
2020dynamic = [" version" ]
2121dependencies = [
22- " tipg==0.5 .0" ,
22+ " tipg==0.6 .0" ,
2323]
2424
2525[project .optional-dependencies ]
You can’t perform that action at this time.
0 commit comments