Skip to content

Commit

Permalink
Merge branch 'main' into user/elay/add-function-app-to-generate-banne…
Browse files Browse the repository at this point in the history
…d-ip
  • Loading branch information
elay committed Jun 20, 2024
2 parents bc69adb + 3b1e9f7 commit 20b7fa4
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 35 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
- azurite
- redis
command: >
bash -c "pypgstac pgready && uvicorn pcstac.main:app --host 0.0.0.0 --port 8081 --reload --proxy-headers"
bash -c "pypgstac pgready && uvicorn pcstac.main:app --host 0.0.0.0 --port 8081 --reload --proxy-headers --root-path '/stac'"
tiler:
image: pc-apis-tiler
Expand Down
4 changes: 2 additions & 2 deletions pccommon/pccommon/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def dump(sas: str, account: str, table: str, type: str, **kwargs: Any) -> int:
assert col_config
result[id] = col_config.dict()
else:
for (_, collection_id, col_config) in col_config_table.get_all():
for _, collection_id, col_config in col_config_table.get_all():
assert collection_id
assert col_config
result[collection_id] = col_config.dict()
Expand All @@ -87,7 +87,7 @@ def dump(sas: str, account: str, table: str, type: str, **kwargs: Any) -> int:
assert con_config
result[f"{con_account}/{id}"] = con_config.dict()
else:
for (storage_account, container, con_config) in con_config_table.get_all():
for storage_account, container, con_config in con_config_table.get_all():
assert con_config
result[f"{storage_account}/{container}"] = con_config.dict()
else:
Expand Down
3 changes: 2 additions & 1 deletion pccommon/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,13 @@ pyjwt[crypto]==2.8.0
# via msal
redis==4.6.0
# via pccommon (pccommon/setup.py)
requests==2.31.0
requests==2.32.3
# via
# azure-core
# google-api-core
# msal
# opencensus-ext-azure
# pccommon (pccommon/setup.py)
rsa==4.9
# via google-auth
six==1.16.0
Expand Down
1 change: 1 addition & 0 deletions pccommon/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"types-cachetools==4.2.9",
"pyhumps==3.5.3",
"redis==4.6.0",
"requests==2.32.3",
"idna>=3.7.0",
"html-sanitizer==2.4.4",
# Soon available as lxml[html_clean]
Expand Down
12 changes: 4 additions & 8 deletions pcfuncs/funclib/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,16 @@ def __init__(self, extent: RasterExtent) -> None:
self.extent = extent

@abstractmethod
def to_bytes(self, format: str = ExportFormats.PNG) -> io.BytesIO:
...
def to_bytes(self, format: str = ExportFormats.PNG) -> io.BytesIO: ...

@abstractmethod
def crop(self: T, bbox: Bbox) -> T:
...
def crop(self: T, bbox: Bbox) -> T: ...

@abstractmethod
def resample(self: T, cols: int, rows: int) -> T:
...
def resample(self: T, cols: int, rows: int) -> T: ...

@abstractmethod
def mask(self: T, geom: Dict[str, Any]) -> T:
...
def mask(self: T, geom: Dict[str, Any]) -> T: ...


class PILRaster(Raster):
Expand Down
3 changes: 1 addition & 2 deletions pcfuncs/funclib/tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ def get_tile_url(self, z: int, x: int, y: int) -> str:
return url

@abstractmethod
async def get_mosaic(self, tiles: List[Tile]) -> T:
...
async def get_mosaic(self, tiles: List[Tile]) -> T: ...

