Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ body:
attributes:
label: AWS Lambda function runtime
options:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/static_typing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ body:
attributes:
label: AWS Lambda function runtime
options:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_v3_layer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy v3 layer to all regions

# PROCESS
#
# 1. Compile Layer using cdk-aws-lambda-powertools-layer CDK construct for Python3.9-3.14 and x86_64/ARM architectures (uses custom runner as it's CPU heavy)
# 1. Compile Layer using cdk-aws-lambda-powertools-layer CDK construct for Python3.10-3.14 and x86_64/ARM architectures (uses custom runner as it's CPU heavy)
# 2. Kick off pipeline for beta, prod, and canary releases
# 3. Create PR to update trunk so staged docs also point to the latest Layer ARN, when merged
# 4. Builds and publishes docs with latest Layer ARN using given version (generally coming from release)
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
strategy:
max-parallel: 5
matrix:
python-version: ["3.9","3.10","3.11","3.12","3.13","3.14"]
python-version: ["3.10","3.11","3.12","3.13","3.14"]
defaults:
run:
working-directory: ./layer_v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quality_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
strategy:
max-parallel: 5
matrix:
python-version: ["3.9","3.10","3.11","3.12","3.13","3.14"]
python-version: ["3.10","3.11","3.12","3.13","3.14"]
env:
PYTHON: "${{ matrix.python-version }}"
permissions:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable_deploy_v3_layer_stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy CDK Layer v3 stack
# PROCESS
#
# 1. Split what AWS regions support ARM vs regions that Lambda support ARM
# 2. We build the Lambda layer for 3.9 to 3.14 Python runtime and both x86_64 and arm64 (see `matrix` section)
# 2. We build the Lambda layer for 3.10 to 3.14 Python runtime and both x86_64 and arm64 (see `matrix` section)
# 3. Deploy previously built layer for each AWS commercial region
# 4. Export all published Layers as JSON
# 5. Deploy Canaries to every deployed region to test whether Powertools can be imported etc.
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
"eu-north-1", "eu-south-1", "eu-south-2", "eu-west-1", "eu-west-2", "eu-west-3",
"il-central-1", "me-central-1", "me-south-1", "mx-central-1", "sa-east-1", "us-east-1",
"us-east-2", "us-west-1", "us-west-2"]
python-version: ["3.9","3.10","3.11","3.12","3.13","3.14"]
python-version: ["3.10","3.11","3.12","3.13","3.14"]
include:
- region: "af-south-1"
has_arm64_support: "true"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable_deploy_v3_sar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Deploy V3 SAR
#
# 1. This workflow starts after the layer artifact is produced on `publish_v3_layer`
# 2. We use the same layer artifact to ensure the SAR app is consistent with the published Lambda Layer
# 3. We publish the SAR for 3.9 to 3.13 Python runtime and both x86_64 and arm64 (see `matrix` section)
# 3. We publish the SAR for 3.10 to 3.14 Python runtime and both x86_64 and arm64 (see `matrix` section)
# 4. We use `sam package` and `sam publish` to publish the SAR app
# 5. We remove the previous Canary stack (if present) and deploy a new one to test the SAR App. We retain the Canary in the account for debugging purposes
# 6. Finally the published SAR app is made public on the PROD environment
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
strategy:
matrix:
architecture: ["x86_64", "arm64"]
python-version: ["3.9","3.10","3.11","3.12","3.13","3.14"]
python-version: ["3.10","3.11","3.12","3.13","3.14"]
steps:
- name: checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
strategy:
fail-fast: false # needed so if a version fails, the others will still be able to complete and cleanup
matrix:
version: ["3.9", "3.10", "3.11", "3.12","3.13","3.14"]
version: ["3.10", "3.11", "3.12","3.13","3.14"]
if: ${{ github.actor != 'dependabot[bot]' && github.repository == 'aws-powertools/powertools-lambda-python' }}
steps:
- name: "Checkout"
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/update_ssm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,12 @@ jobs:
PACKAGE_VERSION: ${{ inputs.package_version }}
LAYER_VERSION: ${{ inputs.layer_version }}
run: |
aws ssm put-parameter --name ${{ env.prefix }}/python/arm64/python3.9/$PACKAGE_VERSION --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python39-arm64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/arm64/python3.10/$PACKAGE_VERSION --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python310-arm64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/arm64/python3.11/$PACKAGE_VERSION --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python311-arm64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/arm64/python3.12/$PACKAGE_VERSION --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-arm64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/arm64/python3.13/$PACKAGE_VERSION --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python313-arm64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/arm64/python3.14/$PACKAGE_VERSION --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python314-arm64:$LAYER_VERSION" --type String --overwrite

