Skip to content

Commit cae6318

Browse files
committed
update fastapi
1 parent fc12bd6 commit cae6318

File tree

6 files changed

+24
-36
lines changed

6 files changed

+24
-36
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ on:
1616
- 'dockerfiles/**'
1717
pull_request:
1818
env:
19-
LATEST_PY_VERSION: '3.9'
19+
LATEST_PY_VERSION: '3.19'
2020

2121
jobs:
2222
tests:
2323
runs-on: ubuntu-latest
2424
strategy:
2525
matrix:
26-
python-version: ['3.7', '3.8', '3.9', '3.10']
26+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
2727

2828
steps:
29-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v3
3030
- name: Set up Python ${{ matrix.python-version }}
31-
uses: actions/setup-python@v2
31+
uses: actions/setup-python@v4
3232
with:
3333
python-version: ${{ matrix.python-version }}
3434

@@ -67,9 +67,9 @@ jobs:
6767
needs: [tests]
6868
runs-on: ubuntu-latest
6969
steps:
70-
- uses: actions/checkout@v2
70+
- uses: actions/checkout@v3
7171
- name: Set up Python
72-
uses: actions/setup-python@v1
72+
uses: actions/setup-python@v4
7373
with:
7474
python-version: ${{ env.LATEST_PY_VERSION }}
7575

@@ -109,9 +109,9 @@ jobs:
109109
runs-on: ubuntu-latest
110110
if: contains(github.ref, 'tags') && github.event_name == 'push'
111111
steps:
112-
- uses: actions/checkout@v2
112+
- uses: actions/checkout@v3
113113
- name: Set up Python
114-
uses: actions/setup-python@v1
114+
uses: actions/setup-python@v4
115115
with:
116116
python-version: ${{ env.LATEST_PY_VERSION }}
117117

@@ -144,7 +144,7 @@ jobs:
144144
runs-on: ubuntu-latest
145145
steps:
146146
- name: Checkout
147-
uses: actions/checkout@v2
147+
uses: actions/checkout@v3
148148

149149
- name: Set up QEMU
150150
uses: docker/setup-qemu-action@v1

.github/workflows/deploy_mkdocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout master
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v3
2121

2222
- name: Set up Python 3.8
23-
uses: actions/setup-python@v2
23+
uses: actions/setup-python@v4
2424
with:
2525
python-version: 3.8
2626

CHANGES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
* add `TIMVT_FUNCTIONS_DIRECTORY` environment variable to look for function SQL files
1313
* switch viewer to Maplibre
1414
* add `Point` and `LineString` feature support in viewer
15-
* Update dockerfiles to python3.10 and postgres14-postgis3.2
15+
* Update dockerfiles to python3.10 and postgres14-postgis3.3
16+
* update FastAPI requirement to >0.87
17+
* remove endpoint Tags
1618

1719
**breaking changes**
1820

dockerfiles/Dockerfile.db

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM ghcr.io/vincentsarago/postgis:14-3.2
1+
FROM ghcr.io/vincentsarago/postgis:14-3.3
22

