Skip to content

Commit 04a9377

Browse files
Merge pull request #84 from developmentseed/dev
Merge dev into main
2 parents 4e962fc + c0a6fbd commit 04a9377

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+3867
-1324
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Deploy
2+
3+
inputs:
4+
env_aws_secret_name:
5+
required: false
6+
type: string
7+
default: ''
8+
dir:
9+
required: false
10+
type: string
11+
default: "."
12+
script_path:
13+
required: false
14+
type: string
15+
default: ''
16+
skip_deploy:
17+
required: false
18+
type: string
19+
default: 'false'
20+
21+
runs:
22+
using: "composite"
23+
steps:
24+
- name: Install node and related deps
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 20
28+
29+
- uses: actions/cache@v3
30+
with:
31+
path: ~/.npm
32+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
33+
34+
- name: Install AWS CDK
35+
shell: bash
36+
run: npm install -g aws-cdk@2
37+
38+
- name: Install uv
39+
uses: astral-sh/setup-uv@v3
40+
with:
41+
version: "0.5.*"
42+
43+
- name: Install dependencies
44+
shell: bash
45+
working-directory: ${{ inputs.dir }}
46+
run: |
47+
uv sync --only-group deployment
48+
uv run npm install
49+
50+
- name: Get relevant environment configuration from aws secrets
51+
if: inputs.env_aws_secret_name != ''
52+
shell: bash
53+
working-directory: ${{ inputs.dir }}
54+
env:
55+
AWS_DEFAULT_REGION: us-west-2
56+
run: |
57+
if [[ -z "${{ inputs.script_path }}" ]]; then
58+
./scripts/sync-env.sh ${{ inputs.env_aws_secret_name }}
59+
else
60+
python ${{ inputs.script_path }} --secret-id ${{ inputs.env_aws_secret_name }}
61+
fi
62+
63+
- name: CDK Synth
64+
shell: bash
65+
working-directory: ${{ inputs.dir }}
66+
run: uv run --only-group deployment npm run cdk -- synth
67+
68+
- name: Check Asset Sizes
69+
shell: bash
70+
working-directory: ${{ inputs.dir }}
71+
run: |
72+
MAX_SIZE_BYTES=262144000 # 262 MB in bytes
73+
for dir in cdk.out/asset.*; do
74+
if [ -d "$dir" ]; then
75+
size=$(du -sb "$dir" | cut -f1)
76+
if [ "$size" -gt $MAX_SIZE_BYTES ]; then
77+
echo "Directory $dir exceeds 262 MB with size $size bytes (max: $MAX_SIZE_BYTES bytes)."
78+
exit 1
79+
fi
80+
echo "Asset directory $dir size: $size bytes"
81+
fi
82+
done
83+
echo "All asset directories are within size limits."
84+
85+
- name: Deploy
86+
if: ${{ inputs.skip_deploy == 'false' }}
87+
id: deploy_titiler_multidim_stack
88+
shell: bash
89+
working-directory: ${{ inputs.dir }}
90+
run: |
91+
uv run cdk deploy --all --require-approval never --outputs-file ${HOME}/cdk-outputs.json

.github/workflows/ci.yml

Lines changed: 39 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: Test and Deploy
22

3-
# Triggers on pushes to main, dev and tags.
43
on:
54
workflow_dispatch:
65
push:
@@ -10,101 +9,81 @@ on:
109
tags:
1110
- 'v*'
1211
paths:
13-
# Only run test and docker publish if some code have changed
1412
- 'pyproject.toml'
1513
- 'infrastructure/aws/**'
1614
- 'titiler/**'
1715
- '.pre-commit-config.yaml'
18-
# Run tests on pull requests.
1916
pull_request:
17+
2018
env:
21-
LATEST_PY_VERSION: '3.10'
19+
LATEST_PY_VERSION: '3.12'
2220

2321
permissions:
24-
id-token: write # This is required for requesting the JWT
25-
contents: read # This is required for actions/checkout
22+
id-token: write
23+
contents: read
24+
2625

