Skip to content

Commit

Permalink
update FastAPI version lower limit to >0.107.0 and adapt for new st…
Browse files Browse the repository at this point in the history
…arlette version
  • Loading branch information
vincentsarago committed Jan 8, 2024
1 parent 2e03692 commit 1e7b484
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).

Note: Minor version `0.X.0` update might break the API, It's recommended to pin `tipg` to minor version: `tipg>=0.1,<0.2`

## [unreleased]

- update FastAPI version lower limit to `>0.107.0` and adapt for new starlette version

## [0.5.7] - 2024-01-08

- add `tags` to all routes
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies = [
"orjson",
"asyncpg>=0.23.0",
"buildpg>=0.3",
"fastapi>=0.100.0,<0.107.0",
"fastapi>=0.107.0",
"jinja2>=2.11.2,<4.0.0",
"morecantile>=5.0,<6.0",
"pydantic>=2.4,<3.0",
Expand Down
9 changes: 5 additions & 4 deletions tipg/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@
mvt_settings = MVTSettings()
features_settings = FeaturesSettings()

DEFAULT_TEMPLATES = Jinja2Templates(
directory="",
loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")]),
) # type:ignore

jinja2_env = jinja2.Environment(
loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")])
)
DEFAULT_TEMPLATES = Jinja2Templates(env=jinja2_env)


COMMON_CONFORMS = [
Expand Down
6 changes: 2 additions & 4 deletions tipg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@ async def lifespan(app: FastAPI):
# default template directory
templates_location.append(jinja2.PackageLoader(__package__, "templates"))

templates = Jinja2Templates(
directory="", # we need to set a dummy directory variable, see https://github.com/encode/starlette/issues/1214
loader=jinja2.ChoiceLoader(templates_location),
) # type: ignore
jinja2_env = jinja2.Environment(loader=jinja2.ChoiceLoader(templates_location))
templates = Jinja2Templates(env=jinja2_env)

ogc_api = Endpoints(
title=settings.name,
Expand Down

0 comments on commit 1e7b484

Please sign in to comment.