33
COPY data/*.sql /docker-entrypoint-initdb.d/

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dynamic = ["version"]
2222
dependencies = [
2323
"asyncpg>=0.23.0",
2424
"buildpg>=0.3",
25-
"fastapi>=0.73",
25+
"fastapi>=0.87",
2626
"jinja2>=2.11.2,<4.0.0",
2727
"morecantile>=3.1,<4.0",
2828
"starlette-cramjam>=0.3,<0.4",
@@ -38,7 +38,7 @@ test = [
3838
"pytest-cov",
3939
"pytest-asyncio",
4040
"pytest-benchmark",
41-
"requests",
41+
"httpx",
4242
"psycopg2",
4343
"pytest-pgsql",
4444
"mapbox-vector-tile",

timvt/factory.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ def __post_init__(self):
8686

8787
def register_routes(self):
8888
"""Register Routes."""
89-
self.register_tiles()
90-
9189
if self.with_tables_metadata:
9290
self.register_tables_metadata()
9391

@@ -97,6 +95,8 @@ def register_routes(self):
9795
if self.with_viewer:
9896
self.register_viewer()
9997

98+
self.register_tiles()
99+
100100
def url_for(self, request: Request, name: str, **path_params: Any) -> str:
101101
"""Return full url (with prefix) for a specific endpoint."""
102102
url_path = self.router.url_path_for(name, **path_params)
@@ -109,15 +109,9 @@ def register_tiles(self):
109109
"""Register /tiles endpoints."""
110110

111111
@self.router.get(
112-
"/tiles/{layer}/{z}/{x}/{y}",
113-
**TILE_RESPONSE_PARAMS,
114-
tags=["Tiles"],
115-
)
116-
@self.router.get(
117-
"/tiles/{TileMatrixSetId}/{layer}/{z}/{x}/{y}",
118-
**TILE_RESPONSE_PARAMS,
119-
tags=["Tiles"],
112+
"/tiles/{TileMatrixSetId}/{layer}/{z}/{x}/{y}", **TILE_RESPONSE_PARAMS
120113
)
114+
@self.router.get("/tiles/{layer}/{z}/{x}/{y}", **TILE_RESPONSE_PARAMS)
121115
async def tile(
122116
request: Request,
123117
tile: Tile = Depends(TileParams),
@@ -135,18 +129,16 @@ async def tile(
135129
return Response(bytes(content), media_type=MimeTypes.pbf.value)
136130

137131
@self.router.get(
138-
"/{layer}/tilejson.json",
132+
"/{TileMatrixSetId}/{layer}/tilejson.json",
139133
response_model=TileJSON,
140134
responses={200: {"description": "Return a tilejson"}},
141135
response_model_exclude_none=True,
142-
tags=["Tiles"],
143136
)
144137
@self.router.get(
145-
"/{TileMatrixSetId}/{layer}/tilejson.json",
138+
"/{layer}/tilejson.json",
146139
response_model=TileJSON,
147140
responses={200: {"description": "Return a tilejson"}},
148141
response_model_exclude_none=True,
149-
tags=["Tiles"],
150142
)
151143
async def tilejson(
152144
request: Request,
@@ -202,7 +194,6 @@ def register_tables_metadata(self):
202194
"/tables.json",
203195
response_model=List[Table],
204196
response_model_exclude_none=True,
205-
tags=["Tables"],
206197
)
207198
async def tables_index(request: Request):
208199
"""Index of tables."""
@@ -226,7 +217,6 @@ def _get_tiles_url(id) -> Optional[str]:
226217
response_model=Table,
227218
responses={200: {"description": "Return table metadata"}},
228219
response_model_exclude_none=True,
229-
tags=["Tables"],
230220
)
231221
async def table_metadata(
232222
request: Request,
@@ -253,7 +243,6 @@ def register_functions_metadata(self): # noqa
253243
response_model=List[Function],
254244
response_model_exclude_none=True,
255245
response_model_exclude={"sql"},
256-
tags=["Functions"],
257246
)
258247
async def functions_index(request: Request):
259248
"""Index of functions."""
@@ -280,7 +269,6 @@ def _get_tiles_url(id) -> Optional[str]:
280269
responses={200: {"description": "Return Function metadata"}},
281270
response_model_exclude_none=True,
282271
response_model_exclude={"sql"},
283-
tags=["Functions"],
284272
)
285273
async def function_metadata(
286274
request: Request,
@@ -302,9 +290,7 @@ def _get_tiles_url(id) -> Optional[str]:
302290
def register_viewer(self):
303291
"""Register viewer."""
304292

305-
@self.router.get(
306-
"/{layer}/viewer", response_class=HTMLResponse, tags=["Viewer"]
307-
)
293+
@self.router.get("/{layer}/viewer", response_class=HTMLResponse)
308294
async def demo(request: Request, layer=Depends(LayerParams)):
309295
"""Demo for each table."""
310296
tile_url = self.url_for(request, "tilejson", layer=layer.id)

0 commit comments

Comments
 (0)