Skip to content

Commit 2a62011

Browse files
authored
feat(python): bump to 3.12 (#178)
1 parent 2a35757 commit 2a62011

File tree

18 files changed

+241
-306
lines changed

18 files changed

+241
-306
lines changed

.github/workflows/lint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414

15-
- name: Set up Python 3.11
15+
- name: Set up Python 3.12
1616
uses: actions/setup-python@v5
1717
with:
18-
python-version: 3.11
18+
python-version: 3.12
1919

2020
- name: Install dependencies
2121
run: |

.github/workflows/tox.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
python: [3.11]
13+
python: [3.12]
1414
steps:
1515
- uses: actions/checkout@v4
1616
- name: Setup Python

lib/database/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {
2-
Stack,
3-
aws_rds as rds,
4-
aws_ec2 as ec2,
5-
aws_secretsmanager as secretsmanager,
6-
aws_lambda,
72
CustomResource,
8-
RemovalPolicy,
93
Duration,
4+
RemovalPolicy,
5+
Stack,
6+
aws_lambda,
107
aws_logs,
8+
aws_ec2 as ec2,
9+
aws_rds as rds,
10+
aws_secretsmanager as secretsmanager,
1111
} from "aws-cdk-lib";
1212
import { Construct } from "constructs";
1313
import { CustomLambdaFunctionProps, DEFAULT_PGSTAC_VERSION } from "../utils";
@@ -74,15 +74,15 @@ export class PgStacDatabase extends Construct {
7474

7575
const handler = new aws_lambda.Function(this, "lambda", {
7676
// defaults
77-
runtime: aws_lambda.Runtime.PYTHON_3_11,
77+
runtime: aws_lambda.Runtime.PYTHON_3_12,
7878
handler: "handler.handler",
7979
memorySize: 128,
8080
logRetention: aws_logs.RetentionDays.ONE_WEEK,
8181
timeout: Duration.minutes(2),
8282
code: aws_lambda.Code.fromDockerBuild(__dirname, {
8383
file: "bootstrapper_runtime/Dockerfile",
8484
buildArgs: {
85-
PYTHON_VERSION: "3.11",
85+
PYTHON_VERSION: "3.12",
8686
PGSTAC_VERSION: this.pgstacVersion,
8787
},
8888
}),

lib/ingestor-api/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import {
22
aws_apigateway as apigateway,
3+
aws_logs,
4+
Duration,
35
aws_dynamodb as dynamodb,
46
aws_ec2 as ec2,
7+
aws_lambda_event_sources as events,
58
aws_iam as iam,
69
aws_lambda as lambda,
7-
aws_logs,
8-
aws_lambda_event_sources as events,
10+
RemovalPolicy,
911
aws_secretsmanager as secretsmanager,
1012
aws_ssm as ssm,
11-
Duration,
12-
RemovalPolicy,
1313
Stack,
1414
} from "aws-cdk-lib";
1515
import { Construct } from "constructs";
@@ -118,15 +118,15 @@ export class StacIngestor extends Construct {
118118
}): lambda.Function {
119119
const handler = new lambda.Function(this, "api-handler", {
120120
// defaults
121-
runtime: lambda.Runtime.PYTHON_3_11,
121+
runtime: lambda.Runtime.PYTHON_3_12,
122122
handler: "src.handler.handler",
123123
memorySize: 2048,
124124
logRetention: aws_logs.RetentionDays.ONE_WEEK,
125125
timeout: Duration.seconds(30),
126126
code: lambda.Code.fromDockerBuild(__dirname, {
127127
file: "runtime/Dockerfile",
128128
buildArgs: {
129-
PYTHON_VERSION: "3.11",
129+
PYTHON_VERSION: "3.12",
130130
PGSTAC_VERSION: props.pgstacVersion || DEFAULT_PGSTAC_VERSION,
131131
},
132132
}),
@@ -169,15 +169,15 @@ export class StacIngestor extends Construct {
169169
}): lambda.Function {
170170
const handler = new lambda.Function(this, "stac-ingestor", {
171171
// defaults
172-
runtime: lambda.Runtime.PYTHON_3_11,
172+
runtime: lambda.Runtime.PYTHON_3_12,
173173
handler: "src.ingestor.handler",
174174
memorySize: 2048,
175175
logRetention: aws_logs.RetentionDays.ONE_WEEK,
176176
timeout: Duration.seconds(180),
177177
code: lambda.Code.fromDockerBuild(__dirname, {
178178
file: "runtime/Dockerfile",
179179
buildArgs: {
180-
PYTHON_VERSION: "3.11",
180+
PYTHON_VERSION: "3.12",
181181
PGSTAC_VERSION: props.pgstacVersion || DEFAULT_PGSTAC_VERSION,
182182
},
183183
}),

lib/ingestor-api/runtime/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM --platform=linux/amd64 public.ecr.aws/lambda/python:${PYTHON_VERSION}
44

55
WORKDIR /tmp
66

7-
RUN yum install -y git
7+
RUN dnf install -y git
88

99
RUN python -m pip install pip -U
1010

lib/stac-api/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import {
22
aws_apigatewayv2 as apigatewayv2,
3+
aws_logs,
4+
CfnOutput,
5+
Duration,
36
aws_ec2 as ec2,
4-
aws_rds as rds,
57
aws_lambda as lambda,
8+
aws_rds as rds,
69
aws_secretsmanager as secretsmanager,
7-
Duration,
8-
aws_logs,
9-
CfnOutput,
1010
Stack,
1111
} from "aws-cdk-lib";
1212
import { Construct } from "constructs";
13-
import { CustomLambdaFunctionProps } from "../utils";
14-
import { LambdaApiGateway } from "../lambda-api-gateway";
1513
import * as path from "path";
14+
import { LambdaApiGateway } from "../lambda-api-gateway";
15+
import { CustomLambdaFunctionProps } from "../utils";
1616

1717
export const EXTENSIONS = {
1818
QUERY: "query",
@@ -71,14 +71,14 @@ export class PgStacApiLambdaRuntime extends Construct {
7171

7272
this.lambdaFunction = new lambda.Function(this, "lambda", {
7373
// defaults
74-
runtime: lambda.Runtime.PYTHON_3_11,
74+
runtime: lambda.Runtime.PYTHON_3_12,
7575
handler: "handler.handler",
7676
memorySize: 8192,
7777
logRetention: aws_logs.RetentionDays.ONE_WEEK,
7878
timeout: Duration.seconds(30),
7979
code: lambda.Code.fromDockerBuild(path.join(__dirname, ".."), {
8080
file: "stac-api/runtime/Dockerfile",
81-
buildArgs: { PYTHON_VERSION: "3.11" },
81+
buildArgs: { PYTHON_VERSION: "3.12" },
8282
}),
8383
vpc: props.vpc,
8484
vpcSubnets: props.subnetSelection,

lib/stac-loader/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import {
2+
CfnOutput,
3+
Duration,
24
aws_ec2 as ec2,
35
aws_lambda as lambda,
4-
aws_sqs as sqs,
5-
aws_sns as sns,
6-
aws_sns_subscriptions as snsSubscriptions,
76
aws_lambda_event_sources as lambdaEventSources,
87
aws_logs as logs,
9-
Duration,
10-
CfnOutput,
8+
aws_sns as sns,
9+
aws_sns_subscriptions as snsSubscriptions,
10+
aws_sqs as sqs,
1111
Stack,
1212
} from "aws-cdk-lib";
1313
import { Construct } from "constructs";
14-
import { PgStacDatabase } from "../database";
1514
import * as path from "path";
15+
import { PgStacDatabase } from "../database";
1616
import { CustomLambdaFunctionProps } from "../utils";
1717

1818
/**
@@ -61,7 +61,7 @@ export interface StacLoaderProps {
6161
* operations. Ensure the runtime version is compatible with the pgstac
6262
* version specified in the database configuration.
6363
*
64-
* @default lambda.Runtime.PYTHON_3_11
64+
* @default lambda.Runtime.PYTHON_3_12
6565
*/
6666
readonly lambdaRuntime?: lambda.Runtime;
6767

@@ -383,7 +383,7 @@ export class StacLoader extends Construct {
383383
super(scope, id);
384384

385385
const timeoutSeconds = props.lambdaTimeoutSeconds ?? 300;
386-
const lambdaRuntime = props.lambdaRuntime ?? lambda.Runtime.PYTHON_3_11;
386+
const lambdaRuntime = props.lambdaRuntime ?? lambda.Runtime.PYTHON_3_12;
387387
const maxConcurrency = props.maxConcurrency ?? 2;
388388

389389
// Create dead letter queue

lib/stac-loader/runtime/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PYTHON_VERSION=3.11
1+
ARG PYTHON_VERSION=3.12
22
FROM public.ecr.aws/lambda/python:${PYTHON_VERSION}
33
COPY --from=ghcr.io/astral-sh/uv:0.7.8 /uv /uvx /bin/
44

lib/stac-loader/runtime/pyproject.toml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,9 @@
22
name = "stac-loader"
33
version = "0.1.0"
44
description = "An application for loading STAC collections and items into a pgstac database"
5-
authors = [
6-
{ name = "hrodmn", email = "[email protected]" }
7-
]
8-
requires-python = ">=3.11"
9-
dependencies = [
10-
"boto3",
11-
"pypgstac[psycopg]",
12-
"stac-pydantic>=3.2.0",
13-
]
5+
authors = [{ name = "hrodmn", email = "[email protected]" }]
6+
requires-python = ">=3.12"
7+
dependencies = ["boto3", "pypgstac[psycopg]", "stac-pydantic>=3.2.0"]
148

159
[build-system]
1610
requires = ["hatchling"]

lib/stactools-item-generator/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import {
2+
CfnOutput,
3+
Duration,
24
aws_ec2 as ec2,
35
aws_lambda as lambda,
4-
aws_sqs as sqs,
5-
aws_sns as sns,
6-
aws_sns_subscriptions as snsSubscriptions,
76
aws_lambda_event_sources as lambdaEventSources,
87
aws_logs as logs,
9-
Duration,
10-
CfnOutput,
8+
aws_sns as sns,
9+
aws_sns_subscriptions as snsSubscriptions,
10+
aws_sqs as sqs,
1111
Stack,
1212
} from "aws-cdk-lib";
13-
import { Construct } from "constructs";
1413
import { Platform } from "aws-cdk-lib/aws-ecr-assets";
14+
import { Construct } from "constructs";
1515
import * as path from "path";
1616
import { CustomLambdaFunctionProps } from "../utils";
1717

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

@@ -288,7 +288,7 @@ export class StactoolsItemGenerator extends Construct {
288288
super(scope, id);
289289

290290
const timeoutSeconds = props.lambdaTimeoutSeconds ?? 120;
291-
const lambdaRuntime = props.lambdaRuntime ?? lambda.Runtime.PYTHON_3_11;
291+
const lambdaRuntime = props.lambdaRuntime ?? lambda.Runtime.PYTHON_3_12;
292292

293293
// Create dead letter queue
294294
this.deadLetterQueue = new sqs.Queue(this, "DeadLetterQueue", {

0 commit comments

Comments
 (0)