Skip to content

Commit 39f7067

Browse files
authored
feat: upgrade to titiler>=0.23.1,<0.24 and Python 3.12 (#71)
* deps: upgrade to titiler>=0.23.1,<0.24 * feat: upgrade to python 3.12 runtime for Lambda * use uv to pip install in the Lambda dockerfile * add more logging statements
1 parent bacdc15 commit 39f7067

File tree

14 files changed

+1405
-2140
lines changed

14 files changed

+1405
-2140
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ target/
7070
# Jupyter Notebook
7171
.ipynb_checkpoints
7272

73-
# pyenv
74-
.python-version
75-
7673
# celery beat schedule file
7774
celerybeat-schedule
7875

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
## [Unreleased]
88

9+
- Upgrade to titiler v0.23. and add more logging statements to help track performance ([#71](https://github.com/developmentseed/titiler-cmr/pull/71))
10+
911
## [v0.1.5]
1012

1113
### Fixed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ COPY titiler/ titiler/
99
COPY README.md README.md
1010
COPY LICENSE LICENSE
1111

12-
RUN apt-get update && apt-get -y --no-install-recommends install libexpat1 && uv sync --frozen --extra uvicorn
12+
RUN apt-get update && apt-get -y --no-install-recommends install libexpat1 && uv sync --no-dev --frozen --extra uvicorn
1313

1414
ARG EARTHDATA_USERNAME
1515
ARG EARTHDATA_PASSWORD

docs/examples/rasterio_backend_example.ipynb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@
4141
"outputs": [],
4242
"source": [
4343
"# titiler_endpoint = \"http://localhost:8081\" # docker network endpoint\n",
44-
"titiler_endpoint = \"https://staging.openveda.cloud/api/titiler-cmr\" # deployed endpoint"
44+
"titiler_endpoint = (\n",
45+
" \"https://staging.openveda.cloud/api/titiler-cmr\" # VEDA staging endpoint\n",
46+
")\n",
47+
"# titiler_endpoint = \"https://v4jec6i5c0.execute-api.us-west-2.amazonaws.com\" # dev endpoint"
4548
]
4649
},
4750
{
@@ -364,7 +367,7 @@
364367
"name": "python",
365368
"nbconvert_exporter": "python",
366369
"pygments_lexer": "ipython3",
367-
"version": "3.11.9"
370+
"version": "3.12.3"
368371
}
369372
},
370373
"nbformat": 4,

docs/examples/time_series_example.ipynb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@
3737
"# if running titiler-cmr in the docker network\n",
3838
"# titiler_endpoint = \"http://localhost:8081\"\n",
3939
"\n",
40-
"# titiler-cmr-staging deployment\n",
41-
"titiler_endpoint = \"https://staging.openveda.cloud/api/titiler-cmr\"\n",
40+
"# titiler_endpoint = \"http://localhost:8081\" # docker network endpoint\n",
41+
"titiler_endpoint = (\n",
42+
" \"https://staging.openveda.cloud/api/titiler-cmr\" # VEDA staging endpoint\n",
43+
")\n",
44+
"# titiler_endpoint = \"https://v4jec6i5c0.execute-api.us-west-2.amazonaws.com\" # dev endpoint\n",
4245
"\n",
4346
"IFrame(f\"{titiler_endpoint}/api.html#Timeseries\", 900, 500)"
4447
]
@@ -519,7 +522,7 @@
519522
"name": "python",
520523
"nbconvert_exporter": "python",
521524
"pygments_lexer": "ipython3",
522-
"version": "3.11.9"
525+
"version": "3.12.3"
523526
}
524527
},
525528
"nbformat": 4,

docs/examples/xarray_backend_example.ipynb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
"from folium import Map, TileLayer\n",
3535
"\n",
3636
"# titiler_endpoint = \"http://localhost:8081\" # docker network endpoint\n",
37-
"titiler_endpoint = \"https://staging.openveda.cloud/api/titiler-cmr\" # deployed endpoint"
37+
"titiler_endpoint = (\n",
38+
" \"https://staging.openveda.cloud/api/titiler-cmr\" # VEDA staging endpoint\n",
39+
")\n",
40+
"# titiler_endpoint = \"https://v4jec6i5c0.execute-api.us-west-2.amazonaws.com\" # dev endpoint"
3841
]
3942
},
4043
{
@@ -284,7 +287,7 @@
284287
"name": "python",
285288
"nbconvert_exporter": "python",
286289
"pygments_lexer": "ipython3",
287-
"version": "3.11.9"
290+
"version": "3.12.3"
288291
}
289292
},
290293
"nbformat": 4,

infrastructure/aws/cdk/app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
from aws_cdk import aws_sns as sns
1313
from aws_cdk import aws_sns_subscriptions as subscriptions
1414
from aws_cdk.aws_apigatewayv2_integrations import HttpLambdaIntegration
15-
from config import StackSettings, AppSettings
15+
from config import AppSettings, StackSettings
1616
from constructs import Construct
1717

1818
stack_settings, app_settings = StackSettings(), AppSettings()
1919