@staticmethod
def get_covering_tiles(
Expand Down
4 changes: 2 additions & 2 deletions pcfuncs/requirements-deploy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

azure-functions

requests==2.31.0
aiohttp==3.8.1
requests==2.32.3
aiohttp==3.9.5
dateutils==0.6.12
mercantile==1.2.1
pillow==10.3.0
Expand Down
4 changes: 2 additions & 2 deletions pcfuncs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

azure-functions

requests==2.31.0
aiohttp==3.8.1
requests==2.32.3
aiohttp==3.9.5
dateutils==0.6.12
mercantile==1.2.1
pillow==10.3.0
Expand Down
6 changes: 5 additions & 1 deletion pcstac/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ RUN --mount=type=cache,target=/root/.cache \
ENV APP_HOST=0.0.0.0
ENV APP_PORT=81

CMD uvicorn pcstac.main:app --host ${APP_HOST} --port ${APP_PORT} --log-level info
# This value should match that which is used as the root_path in FastAPI, which
# is typically set via the APP_ROOT_PATH environment variable.
ENV APP_ROOT_PATH=""

CMD uvicorn pcstac.main:app --host ${APP_HOST} --port ${APP_PORT} --root-path ${APP_ROOT_PATH} --log-level info
3 changes: 1 addition & 2 deletions pcstac/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
FROM pc-apis-stac


RUN --mount=type=cache,target=/root/.cache \
--mount=type=bind,source=requirements-dev.txt,target=requirements-dev.txt \
pip install -r requirements-dev.txt

RUN --mount=type=cache,target=/root/.cache \
pip install -e ./pccommon[dev] -e ./pcstac
pip install --no-deps -e ./pccommon[dev] -e ./pcstac
1 change: 1 addition & 0 deletions pcstac/pcstac/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""FastAPI application using PGStac."""

import logging
import os
from typing import Any, Dict
Expand Down
10 changes: 4 additions & 6 deletions pcstac/requirements-server.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
anyio==3.7.1
# via
# starlette
# watchgod
asgiref==3.8.1
# via uvicorn
# watchfiles
async-timeout==4.0.3
# via asyncpg
asyncpg==0.29.0
Expand Down Expand Up @@ -147,22 +145,22 @@ termcolor==2.4.0
# via fire
typing-extensions==4.10.0
# via
# asgiref
# fastapi
# psycopg
# psycopg-pool
# pydantic
# pygeoif
# starlette
# uvicorn
tzlocal==5.2
# via dateparser
uvicorn[standard]==0.17.6
uvicorn[standard]==0.30.1
# via pcstac (pcstac/setup.py)
uvloop==0.19.0
# via uvicorn
version-parser==1.0.1
# via pypgstac
watchgod==0.8.2
watchfiles==0.22.0
# via uvicorn
websockets==12.0
# via uvicorn
2 changes: 1 addition & 1 deletion pcstac/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

extra_reqs = {
"server": [
"uvicorn[standard]>=0.17.0,<0.18.0",
"uvicorn[standard]==0.30.1",
],
}

Expand Down
4 changes: 2 additions & 2 deletions pcstac/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def api_client(pqe_pg):
post_request_model=search_post_request_model,
),
extensions=EXTENSIONS,
app=FastAPI(default_response_class=ORJSONResponse),
app=FastAPI(root_path="/stac", default_response_class=ORJSONResponse),
search_get_request_model=search_get_request_model,
search_post_request_model=search_post_request_model,
)
Expand All @@ -102,7 +102,7 @@ async def app(api_client) -> AsyncGenerator[FastAPI, None]:
@pytest.fixture(scope="session")
async def app_client(app) -> AsyncGenerator[AsyncClient, None]:
async with AsyncClient(
app=app, base_url="http://test", headers={"X-Forwarded-For": "127.0.0.1"}
app=app, base_url="http://test/stac", headers={"X-Forwarded-For": "127.0.0.1"}
) as c:
yield c

Expand Down
4 changes: 3 additions & 1 deletion pcstac/tests/resources/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,17 +390,19 @@ async def test_pagination_item_collection(app_client):
idx = 0
item_ids = []
nextThing = None

while True:
idx += 1
page_data = page.json()
item_ids.append(page_data["features"][0]["id"])
print(idx, item_ids)
nextlink = [
link["href"] for link in page_data["links"] if link["rel"] == "next"
]
if len(nextlink) < 1:
break
nextThing = nextlink.pop()
assert nextThing.startswith("http://test/stac/collections")

page = await app_client.get(nextThing)
if idx >= 20:
assert False
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
black==22.3.0
black==24.4.2
flake8==3.8.4
isort==5.9.2
mypy==1.8.0
openapi-spec-validator==0.3.0
cachetools<=4.2.
pytest==7.*
pytest-asyncio==0.18.*
httpx>=0.22.0
json-schema<4.18.0 # https://github.com/stac-utils/pystac/issues/1186

pip-tools
# Mypy types
types-python-dateutil
types-cachetools
types-python-dateutil
types-redis
2 changes: 1 addition & 1 deletion scripts/generate-requirements
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ docker-compose \
-f docker-compose.dev.yml \
run --rm \
tiler-dev \
pip-compile ./pccommon/setup.py --extra server -o pccommon/requirements.txt $pip_compile_options
pip-compile ./pccommon/setup.py --extra server -o pccommon/requirements.txt $pip_compile_options

0 comments on commit 20b7fa4

Please sign in to comment.