2726
jobs:
2827
tests:
2928
runs-on: ubuntu-latest
3029
strategy:
3130
matrix:
32-
python-version: ['3.8', '3.9', '3.10', '3.11']
31+
python-version: ['3.10', '3.11', '3.12', '3.13']
3332

3433
steps:
35-
- uses: actions/checkout@v3
36-
- name: Set up Python ${{ matrix.python-version }}
37-
uses: actions/setup-python@v4
38-
with:
39-
python-version: ${{ matrix.python-version }}
34+
- uses: actions/checkout@v4
4035

36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v3
38+
with:
39+
version: "0.5.*"
40+
enable-cache: true
41+
42+
- name: Set up Python ${{ matrix.python-version }}
43+
run: uv python install ${{ matrix.python-version }}
44+
4145
- name: Install dependencies
4246
run: |
43-
python -m pip install --upgrade pip
44-
python -m pip install -e .["test"]
47+
uv sync --all-extras
4548
4649
- name: run pre-commit
4750
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
4851
run: |
49-
python -m pip install pre-commit
50-
pre-commit run --all-files
52+
uv run pre-commit run --all-files
5153
5254
- name: Run tests
53-
run: python -m pytest --cov titiler.xarray --cov-report term-missing -s -vv
55+
run: uv run pytest
5456

55-
deploy:
57+
cdk-checks:
5658
needs: [tests]
5759
runs-on: ubuntu-latest
58-
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/v')
60+
environment: dev
61+
if: github.event_name == 'pull_request'
62+
env:
63+
UV_PYTHON: 3.12
64+
CDK_DEFAULT_ACCOUNT: ${{ vars.CDK_DEFAULT_ACCOUNT }}
65+
CDK_DEFAULT_REGION: ${{ vars.CDK_DEFAULT_REGION }}
66+
STAGE: ${{ vars.STAGE }}
67+
VPC_ID: ${{ vars.VPC_ID }}
68+
TITILER_MULTIDIM_PYTHONWARNINGS: ignore
69+
TITILER_MULTIDIM_DEBUG: true
70+
TITILER_MULTIDIM_READER_ROLE_ARN: ${{ vars.TITILER_MULTIDIM_READER_ROLE_ARN }}
5971

6072
defaults:
6173
run:
6274
working-directory: infrastructure/aws
6375

6476
steps:
65-
- uses: actions/checkout@v3
77+
- uses: actions/checkout@v4
6678

6779
- name: Configure AWS credentials
68-
uses: aws-actions/configure-aws-credentials@v2
80+
uses: aws-actions/configure-aws-credentials@v4
6981
with:
70-
role-to-assume: arn:aws:iam::444055461661:role/github-actions-role-eodc
71-
role-session-name: samplerolesession
72-
aws-region: us-west-2
82+
role-to-assume: ${{ vars.AWS_ROLE_ARN }}
83+
role-session-name: github-actions-pr
84+
aws-region: ${{ vars.CDK_DEFAULT_REGION }}
7385

74-
- name: Set up node
75-
uses: actions/setup-node@v2
86+
- uses: ./.github/actions/cdk-deploy
7687
with:
77-
node-version: 18
78-
79-
- name: Install cdk
80-
run: npm install -g aws-cdk
81-
82-
- name: Set up Python
83-
uses: actions/setup-python@v4
84-
with:
85-
python-version: '3.x'
86-
87-
- name: Install dependencies
88-
run: |
89-
python -m pip install --upgrade pip
90-
python -m pip install -r requirements-cdk.txt
91-
92-
# Build and deploy to the development environment whenever there is a push to main or dev
93-
- name: Build & Deploy Development
94-
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
95-
run: npm run cdk -- deploy titiler-xarray-development --require-approval never
96-
env:
97-
TITILER_XARRAY_PYTHONWARNINGS: ignore
98-
TITILER_XARRAY_DEBUG: True
99-
STACK_ALARM_EMAIL: ${{ secrets.ALARM_EMAIL }}
100-
STACK_STAGE: development
101-
102-
# Build and deploy to production deployment whenever there a new tag is pushed
103-
- name: Build & Deploy Production
104-
if: startsWith(github.ref, 'refs/tags/v')
105-
run: npm run cdk -- deploy titiler-xarray-production
106-
env:
107-
TITILER_XARRAY_PYTHONWARNINGS: ignore
108-
TITILER_XARRAY_DEBUG: True
109-
STACK_ALARM_EMAIL: ${{ secrets.ALARM_EMAIL }}
110-
STACK_STAGE: production
88+
dir: 'infrastructure/aws'
89+
skip_deploy: 'true'

