Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.12

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.11]
python: [3.12]
steps:
- uses: actions/checkout@v4
- name: Setup Python
Expand Down
16 changes: 8 additions & 8 deletions lib/database/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
Stack,
aws_rds as rds,
aws_ec2 as ec2,
aws_secretsmanager as secretsmanager,
aws_lambda,
CustomResource,
RemovalPolicy,
Duration,
RemovalPolicy,
Stack,
aws_lambda,
aws_logs,
aws_ec2 as ec2,
aws_rds as rds,
aws_secretsmanager as secretsmanager,
} from "aws-cdk-lib";
import { Construct } from "constructs";
import { CustomLambdaFunctionProps, DEFAULT_PGSTAC_VERSION } from "../utils";
Expand Down Expand Up @@ -74,15 +74,15 @@ export class PgStacDatabase extends Construct {

const handler = new aws_lambda.Function(this, "lambda", {
// defaults
runtime: aws_lambda.Runtime.PYTHON_3_11,
runtime: aws_lambda.Runtime.PYTHON_3_12,
handler: "handler.handler",
memorySize: 128,
logRetention: aws_logs.RetentionDays.ONE_WEEK,
timeout: Duration.minutes(2),
code: aws_lambda.Code.fromDockerBuild(__dirname, {
file: "bootstrapper_runtime/Dockerfile",
buildArgs: {
PYTHON_VERSION: "3.11",
PYTHON_VERSION: "3.12",
PGSTAC_VERSION: this.pgstacVersion,
},
}),
Expand Down
16 changes: 8 additions & 8 deletions lib/ingestor-api/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
aws_apigateway as apigateway,
aws_logs,
Duration,
aws_dynamodb as dynamodb,
aws_ec2 as ec2,
aws_lambda_event_sources as events,
aws_iam as iam,
aws_lambda as lambda,
aws_logs,
aws_lambda_event_sources as events,
RemovalPolicy,
aws_secretsmanager as secretsmanager,
aws_ssm as ssm,
Duration,
RemovalPolicy,
Stack,
} from "aws-cdk-lib";
import { Construct } from "constructs";
Expand Down Expand Up @@ -118,15 +118,15 @@ export class StacIngestor extends Construct {
}): lambda.Function {
const handler = new lambda.Function(this, "api-handler", {
// defaults
runtime: lambda.Runtime.PYTHON_3_11,
runtime: lambda.Runtime.PYTHON_3_12,
handler: "src.handler.handler",
memorySize: 2048,
logRetention: aws_logs.RetentionDays.ONE_WEEK,
timeout: Duration.seconds(30),
code: lambda.Code.fromDockerBuild(__dirname, {
file: "runtime/Dockerfile",
buildArgs: {
PYTHON_VERSION: "3.11",
PYTHON_VERSION: "3.12",
PGSTAC_VERSION: props.pgstacVersion || DEFAULT_PGSTAC_VERSION,
},
}),
Expand Down Expand Up @@ -169,15 +169,15 @@ export class StacIngestor extends Construct {
}): lambda.Function {
const handler = new lambda.Function(this, "stac-ingestor", {
// defaults
runtime: lambda.Runtime.PYTHON_3_11,
runtime: lambda.Runtime.PYTHON_3_12,
handler: "src.ingestor.handler",
memorySize: 2048,
logRetention: aws_logs.RetentionDays.ONE_WEEK,
timeout: Duration.seconds(180),
code: lambda.Code.fromDockerBuild(__dirname, {
file: "runtime/Dockerfile",
buildArgs: {
PYTHON_VERSION: "3.11",
PYTHON_VERSION: "3.12",
PGSTAC_VERSION: props.pgstacVersion || DEFAULT_PGSTAC_VERSION,
},
}),
Expand Down
2 changes: 1 addition & 1 deletion lib/ingestor-api/runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM --platform=linux/amd64 public.ecr.aws/lambda/python:${PYTHON_VERSION}

WORKDIR /tmp

RUN yum install -y git
RUN dnf install -y git

RUN python -m pip install pip -U

Expand Down
16 changes: 8 additions & 8 deletions lib/stac-api/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {
aws_apigatewayv2 as apigatewayv2,
aws_logs,
CfnOutput,
Duration,
aws_ec2 as ec2,
aws_rds as rds,
aws_lambda as lambda,
aws_rds as rds,
aws_secretsmanager as secretsmanager,
Duration,
aws_logs,
CfnOutput,
Stack,
} from "aws-cdk-lib";
import { Construct } from "constructs";
import { CustomLambdaFunctionProps } from "../utils";
import { LambdaApiGateway } from "../lambda-api-gateway";
import * as path from "path";
import { LambdaApiGateway } from "../lambda-api-gateway";
import { CustomLambdaFunctionProps } from "../utils";

export const EXTENSIONS = {
QUERY: "query",
Expand Down Expand Up @@ -71,14 +71,14 @@ export class PgStacApiLambdaRuntime extends Construct {

this.lambdaFunction = new lambda.Function(this, "lambda", {
// defaults
runtime: lambda.Runtime.PYTHON_3_11,
runtime: lambda.Runtime.PYTHON_3_12,
handler: "handler.handler",
memorySize: 8192,
logRetention: aws_logs.RetentionDays.ONE_WEEK,
timeout: Duration.seconds(30),
code: lambda.Code.fromDockerBuild(path.join(__dirname, ".."), {
file: "stac-api/runtime/Dockerfile",
buildArgs: { PYTHON_VERSION: "3.11" },
buildArgs: { PYTHON_VERSION: "3.12" },
}),
vpc: props.vpc,
vpcSubnets: props.subnetSelection,
Expand Down
16 changes: 8 additions & 8 deletions lib/stac-loader/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {
CfnOutput,
Duration,
aws_ec2 as ec2,
aws_lambda as lambda,
aws_sqs as sqs,
aws_sns as sns,
aws_sns_subscriptions as snsSubscriptions,
aws_lambda_event_sources as lambdaEventSources,
aws_logs as logs,
Duration,
CfnOutput,
aws_sns as sns,
aws_sns_subscriptions as snsSubscriptions,
aws_sqs as sqs,
Stack,
} from "aws-cdk-lib";
import { Construct } from "constructs";
import { PgStacDatabase } from "../database";
import * as path from "path";
import { PgStacDatabase } from "../database";
import { CustomLambdaFunctionProps } from "../utils";

/**
Expand Down Expand Up @@ -61,7 +61,7 @@ export interface StacLoaderProps {
* operations. Ensure the runtime version is compatible with the pgstac
* version specified in the database configuration.
*
* @default lambda.Runtime.PYTHON_3_11
* @default lambda.Runtime.PYTHON_3_12
*/
readonly lambdaRuntime?: lambda.Runtime;

Expand Down Expand Up @@ -383,7 +383,7 @@ export class StacLoader extends Construct {
super(scope, id);

const timeoutSeconds = props.lambdaTimeoutSeconds ?? 300;
const lambdaRuntime = props.lambdaRuntime ?? lambda.Runtime.PYTHON_3_11;
const lambdaRuntime = props.lambdaRuntime ?? lambda.Runtime.PYTHON_3_12;
const maxConcurrency = props.maxConcurrency ?? 2;

// Create dead letter queue
Expand Down
2 changes: 1 addition & 1 deletion lib/stac-loader/runtime/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PYTHON_VERSION=3.11
ARG PYTHON_VERSION=3.12
FROM public.ecr.aws/lambda/python:${PYTHON_VERSION}
COPY --from=ghcr.io/astral-sh/uv:0.7.8 /uv /uvx /bin/

Expand Down
12 changes: 3 additions & 9 deletions lib/stac-loader/runtime/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
name = "stac-loader"
version = "0.1.0"
description = "An application for loading STAC collections and items into a pgstac database"
authors = [
{ name = "hrodmn", email = "henry@developmentseed.org" }
]
requires-python = ">=3.11"
dependencies = [
"boto3",
"pypgstac[psycopg]",
"stac-pydantic>=3.2.0",
]
authors = [{ name = "hrodmn", email = "henry@developmentseed.org" }]
requires-python = ">=3.12"
dependencies = ["boto3", "pypgstac[psycopg]", "stac-pydantic>=3.2.0"]

[build-system]
requires = ["hatchling"]
Expand Down
16 changes: 8 additions & 8 deletions lib/stactools-item-generator/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {
CfnOutput,
Duration,
aws_ec2 as ec2,
aws_lambda as lambda,
aws_sqs as sqs,
aws_sns as sns,
aws_sns_subscriptions as snsSubscriptions,
aws_lambda_event_sources as lambdaEventSources,
aws_logs as logs,
Duration,
CfnOutput,
aws_sns as sns,
aws_sns_subscriptions as snsSubscriptions,
aws_sqs as sqs,
Stack,
} from "aws-cdk-lib";
import { Construct } from "constructs";
import { Platform } from "aws-cdk-lib/aws-ecr-assets";
import { Construct } from "constructs";
import * as path from "path";
import { CustomLambdaFunctionProps } from "../utils";

Expand Down Expand Up @@ -39,7 +39,7 @@ export interface StactoolsItemGeneratorProps {
* stactools packages. The runtime version should be compatible with the
* packages you plan to use for STAC item generation.
*
* @default lambda.Runtime.PYTHON_3_11
* @default lambda.Runtime.PYTHON_3_12
*/
readonly lambdaRuntime?: lambda.Runtime;

Expand Down Expand Up @@ -288,7 +288,7 @@ export class StactoolsItemGenerator extends Construct {
super(scope, id);

const timeoutSeconds = props.lambdaTimeoutSeconds ?? 120;
const lambdaRuntime = props.lambdaRuntime ?? lambda.Runtime.PYTHON_3_11;
const lambdaRuntime = props.lambdaRuntime ?? lambda.Runtime.PYTHON_3_12;

// Create dead letter queue
this.deadLetterQueue = new sqs.Queue(this, "DeadLetterQueue", {
Expand Down
4 changes: 2 additions & 2 deletions lib/stactools-item-generator/runtime/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PYTHON_VERSION=3.11
ARG PYTHON_VERSION=3.12
FROM public.ecr.aws/lambda/python:${PYTHON_VERSION}
COPY --from=ghcr.io/astral-sh/uv:0.7.8 /uv /uvx /bin/

Expand All @@ -13,7 +13,7 @@ WORKDIR ${LAMBDA_TASK_ROOT}
COPY stactools-item-generator/runtime/pyproject.toml pyproject.toml
COPY stactools-item-generator/runtime/src/stactools_item_generator/ ${LAMBDA_TASK_ROOT}/stactools_item_generator/

RUN yum install -y git && yum clean all && rm -rf /var/cache/yum && \
RUN dnf install -y git && dnf clean all && rm -rf /var/cache/dnf && \
uv export --no-dev --no-editable -o requirements.txt && \
uv pip install --target ${LAMBDA_TASK_ROOT} -r requirements.txt && \
uv tool install --with "numpy<2.3.0",requests stactools;
Expand Down
11 changes: 3 additions & 8 deletions lib/stactools-item-generator/runtime/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@
name = "stactools-item-generator"
version = "0.1.0"
description = "An application for generating STAC metadata with any stactools package"
authors = [
{ name = "hrodmn", email = "henry@developmentseed.org" }
]
requires-python = ">=3.11"
dependencies = [
"pydantic>=2.11.0",
"stac-pydantic>=3.2.0",
]
authors = [{ name = "hrodmn", email = "henry@developmentseed.org" }]
requires-python = ">=3.12"
dependencies = ["pydantic>=2.11.0", "stac-pydantic>=3.2.0"]

[build-system]
requires = ["hatchling"]
Expand Down
12 changes: 6 additions & 6 deletions lib/tipg-api/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {
aws_apigatewayv2 as apigatewayv2,
CfnOutput,
Duration,
aws_ec2 as ec2,
aws_lambda as lambda,
aws_logs as logs,
aws_rds as rds,
aws_secretsmanager as secretsmanager,
Duration,
Stack,
CfnOutput,
} from "aws-cdk-lib";
import { Construct } from "constructs";
import { CustomLambdaFunctionProps } from "../utils";
import { LambdaApiGateway } from "../lambda-api-gateway";
import * as path from "path";
import { LambdaApiGateway } from "../lambda-api-gateway";
import { CustomLambdaFunctionProps } from "../utils";

export class TiPgApiLambdaRuntime extends Construct {
public readonly lambdaFunction: lambda.Function;
Expand All @@ -22,14 +22,14 @@ export class TiPgApiLambdaRuntime extends Construct {

this.lambdaFunction = new lambda.Function(this, "lambda", {
// defaults
runtime: lambda.Runtime.PYTHON_3_11,
runtime: lambda.Runtime.PYTHON_3_12,
handler: "handler.handler",
memorySize: 1024,
logRetention: logs.RetentionDays.ONE_WEEK,
timeout: Duration.seconds(30),
code: lambda.Code.fromDockerBuild(path.join(__dirname, ".."), {
file: "tipg-api/runtime/Dockerfile",
buildArgs: { PYTHON_VERSION: "3.11" },
buildArgs: { PYTHON_VERSION: "3.12" },
}),
vpc: props.vpc,
vpcSubnets: props.subnetSelection,
Expand Down
3 changes: 3 additions & 0 deletions lib/tipg-api/runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ COPY tipg-api/runtime/requirements.txt requirements.txt
RUN python -m pip install -r requirements.txt "mangum>=0.14,<0.15" -t /asset --no-binary pydantic

# Reduce package size and remove useless files
RUN dnf install -y findutils && \
dnf clean all && \
rm -rf /var/cache/dnf
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;
RUN cd /asset && find . -type d -a -name '__pycache__' -print0 | xargs -0 rm -rf
RUN cd /asset && find . -type f -a -name '*.py' -print0 | xargs -0 rm -f
Expand Down
Loading
Loading