Skip to content

Commit bad0b50

Browse files
authored
deps: upgrade titiler, Python 3.12, boto3/botocore/aiobotocore (#93)
1 parent da8b2d3 commit bad0b50

19 files changed

+186
-1415
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ jobs:
2828
runs-on: ubuntu-latest
2929
strategy:
3030
matrix:
31-
python-version: ['3.10', '3.11', '3.12', '3.13']
31+
python-version: ['3.12', '3.13']
3232

3333
steps:
3434
- uses: actions/checkout@v4
3535

3636
- name: Install uv
3737
uses: astral-sh/setup-uv@v3
3838
with:
39-
version: "0.5.*"
39+
version: "0.8.*"
4040
enable-cache: true
4141

4242
- name: Set up Python ${{ matrix.python-version }}

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ target/
7373
# Jupyter Notebook
7474
.ipynb_checkpoints
7575

76-
# pyenv
77-
.python-version
78-
7976
# celery beat schedule file
8077
celerybeat-schedule
8178

.python-version

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

infrastructure/aws/cdk/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(
4242
id: str,
4343
memory: int = 1024,
4444
timeout: int = 30,
45-
runtime: aws_lambda.Runtime = aws_lambda.Runtime.PYTHON_3_10,
45+
runtime: aws_lambda.Runtime = aws_lambda.Runtime.PYTHON_3_12,
4646
concurrent: Optional[int] = None,
4747
permissions: Optional[List[iam.PolicyStatement]] = None,
4848
environment: Optional[Dict] = None,

infrastructure/aws/lambda/Dockerfile

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1-
ARG PYTHON_VERSION=3.11
1+
ARG PYTHON_VERSION=3.12
22

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

66
WORKDIR /tmp
77

88
# Install system dependencies to compile (numexpr)
9-
RUN yum install -y gcc-c++
10-
11-
COPY pyproject.toml pyproject.toml
12-
COPY LICENSE LICENSE
13-
COPY README.md README.md
14-
COPY src/titiler/ src/titiler/
15-
16-
# Install dependencies
17-
# HACK: aiobotocore has a tight botocore dependency
18-
# https://github.com/aio-libs/aiobotocore/issues/862
19-
# and becaise we NEED to remove both boto3 and botocore to save space for the package
20-
# we have to force using old package version that seems `almost` compatible with Lambda env botocore
21-
# https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
22-
RUN uv pip install --compile-bytecode . "mangum>=0.10.0" "botocore==1.29.76" "aiobotocore==2.5.0" --target /asset --no-binary pydantic
9+
RUN dnf install -y gcc-c++
10+
11+
COPY uv.lock .python-version pyproject.toml LICENSE README.md ./
12+
COPY src/titiler/ ./src/titiler/
13+
14+
RUN uv export --locked --no-editable --no-dev --extra lambda --format requirements.txt -o requirements.txt && \
15+
uv pip install --compile-bytecode --no-binary pydantic --target /asset -r requirements.txt
16+
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;

pyproject.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "titiler-multidim"
33
description = "TiTiler application extension for titiler.xarray."
44
readme = "README.md"
5-
requires-python = ">=3.9"
5+
requires-python = ">=3.12"
66
authors = [
77
{name = "Vincent Sarago", email = "vincent@developmentseed.com"},
88
]
@@ -25,9 +25,11 @@ classifiers = [
2525
]
2626
dynamic = ["version"]
2727
dependencies = [
28-
"titiler.core>=0.21.0,<0.22",
29-
"titiler.xarray>=0.21.0,<0.22",
28+
"titiler.core>=0.23.0,<0.24",
29+
"titiler.xarray>=0.23.0,<0.24",
3030
"aiohttp",
31+
"aiobotocore>=2.24.0",
32+
"boto3>=1.39.0",
3133
"cftime",
3234
"fastapi",
3335
"fsspec",
@@ -47,6 +49,10 @@ dependencies = [
4749
server = [
4850
"uvicorn"
4951
]
52+
lambda = [
53+
"mangum==0.19.0",
54+
"aiobotocore>=2.24.0,<2.24.2"
55+
]
5056

5157
[dependency-groups]
5258
dev = [

src/titiler/multidim/factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def histogram(
7171
variable=reader_params.variable,
7272
group=reader_params.group,
7373
decode_times=reader_params.decode_times,
74-
datetime=reader_params.datetime,
74+
sel=reader_params.sel,
7575
) as src_dst:
7676
boolean_mask = ~np.isnan(src_dst.input)
7777
data_values = src_dst.input.values[boolean_mask]

src/titiler/multidim/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
)
8383

8484
if api_settings.debug:
85-
app.add_middleware(LoggerMiddleware, headers=True, querystrings=True)
85+
app.add_middleware(LoggerMiddleware)
8686
app.add_middleware(TotalTimeMiddleware)
8787
app.add_middleware(
8888
ServerTimingMiddleware,

src/titiler/multidim/reader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ def __attrs_post_init__(self):
4545
self.input = get_variable(
4646
self.ds,
4747
self.variable,
48-
datetime=self.datetime,
49-
drop_dim=self.drop_dim,
48+
sel=self.sel,
5049
)
5150
super().__attrs_post_init__()
5251

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,14 @@
11
{
2-
"bounds": [
3-
-180.0,
4-
-90.0,
5-
180.0,
6-
90.0
7-
],
2+
"bounds": [-180.0, -90.0, 180.0, 90.0],
83
"crs": "http://www.opengis.net/def/crs/EPSG/0/4326",
9-
"band_metadata": [
10-
[
11-
"b1",
12-
{}
13-
]
14-
],
15-
"band_descriptions": [
16-
[
17-
"b1",
18-
"value"
19-
]
20-
],
4+
"band_metadata": [["b1", {}]],
5+
"band_descriptions": [["b1", "0"]],
216
"dtype": "float64",
227
"nodata_type": "Nodata",
238
"name": "value",
249
"count": 1,
2510
"width": 250,
2611
"height": 250,
27-
"attrs": {}
12+
"attrs": {},
13+
"dimensions": ["y", "x"]
2814
}

0 commit comments

Comments
 (0)