aws ssm put-parameter --name ${{ env.prefix }}/python/x86_64/python3.9/$PACKAGE_VERSION --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python39-x86_64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/x86_64/python3.10/$PACKAGE_VERSION --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python310-x86_64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/x86_64/python3.11/$PACKAGE_VERSION --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python311-x86_64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/x86_64/python3.12/$PACKAGE_VERSION --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:$LAYER_VERSION" --type String --overwrite
Expand All @@ -120,14 +118,12 @@ jobs:
prefix: ${{ inputs.environment == 'beta' && '/aws/service/powertools/beta' || '/aws/service/powertools' }}
LAYER_VERSION: ${{ inputs.layer_version }}
run: |
aws ssm put-parameter --name ${{ env.prefix }}/python/arm64/python3.9/latest --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python39-arm64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/arm64/python3.10/latest --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python310-arm64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/arm64/python3.11/latest --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python311-arm64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/arm64/python3.12/latest --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-arm64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/arm64/python3.13/latest --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python313-arm64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/arm64/python3.14/latest --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python314-arm64:$LAYER_VERSION" --type String --overwrite

aws ssm put-parameter --name ${{ env.prefix }}/python/x86_64/python3.9/latest --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python39-x86_64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/x86_64/python3.10/latest --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python310-x86_64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/x86_64/python3.11/latest --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python311-x86_64:$LAYER_VERSION" --type String --overwrite
aws ssm put-parameter --name ${{ env.prefix }}/python/x86_64/python3.12/latest --value "arn:aws:lambda:${{ matrix.region }}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:$LAYER_VERSION" --type String --overwrite
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[![Build](https://github.com/aws-powertools/powertools-lambda-python/actions/workflows/quality_check.yml/badge.svg)](https://github.com/aws-powertools/powertools-lambda-python/actions/workflows/python_build.yml)
[![codecov.io](https://codecov.io/github/aws-powertools/powertools-lambda-python/branch/develop/graphs/badge.svg)](https://app.codecov.io/gh/aws-powertools/powertools-lambda-python)
![PythonSupport](https://img.shields.io/static/v1?label=python&message=%203.9|%203.10|%203.11|%203.12|%203.13|%203.14&color=blue?style=flat-square&logo=python) ![PyPI version](https://badge.fury.io/py/aws-lambda-powertools.svg) ![PyPi monthly downloads](https://img.shields.io/pypi/dm/aws-lambda-powertools) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/aws-powertools/powertools-lambda-python/badge)](https://api.securityscorecards.dev/projects/github.com/aws-powertools/powertools-lambda-python)
![PythonSupport](https://img.shields.io/static/v1?label=python&message=%203.10|%203.11|%203.12|%203.13|%203.14&color=blue?style=flat-square&logo=python) ![PyPI version](https://badge.fury.io/py/aws-lambda-powertools.svg) ![PyPi monthly downloads](https://img.shields.io/pypi/dm/aws-lambda-powertools) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/aws-powertools/powertools-lambda-python/badge)](https://api.securityscorecards.dev/projects/github.com/aws-powertools/powertools-lambda-python)
[![Discord](https://img.shields.io/badge/Discord-Join_Community-7289da.svg)](https://discord.gg/B8zZKbbyET)

Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverless [best practices and increase developer velocity](https://docs.powertools.aws.dev/lambda/python/latest/#features).
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_powertools/event_handler/openapi/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def extract_metadata(ann: Any) -> tuple[Any, list[Any]]:
base_type, constraints = extract_metadata(annotation)

# Set the annotation with base type and all constraint metadata
# Use tuple unpacking for Python 3.9+ compatibility
# Use tuple unpacking for Python 3.10+ compatibility
if constraints:
new_field.annotation = Annotated[(base_type, *constraints)]
else:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import sys
from types import UnionType # Available in Python 3.10+
from typing import Any, Optional, Union, get_args, get_origin

# Conditionally import or define UnionType based on Python version
if sys.version_info >= (3, 10):
from types import UnionType # Available in Python 3.10+
else:
UnionType = Union # Fallback for Python 3.9

from aws_lambda_powertools.utilities.idempotency.exceptions import (
IdempotencyModelTypeError,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@

import sys
from dataclasses import is_dataclass
from types import UnionType # Available in Python 3.10+
from typing import TYPE_CHECKING, Annotated, Any, Optional, Union, get_args, get_origin

# Conditionally import or define UnionType based on Python version
if sys.version_info >= (3, 10):
from types import UnionType # Available in Python 3.10+
else:
UnionType = Union # Fallback for Python 3.9

from aws_lambda_powertools.utilities.kafka.serialization.custom_dict import CustomDictOutputSerializer
from aws_lambda_powertools.utilities.kafka.serialization.dataclass import DataclassOutputSerializer

Expand Down
9 changes: 2 additions & 7 deletions docs/automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ This is a snapshot of our automated checks at a glance.
To build and deploy the Lambda Layers, we run a pipeline with the following steps:

* We fetch the latest PyPi release and use it as the source for our layer.
* We build Python versions ranging from **3.9 to 3.14** for x86_64 and arm64 architectures. This is necessary because we use pre-compiled libraries like **Pydantic** and **Cryptography**, which require specific Python versions for each layer.
* We build Python versions ranging from **10 to 3.14** for x86_64 and arm64 architectures. This is necessary because we use pre-compiled libraries like **Pydantic** and **Cryptography**, which require specific Python versions for each layer.
* We provide layer distributions for both the **x86_64** and **arm64** architectures.
* For each Python version, we create a single CDK package containing both x86_64 and arm64 assets to optimize deployment performance.

Expand All @@ -106,16 +106,13 @@ Next, we deploy these CDK Assets to the beta account across all AWS regions. Onc

```mermaid
graph LR
Fetch[Fetch PyPi release] --> P39[<strong>Python 3.9</strong>]
Fetch --> P310[<strong>Python 3.10</strong>]
Fetch[Fetch PyPi release] --> P310[<strong>Python 3.10</strong>]
Fetch --> P311[<strong>Python 3.11</strong>]
Fetch --> P312[<strong>Python 3.12</strong>]
Fetch --> P313[<strong>Python 3.13</strong>]
Fetch --> P314[<strong>Python 3.14</strong>]

subgraph build ["LAYER BUILD"]
P39 --> P39x86[build x86_64]
P39 --> P39arm64[build arm64]
P310 --> P310x86[build x86_64]
P310 --> P310arm64[build arm64]
P311 --> P311x86[build x86_64]
Expand All @@ -126,8 +123,6 @@ graph LR
P313 --> P313arm64[build arm64]
P314 --> P314x86[build x86_64]
P314 --> P314arm64[build arm64]
P39x86 --> CDKP2[CDK Package]
P39arm64 --> CDKP2[CDK Package]
P310x86 --> CDKP3[CDK Package]
P310arm64 --> CDKP3[CDK Package]
P311x86 --> CDKP4[CDK Package]
Expand Down
1 change: 0 additions & 1 deletion docs/build_recipes/cross-platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ Lambda managed runtimes use [specific Amazon Linux versions](https://docs.aws.am

| Python Runtime | Base System | GLIBC Version | Architecture Support |
|----------------|-------------------|---------------|----------------------|
| **python3.9** | Amazon Linux 2 | 2.26 | x86_64, arm64 |
| **python3.10** | Amazon Linux 2 | 2.26 | x86_64, arm64 |
| **python3.11** | Amazon Linux 2 | 2.26 | x86_64, arm64 |
| **python3.12** | Amazon Linux 2023 | 2.34 | x86_64, arm64 |
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ graph LR
Unless you're using the pre-configured Cloud environment, you'll need the following installed:

* [GitHub account](https://github.com/join){target="_blank" rel="nofollow"}. You'll need to be able to fork, clone, and contribute via pull request.
* [Python 3.9+](https://www.python.org/downloads/){target="_blank" rel="nofollow"}. Pick any version supported in [AWS Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).
* [Python 3.10+](https://www.python.org/downloads/){target="_blank" rel="nofollow"}. Pick any version supported in [AWS Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).
* [Docker](https://docs.docker.com/engine/install/){target="_blank" rel="nofollow"}. We use it to run documentation linters and non-Python tooling.
* [Fork the repository](https://github.com/aws-powertools/powertools-lambda-python/fork). You'll work against your fork of this repository.

Expand Down
6 changes: 3 additions & 3 deletions docs/core/event_handler/api_gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ Even better, we can also let Event Handler validate and convert our response acc

##### Validating payload subset

With the addition of the [`Annotated` type starting in Python 3.9](https://docs.python.org/3/library/typing.html#typing.Annotated){target="_blank" rel="nofollow"}, types can contain additional metadata, allowing us to represent anything we want.
With the addition of the [`Annotated` type starting in Python 3.10](https://docs.python.org/3/library/typing.html#typing.Annotated){target="_blank" rel="nofollow"}, types can contain additional metadata, allowing us to represent anything we want.

We use the `Annotated` and OpenAPI `Body` type to instruct Event Handler that our payload is located in a particular JSON key.

Expand Down Expand Up @@ -494,7 +494,7 @@ In the following example, we use a new `Query` OpenAPI type to add [one out of m
--8<-- "examples/event_handler_rest/src/validating_query_strings.py"
```

1. If you're not using Python 3.9 or higher, you can install and use [`typing_extensions`](https://pypi.org/project/typing-extensions/){target="_blank" rel="nofollow"} to the same effect
1. If you're not using Python 10 or higher, you can install and use [`typing_extensions`](https://pypi.org/project/typing-extensions/){target="_blank" rel="nofollow"} to the same effect
2. `Query` is a special OpenAPI type that can add constraints to a query string as well as document them
3. **First time seeing `Annotated`?** <br><br> This special type uses the first argument as the actual type, and subsequent arguments as metadata. <br><br> At runtime, static checkers will also see the first argument, but any receiver can inspect it to get the metadata.

Expand Down Expand Up @@ -564,7 +564,7 @@ In the following example, we use a new `Header` OpenAPI type to add [one out of
--8<-- "examples/event_handler_rest/src/validating_headers.py"
```

1. If you're not using Python 3.9 or higher, you can install and use [`typing_extensions`](https://pypi.org/project/typing-extensions/){target="_blank" rel="nofollow"} to the same effect
1. If you're not using Python 3.10 or higher, you can install and use [`typing_extensions`](https://pypi.org/project/typing-extensions/){target="_blank" rel="nofollow"} to the same effect
2. `Header` is a special OpenAPI type that can add constraints and documentation to a header
3. **First time seeing `Annotated`?** <br><br> This special type uses the first argument as the actual type, and subsequent arguments as metadata. <br><br> At runtime, static checkers will also see the first argument, but any receiver can inspect it to get the metadata.

Expand Down
1 change: 0 additions & 1 deletion docs/core/event_handler/bedrock_agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ You can use `BedrockResponse` class to add additional fields as needed, such as

???+ tip "Content Type Behavior"
Amazon Bedrock Agents only support TEXT content type in the responseBody. All response bodies are automatically serialized as JSON strings regardless of the `content_type` parameter you provide. The `content_type` parameter exists for API consistency but does not affect the actual format sent to Bedrock Agents.

Learn more: [AWS Bedrock Lambda Integration](https://docs.aws.amazon.com/bedrock/latest/userguide/agents-lambda.html){target="_blank"}

```python title="working_with_bedrockresponse.py" title="Customzing your Bedrock Response" hl_lines="5 16"
Expand Down
Loading
Loading