Skip to content

Commit a3ab0d0

Browse files
committed
update tipg version
1 parent 3560a04 commit a3ab0d0

File tree

4 files changed

+44
-56
lines changed

4 files changed

+44
-56
lines changed

.github/workflows/tests/test_vector.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,13 @@ def test_vector_api():
8686
assert item["id"] == "noaa-emergency-response"
8787

8888
# OGC Tiles
89-
resp = httpx.get(f"{vector_endpoint}/collections/public.my_data/tiles/0/0/0")
89+
resp = httpx.get(
90+
f"{vector_endpoint}/collections/public.my_data/tiles/WebMercatorQuad/0/0/0"
91+
)
9092
assert resp.status_code == 200
9193

9294
resp = httpx.get(
93-
f"{vector_endpoint}/collections/pg_temp.pgstac_collections_view/tilejson.json"
95+
f"{vector_endpoint}/collections/pg_temp.pgstac_collections_view/tiles/WebMercatorQuad/tilejson.json"
9496
)
9597
assert resp.status_code == 200
9698

infrastructure/handlers/vector_handler.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,35 @@
1010
from mangum import Mangum
1111
from tipg.collections import register_collection_catalog
1212
from tipg.database import connect_to_db
13+
from tipg.settings import DatabaseSettings
1314

1415
logging.getLogger("mangum.lifespan").setLevel(logging.ERROR)
1516
logging.getLogger("mangum.http").setLevel(logging.ERROR)
1617

1718

1819
CUSTOM_SQL_DIRECTORY = resources_files("eoapi.vector") / "sql"
19-
sql_files = list(CUSTOM_SQL_DIRECTORY.glob("*.sql")) # type: ignore
20+
21+
db_settings = DatabaseSettings(
22+
# For the Tables' Catalog we only use the `public` schema
23+
schemas=["public"],
24+
# We exclude public functions
25+
exclude_function_schemas=["public"],
26+
# We allow non-spatial tables
27+
spatial=False,
28+
)
2029

2130

2231
@app.on_event("startup")
2332
async def startup_event() -> None:
2433
"""Connect to database on startup."""
2534
await connect_to_db(
2635
app,
27-
settings=PostgresSettings(),
2836
# We enable both pgstac and public schemas (pgstac will be used by custom functions)
2937
schemas=["pgstac", "public"],
30-
user_sql_files=sql_files,
31-
)
32-
await register_collection_catalog(
33-
app,
34-
# For the Tables' Catalog we only use the `public` schema
35-
schemas=["public"],
36-
# We exclude public functions
37-
exclude_function_schemas=["public"],
38-
# We allow non-spatial tables
39-
spatial=False,
38+
user_sql_files=list(CUSTOM_SQL_DIRECTORY.glob("*.sql")), # type: ignore
39+
settings=PostgresSettings(),
4040
)
41+
await register_collection_catalog(app, db_settings=db_settings)
4142

4243

4344
handler = Mangum(app, lifespan="off")

runtimes/eoapi/vector/eoapi/vector/app.py

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from tipg.errors import DEFAULT_STATUS_CODES, add_exception_handlers
1616
from tipg.factory import Endpoints as TiPgEndpoints
1717
from tipg.middleware import CacheControlMiddleware, CatalogUpdateMiddleware
18+
from tipg.settings import DatabaseSettings
1819

1920
from . import __version__ as eoapi_vector_version
2021
from .config import ApiSettings, PostgresSettings
@@ -24,25 +25,18 @@
2425

2526
settings = ApiSettings()
2627
auth_settings = OpenIdConnectSettings()
28+
db_settings = DatabaseSettings(
29+
# For the Tables' Catalog we only use the `public` schema
30+
schemas=["public"],
31+
# We exclude public functions
32+
exclude_function_schemas=["public"],
33+
# We allow non-spatial tables
34+
spatial=False,
35+
)
36+
2737

2838
# Logs
29-
init_logging(
30-
debug=settings.debug,
31-
loggers={
32-
"botocore.credentials": {
33-
"level": "CRITICAL",
34-
"propagate": False,
35-
},
36-
"botocore.utils": {
37-
"level": "CRITICAL",
38-
"propagate": False,
39-
},
40-
"rio-tiler": {
41-
"level": "ERROR",
42-
"propagate": False,
43-
},
44-
},
45-
)
39+
init_logging(debug=settings.debug)
4640
logger = logging.getLogger(__name__)
4741

4842

@@ -52,22 +46,14 @@ async def lifespan(app: FastAPI):
5246
logger.debug("Connecting to db...")
5347
await connect_to_db(
5448
app,
55-
settings=PostgresSettings(),
5649
# We enable both pgstac and public schemas (pgstac will be used by custom functions)
5750
schemas=["pgstac", "public"],
5851
user_sql_files=list(CUSTOM_SQL_DIRECTORY.glob("*.sql")), # type: ignore
52+
settings=PostgresSettings(),
5953
)
6054

6155
logger.debug("Registering collection catalog...")
62-
await register_collection_catalog(
63-
app,
64-
# For the Tables' Catalog we only use the `public` schema
65-
schemas=["public"],
66-
# We exclude public functions
67-
exclude_function_schemas=["public"],
68-
# We allow non-spatial tables
69-
spatial=False,
70-
)
56+
await register_collection_catalog(app, db_settings=db_settings)
7157

7258
yield
7359

@@ -126,9 +112,7 @@ async def lifespan(app: FastAPI):
126112
CatalogUpdateMiddleware,
127113
func=register_collection_catalog,
128114
ttl=settings.catalog_ttl,
129-
schemas=["public"],
130-
exclude_function_schemas=["public"],
131-
spatial=False,
115+
db_settings=db_settings,
132116
)
133117

134118
add_exception_handlers(app, DEFAULT_STATUS_CODES)
@@ -143,7 +127,17 @@ async def lifespan(app: FastAPI):
143127
)
144128
def ping():
145129
"""Health check."""
146-
return {"ping": "pong!"}
130+
from pyproj import __proj_version__ as proj_version # noqa
131+
from pyproj import __version__ as pyproj_version # noqa
132+
from tipg import __version__ as tipg_version # noqa
133+
134+
return {
135+
"versions": {
136+
"tipg": tipg_version,
137+
"proj": proj_version,
138+
"pyproj": pyproj_version,
139+
},
140+
}
147141

148142

149143
if settings.debug:
@@ -156,16 +150,7 @@ async def raw_catalog(request: Request):
156150
@app.get("/refresh", include_in_schema=False)
157151
async def refresh(request: Request):
158152
"""Return parsed catalog data for testing."""
159-
await register_collection_catalog(
160-
request.app,
161-
# For the Tables' Catalog we only use the `public` schema
162-
schemas=["public"],
163-
# We exclude public functions
164-
exclude_function_schemas=["public"],
165-
# We allow non-spatial tables
166-
spatial=False,
167-
)
168-
153+
await register_collection_catalog(request.app, db_settings=db_settings)
169154
return request.app.state.collection_catalog
170155

171156

runtimes/eoapi/vector/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ classifiers = [
2020
]
2121
dynamic = ["version"]
2222
dependencies = [
23-
"tipg==0.9.0",
23+
"tipg==1.0.1",
2424
"eoapi.auth-utils>=0.2.0",
2525
"boto3"
2626
]

0 commit comments

Comments
 (0)