.pre-commit-config.yaml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,15 @@
11
repos:
22
- repo: https://github.com/abravalheri/validate-pyproject
3-
rev: v0.12.1
3+
rev: v0.23
44
hooks:
55
- id: validate-pyproject
66

7-
- repo: https://github.com/psf/black
8-
rev: 22.12.0
9-
hooks:
10-
- id: black
11-
language_version: python
12-
13-
- repo: https://github.com/PyCQA/isort
14-
rev: 5.12.0
15-
hooks:
16-
- id: isort
17-
language_version: python
18-
19-
- repo: https://github.com/charliermarsh/ruff-pre-commit
20-
rev: v0.0.238
7+
- repo: https://github.com/astral-sh/ruff-pre-commit
8+
rev: v0.9.4
219
hooks:
2210
- id: ruff
2311
args: ["--fix"]
12+
- id: ruff-format
2413

2514
- repo: https://github.com/pre-commit/mirrors-mypy
2615
rev: v0.991

CHANGELOG.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
* Import `titiler.xarray` (from [`titiler repo`](https://github.com/developmentseed/titiler)) ([#72](https://github.com/developmentseed/titiler-xarray/pull/72))
6+
* Rename the package to `titiler.multidim` ([#72](https://github.com/developmentseed/titiler-xarray/pull/72)) **breaking change**
7+
* Drop support for kerchunk reference files ([#72](https://github.com/developmentseed/titiler-xarray/pull/72)) **breaking change**
8+
* Drop support for experimental `multiscale` zarr group zoom level functionality ([#72](https://github.com/developmentseed/titiler-xarray/pull/72)) **breaking change**
9+
* Remove default `WebMercatorQuad` tile matrix set in `/tiles`, `/tilesjson.json`, `/map` and `/WMTSCapabilities.xml` endpoints (with upgrade to `titiler.core>=0.19`) **breaking change**
10+
* Use `uv` for managing dependencies [#74](https://github.com/developmentseed/titiler-xarray/pull/74)
11+
* Slim down the Lambda asset package size [#74](https://github.com/developmentseed/titiler-xarray/pull/74)
12+
* run `strip` on compiled C/C++ extensions (except `numpy.libs`)
13+
314
## v0.2.0
415

516
### Improved pyramid support through group parameter
@@ -17,7 +28,7 @@
1728

1829
## v0.1.1
1930

20-
Support for NetCDF and making consolidated metadata optional. See https://github.com/developmentseed/titiler-xarray/pull/39.
31+
Support for NetCDF and making consolidated metadata optional. See <https://github.com/developmentseed/titiler-xarray/pull/39>.
2132

2233
[Performance results between prod (v0.1.0) and dev (unreleased)](https://github.com/developmentseed/tile-benchmarking/blob/bd1703209bbeab501f312d99fc51fda6bd419bf9/03-e2e/compare-prod-dev.ipynb).
2334

@@ -26,8 +37,6 @@ Support for NetCDF and making consolidated metadata optional. See https://github
2637
* NetCDF Dataset: pr_day_ACCESS-CM2_historical_r1i1p1f1_gn_1950.nc
2738
* Unconsolidated metadata dataset: prod-giovanni-cache-GPM_3IMERGHH_06_precipitationCal
2839

29-
3040
## v0.1.0 (2023-10-11)
3141

3242
Initial release of the project.
33-

0 commit comments

Comments
 (0)