2020
DEFAULT_ENV = {
21+
"AWS_LAMBDA_LOG_FORMAT": "JSON",
22+
"AWS_LAMBDA_LOG_LEVEL": "INFO",
2123
"GDAL_CACHEMAX": "200", # 200 mb
2224
"GDAL_DISABLE_READDIR_ON_OPEN": "EMPTY_DIR",
2325
"GDAL_INGESTED_BYTES_AT_OPEN": "32768", # get more bytes when opening the files.
@@ -39,7 +41,7 @@ def __init__(
3941
id: str,
4042
memory: int = 1024,
4143
timeout: int = 30,
42-
runtime: aws_lambda.Runtime = aws_lambda.Runtime.PYTHON_3_10,
44+
runtime: aws_lambda.Runtime = aws_lambda.Runtime.PYTHON_3_12,
4345
concurrent: Optional[int] = None,
4446
permissions: Optional[List[iam.PolicyStatement]] = None,
4547
role_arn: Optional[str] = None,

infrastructure/aws/lambda/Dockerfile

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,26 @@
1-
ARG PYTHON_VERSION=3.10
1+
ARG PYTHON_VERSION=3.12
22

33
FROM --platform=linux/amd64 public.ecr.aws/lambda/python:${PYTHON_VERSION}
4+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
45

56
WORKDIR /tmp
67

7-
COPY pyproject.toml pyproject.toml
8-
COPY LICENSE LICENSE
9-
COPY README.md README.md
10-
COPY titiler/ titiler/
8+
COPY uv.lock .python-version pyproject.toml LICENSE README.md ./
9+
COPY titiler/ ./titiler/
1110

12-
# Install dependencies
11+
RUN dnf install -y gcc-c++
12+
RUN uv export --locked --no-editable --no-dev --extra lambda --format requirements.txt -o requirements.txt && \
13+
uv pip install --compile-bytecode --no-binary pydantic --target /asset -r requirements.txt
1314

14-
# Install system dependencies to compile (numexpr)
15-
RUN yum install -y gcc-c++
16-
# HACK: aiobotocore has a tight botocore dependency
17-
# https://github.com/aio-libs/aiobotocore/issues/862
18-
# and becaise we NEED to remove both boto3 and botocore to save space for the package
19-
# we have to force using old package version that seems `almost` compatible with Lambda env botocore
20-
# https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
21-
RUN python -m pip install --upgrade pip
22-
RUN python -m pip install . "mangum>=0.10.0" "botocore==1.34.145" "aiobotocore==2.13.3" -t /asset --no-binary pydantic
15+
# copy libexpat.so.1 into /asset which is included in LD_LIBRARY_PATH
16+
RUN cp /usr/lib64/libexpat.so.1 /asset/
2317

2418
# Reduce package size and remove useless files
2519
RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[0-9]*//'); cp $f $n; done;
2620
RUN cd /asset && find . -type d -a -name '__pycache__' -print0 | xargs -0 rm -rf
2721
RUN cd /asset && find . -type f -a -name '*.py' -print0 | xargs -0 rm -f
2822
RUN find /asset -type d -a -name 'tests' -print0 | xargs -0 rm -rf
2923
RUN rm -rdf /asset/numpy/doc/ /asset/bin /asset/geos_license /asset/Misc
30-
RUN rm -rdf /asset/boto3*
31-
RUN rm -rdf /asset/botocore*
3224

3325
# Strip debug symbols from compiled C/C++ code (except for numpy.libs!)
3426
RUN cd /asset && \

pyproject.toml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "titiler.cmr"
33
description = "Connect Common Metadata Repository (CMR) and TiTiler."
44
readme = "README.md"
5-
requires-python = ">=3.10"
5+
requires-python = ">=3.12"
66
license = {file = "LICENSE"}
77
authors = [
88
{name = "Aimee Barciauskas", email = "aimee@developmentseed.com"},
@@ -16,25 +16,25 @@ classifiers = [
1616
"Intended Audience :: Information Technology",
1717
"Intended Audience :: Science/Research",
1818
"License :: OSI Approved :: MIT License",
19-
"Programming Language :: Python :: 3.10",
20-
"Programming Language :: Python :: 3.11",
2119
"Programming Language :: Python :: 3.12",
20+
"Programming Language :: Python :: 3.13",
2221
"Topic :: Scientific/Engineering :: GIS",
2322
]
2423
dependencies = [
25-
"titiler.core>=0.22.3,<0.23",
26-
"titiler.mosaic>=0.22.3,<0.23",
27-
"titiler.xarray>=0.22.3,<0.23",
24+
"titiler.core>=0.23.1,<0.24",
25+
"titiler.mosaic>=0.23.1,<0.24",
26+
"titiler.xarray>=0.23.1,<0.24",
27+
"aiobotocore>=2.20",
28+
"boto3>=1.34.145",
2829
"cftime~=1.6.4",
2930
"earthaccess~=0.11.0",
30-
"fsspec~=2024.9.0",
3131
"h5netcdf~=1.1.0",
3232
"orjson~=3.10.7",
3333
"pydantic-settings~=2.0",
3434
"pydantic>=2.4,<3.0",
3535
"rio_tiler[s3]>=7.2.0,<8.0",
3636
"rioxarray~=0.13.4",
37-
"s3fs~=2024.9.0",
37+
"s3fs~=2025.9.0",
3838
"xarray~=2024.9.0",
3939
"geojson-pydantic>=2.0.0,<3.0",
4040
"python-dateutil>=2.9.0.post0",
@@ -50,6 +50,8 @@ uvicorn = [
5050
"uvicorn",
5151
]
5252

53+
lambda = ["mangum==0.19.0"]
54+
5355
[dependency-groups]
5456
dev = [
5557
"folium>=0.17.0",
@@ -74,10 +76,11 @@ dev = [
7476
"ipywidgets>=8.1.5",
7577
"pytest-benchmark>=5.1.0",
7678
"seaborn>=0.13.2",
79+
"uvicorn>=0.32.1",
7780
]
7881
deployment = [
7982
"aws-cdk-lib~=2.177.0",
80-
"boto3>=1.35.36",
83+
"boto3>=1.34.145",
8184
"constructs>=10.4.2",
8285
"pydantic-settings~=2.0",
8386
"python-dotenv>=1.0.1",

0 commit comments

Comments
 (0)