Skip to content

Commit d026d4c

Browse files
authored
merge main to staging (#27)
* feat: allow dataset source to contain an array of sources (#26) * fix: keep installed versions of boto3 and botocore
1 parent 111a6f9 commit d026d4c

22 files changed

Lines changed: 1268 additions & 1625 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Set up Python
3333
uses: actions/setup-python@v2
3434
with:
35-
python-version: 3.8
35+
python-version: 3.9
3636

3737
- name: Create Config.yml
3838
uses: franzbischoff/replace_envs@v1
@@ -53,7 +53,7 @@ jobs:
5353
node-version: '16'
5454

5555
- name: Cache Node.js modules
56-
uses: actions/cache@v2
56+
uses: actions/cache@v4
5757
with:
5858
# npm cache files are stored in `~/.npm` on Linux/macOS
5959
path: ~/.npm
@@ -72,15 +72,15 @@ jobs:
7272
echo "::set-output name=dir::$(pip cache dir)"
7373
7474
- name: pip cache
75-
uses: actions/cache@v2
75+
uses: actions/cache@v4
7676
with:
7777
path: ${{ steps.pip-cache.outputs.dir }}
7878
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
7979
restore-keys: |
8080
${{ runner.os }}-pip-
8181
82-
- name: Install AWS CDK
83-
run: npm install -g cdk
82+
- name: Install Node.js dependencies
83+
run: npm install
8484

8585
- name: Install python packages
8686
run: |

.github/workflows/pr.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ on:
33
pull_request:
44
branches:
55
- main
6-
schedule:
7-
- cron: '0 0 * * *' # daily
86

97
env:
108
STAC_API_URL: ""
@@ -30,7 +28,7 @@ jobs:
3028
- name: Set up Python
3129
uses: actions/setup-python@v2
3230
with:
33-
python-version: 3.8
31+
python-version: 3.9
3432

3533
- name: Create Config.yml
3634
uses: franzbischoff/replace_envs@v1
@@ -50,13 +48,14 @@ jobs:
5048
run: |
5149
python -m pip install -U pip
5250
python -m pip install .["dev,test"]
51+
python -m pip install --upgrade setuptools packaging virtualenv
5352
5453
- name: run pre-commit
5554
run: pre-commit run --all-files
5655

57-
- name: Run safety dependency vulnerability check
58-
# ignore some vulnerabilities in twisted and httplib2 that are already installed and can't be uninstalled
59-
run: safety check -i 39557 -i 37040 -i 37209 -i 37554 -i 38085 -i 38368 -i 38303 -i 39608
56+
# - name: Run safety dependency vulnerability check
57+
# # ignore some vulnerabilities in twisted and httplib2 that are already installed and can't be uninstalled
58+
# run: safety check -i 39557 -i 37040 -i 37209 -i 37554 -i 38085 -i 38368 -i 38303 -i 39608
6059

6160
- name: Run bandit static analysis check
6261
run: bandit -r dashboard_api
@@ -79,14 +78,14 @@ jobs:
7978
- name: Set up Python
8079
uses: actions/setup-python@v2
8180
with:
82-
python-version: 3.8
81+
python-version: 3.9
8382

8483
- uses: actions/setup-node@v2
8584
with:
86-
node-version: '12'
85+
node-version: '16'
8786

8887
- name: Cache Node.js modules
89-
uses: actions/cache@v2
88+
uses: actions/cache@v4
9089
with:
9190
# npm cache files are stored in `~/.npm` on Linux/macOS
9291
path: ~/.npm
@@ -110,8 +109,8 @@ jobs:
110109
to_file: 'stack/config.yml'
111110
commit: 'false'
112111

113-
- name: Install AWS CDK
114-
run: npm install -g
112+
- name: Install Node.js dependencies
113+
run: npm install
115114

116115
- name: Install python packages
117116
run: |

.pre-commit-config.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,35 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 22.3.0
3+
rev: 24.10.0
44
hooks:
55
- id: black
66
language_version: python
77

88
- repo: https://github.com/PyCQA/isort
9-
rev: 5.4.2
9+
rev: 5.13.2
1010
hooks:
1111
- id: isort
1212
language_version: python
1313

1414
- repo: https://github.com/PyCQA/flake8
15-
rev: 3.8.3
15+
rev: 7.1.1
1616
hooks:
1717
- id: flake8
1818
language_version: python
1919

2020
- repo: https://github.com/PyCQA/pydocstyle
21-
rev: 5.1.1
21+
rev: 6.3.0
2222
hooks:
2323
- id: pydocstyle
2424
language_version: python
2525

2626
- repo: https://github.com/pre-commit/mirrors-mypy
27-
rev: v0.812
27+
rev: v1.13.0
2828
hooks:
2929
- id: mypy
3030
language_version: python
31+
additional_dependencies:
32+
- types-PyYAML
33+
- types-requests
34+
- types-cachetools
35+
- types-mock

Dockerfiles/lambda/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN pip install . "mangum>=0.10.0" -t /asset --no-binary pydantic
1414
RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[2-3][0-9]//'); cp $f $n; done;
1515
RUN cd /asset && find . -type d -a -name '__pycache__' -print0 | xargs -0 rm -rf
1616
RUN cd /asset && find . -type f -a -name '*.py' -print0 | xargs -0 rm -f
17-
RUN rm -rdf /asset/numpy/doc/ /asset/boto3* /asset/botocore* /asset/bin /asset/geos_license /asset/Misc
17+
# RUN rm -rdf /asset/numpy/doc/ /asset/boto3* /asset/botocore* /asset/bin /asset/geos_license /asset/Misc
1818

1919
RUN mkdir /asset/stack
2020
COPY stack/config.yml /asset/stack/config.yml

dashboard_api/api/api_v1/endpoints/datasets.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Dataset endpoints."""
2+
23
from fastapi import APIRouter, Depends, HTTPException, Response
34
from starlette.requests import Request
45

dashboard_api/api/api_v1/endpoints/tiles.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ def tile(
4141
x: int = Path(..., description="Mercator tiles's column"),
4242
y: int = Path(..., description="Mercator tiles's row"),
4343
# AssertionError: Cannot use `Query` for path param 'scale'
44-
# scale: int = Query(
45-
# 1, gt=0, lt=4, description="Tile size scale. 1=256x256, 2=512x512..."
46-
# ),
47-
# ext: ImageType = Query(None, description="Output image type. Default is auto."),
44+
scale: int = Path(
45+
..., gt=0, lt=4, description="Tile size scale. 1=256x256, 2=512x512..."
46+
),
47+
ext: ImageType = Path(..., description="Output image type. Default is auto."),
4848
url: str = Query(..., description="Cloud Optimized GeoTIFF URL."),
4949
bidx: Optional[str] = Query(None, description="Coma (',') delimited band indexes"),
5050
nodata: Optional[Union[str, int, float]] = Query(

dashboard_api/db/static/datasets/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
""" dashboard_api static datasets """
2+
23
import json
34
import os
4-
from typing import List
5+
from typing import List, Optional
56

67
import botocore
78

@@ -99,7 +100,9 @@ def list(self) -> List[str]:
99100
"""List all datasets"""
100101
return list(self._data().keys())
101102

102-
def _format_urls(self, tiles: List[str], api_url: str, spotlight_id: str = None):
103+
def _format_urls(
104+
self, tiles: List[str], api_url: str, spotlight_id: Optional[str] = None
105+
):
103106
if spotlight_id:
104107
[tile.replace("{spotlightId}", spotlight_id) for tile in tiles]
105108
return [
@@ -110,7 +113,10 @@ def _format_urls(self, tiles: List[str], api_url: str, spotlight_id: str = None)
110113
]
111114

112115
def _process(
113-
self, datasets_domains_metadata: dict, api_url: str, spotlight_id: str = None
116+
self,
117+
datasets_domains_metadata: dict,
118+
api_url: str,
119+
spotlight_id: Optional[str] = None,
114120
):
115121
"""
116122
Processes datasets to be returned to the API consumer:

dashboard_api/db/static/products/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
""" dashboard_api static products """
2+
23
import json
34
import os
45
from typing import Optional

dashboard_api/db/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import csv
44
import json
55
from datetime import datetime
6-
from typing import Dict, List
6+
from typing import Dict, List, Optional
77

88
import boto3
99
from botocore import config
@@ -23,7 +23,9 @@
2323

2424

2525
def invoke_lambda(
26-
lambda_function_name: str, payload: dict = None, invocation_type="RequestResponse"
26+
lambda_function_name: str,
27+
payload: Optional[dict] = None,
28+
invocation_type="RequestResponse",
2729
):
2830
"""Invokes a lambda function using the boto3 lambda client.
2931

dashboard_api/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""dashboard_api app."""
2+
23
from typing import Any, Dict, Optional
34

45
from fastapi import FastAPI

0 commit comments

Comments
 (0)