From 5507b37c442545c4ea0dcca3c557b37f58273fa8 Mon Sep 17 00:00:00 2001 From: Simon Thulbourn Date: Tue, 23 May 2023 10:36:17 +0000 Subject: [PATCH 1/4] chore: rename project to Powertools for AWS Lambda (Python) --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .github/ISSUE_TEMPLATE/feature_request.yml | 8 +-- .github/ISSUE_TEMPLATE/maintenance.yml | 4 +- .github/ISSUE_TEMPLATE/rfc.yml | 6 +- .github/ISSUE_TEMPLATE/share_your_work.yml | 8 +-- .github/ISSUE_TEMPLATE/static_typing.yml | 2 +- .github/ISSUE_TEMPLATE/support_powertools.yml | 12 ++-- .github/ISSUE_TEMPLATE/tech_debt.yml | 4 +- .github/actions/create-pr/action.yml | 4 +- .github/boring-cyborg.yml | 4 +- .github/workflows/release.yml | 2 +- CHANGELOG.md | 10 ++-- MAINTAINERS.md | 4 +- README.md | 16 ++--- aws_lambda_powertools/logging/formatter.py | 2 +- aws_lambda_powertools/logging/logger.py | 10 ++-- aws_lambda_powertools/logging/utils.py | 4 +- aws_lambda_powertools/package_logger.py | 2 +- .../utilities/validation/exceptions.py | 2 +- benchmark/README.md | 2 +- docs/core/event_handler/api_gateway.md | 2 +- docs/core/event_handler/appsync.md | 2 +- docs/core/logger.md | 12 ++-- docs/core/tracer.md | 2 +- docs/index.md | 40 ++++++------- docs/roadmap.md | 2 +- docs/tutorial/index.md | 34 +++++------ docs/upgrade.md | 6 +- docs/utilities/feature_flags.md | 4 +- docs/utilities/idempotency.md | 4 +- docs/utilities/jmespath_functions.md | 8 +-- docs/utilities/middleware_factory.md | 4 +- docs/utilities/parser.md | 2 +- docs/utilities/validation.md | 2 +- docs/we_made_this.md | 32 +++++----- .../event_handler_graphql/sam/template.yaml | 2 +- layer/README.md | 12 ++-- layer/app.py | 2 +- layer/layer/canary/app.py | 8 +-- layer/pyproject.toml | 2 +- layer/scripts/layer-balancer/main.go | 4 +- mkdocs.yml | 4 +- pyproject.toml | 4 +- .../idempotency/test_idempotency_dynamodb.py | 10 ++-- tests/e2e/parameters/infrastructure.py | 4 +- tests/e2e/utils/data_fetcher/logs.py | 2 +- .../idempotency/test_idempotency.py | 2 +- tests/functional/test_logger.py | 2 +- tests/functional/test_logger_utils.py | 58 +++++++++---------- 49 files changed, 190 insertions(+), 190 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index f9fa23ae952..43e6d32030b 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -48,7 +48,7 @@ body: - type: input id: version attributes: - label: AWS Lambda Powertools for Python version + label: Powertools for AWS Lambda (Python) version placeholder: "latest, 1.25.6" value: latest validations: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 53e362cc779..b0a5c687e18 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,12 +1,12 @@ name: Feature request -description: Suggest an idea for Lambda Powertools +description: Suggest an idea for Powertools for AWS Lambda (Python) title: "Feature request: TITLE" labels: ["feature-request", "triage"] body: - type: markdown attributes: value: | - Thank you for taking the time to suggest an idea to the Lambda Powertools project. + Thank you for taking the time to suggest an idea to the Powertools for AWS Lambda (Python) project. *Future readers*: Please react with πŸ‘ and your use case to help us understand customer demand. - type: textarea @@ -36,9 +36,9 @@ body: attributes: label: Acknowledgment options: - - label: This feature request meets [Lambda Powertools Tenets](https://awslabs.github.io/aws-lambda-powertools-python/latest/#tenets) + - label: This feature request meets [Powertools for AWS Lambda (Python) Tenets](https://awslabs.github.io/aws-lambda-powertools-python/latest/#tenets) required: true - - label: Should this be considered in other Lambda Powertools languages? i.e. [Java](https://github.com/awslabs/aws-lambda-powertools-java/), [TypeScript](https://github.com/awslabs/aws-lambda-powertools-typescript/), and [.NET](https://github.com/awslabs/aws-lambda-powertools-dotnet/) + - label: Should this be considered in other Powertools for AWS Lambda languages? i.e. [Java](https://github.com/awslabs/aws-lambda-powertools-java/), [TypeScript](https://github.com/awslabs/aws-lambda-powertools-typescript/), and [.NET](https://github.com/awslabs/aws-lambda-powertools-dotnet/) required: false - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/maintenance.yml b/.github/ISSUE_TEMPLATE/maintenance.yml index 9f9798c8aed..2d9f7a32b07 100644 --- a/.github/ISSUE_TEMPLATE/maintenance.yml +++ b/.github/ISSUE_TEMPLATE/maintenance.yml @@ -53,9 +53,9 @@ body: attributes: label: Acknowledgment options: - - label: This request meets [Lambda Powertools Tenets](https://awslabs.github.io/aws-lambda-powertools-python/latest/#tenets) + - label: This request meets [Powertools for AWS Lambda (Python) Tenets](https://awslabs.github.io/aws-lambda-powertools-python/latest/#tenets) required: true - - label: Should this be considered in other Lambda Powertools languages? i.e. [Java](https://github.com/awslabs/aws-lambda-powertools-java/), [TypeScript](https://github.com/awslabs/aws-lambda-powertools-typescript/), and [.NET](https://github.com/awslabs/aws-lambda-powertools-dotnet/) + - label: Should this be considered in other Powertools for AWS Lambda languages? i.e. [Java](https://github.com/awslabs/aws-lambda-powertools-java/), [TypeScript](https://github.com/awslabs/aws-lambda-powertools-typescript/), and [.NET](https://github.com/awslabs/aws-lambda-powertools-dotnet/) required: false - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/rfc.yml b/.github/ISSUE_TEMPLATE/rfc.yml index 457ae558bc6..95108a58dbb 100644 --- a/.github/ISSUE_TEMPLATE/rfc.yml +++ b/.github/ISSUE_TEMPLATE/rfc.yml @@ -15,7 +15,7 @@ body: - type: dropdown id: area attributes: - label: Which AWS Lambda Powertools utility does this relate to? + label: Which Powertools for AWS Lambda (Python) utility does this relate to? options: - Tracer - Logger @@ -91,9 +91,9 @@ body: attributes: label: Acknowledgment options: - - label: This feature request meets [Lambda Powertools Tenets](https://awslabs.github.io/aws-lambda-powertools-python/latest/#tenets) + - label: This feature request meets [Powertools for AWS Lambda (Python) Tenets](https://awslabs.github.io/aws-lambda-powertools-python/latest/#tenets) required: true - - label: Should this be considered in other Lambda Powertools languages? i.e. [Java](https://github.com/awslabs/aws-lambda-powertools-java/), [TypeScript](https://github.com/awslabs/aws-lambda-powertools-typescript/), and [.NET](https://github.com/awslabs/aws-lambda-powertools-dotnet/) + - label: Should this be considered in other Powertools for AWS Lambda languages? i.e. [Java](https://github.com/awslabs/aws-lambda-powertools-java/), [TypeScript](https://github.com/awslabs/aws-lambda-powertools-typescript/), and [.NET](https://github.com/awslabs/aws-lambda-powertools-dotnet/) required: false - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/share_your_work.yml b/.github/ISSUE_TEMPLATE/share_your_work.yml index 974aec87b06..e4e4ed601be 100644 --- a/.github/ISSUE_TEMPLATE/share_your_work.yml +++ b/.github/ISSUE_TEMPLATE/share_your_work.yml @@ -1,5 +1,5 @@ name: I Made This (showcase your work) -description: Share what you did with Powertools πŸ’žπŸ’ž. Blog post, workshops, presentation, sample apps, etc. +description: Share what you did with Powertools for AWS Lambda (Python) πŸ’žπŸ’ž. Blog post, workshops, presentation, sample apps, etc. title: "[I Made This]: " labels: ["community-content"] body: @@ -13,7 +13,7 @@ body: description: | Please share the original link to your material. - *Note: Short links will be expanded when added to Powertools documentation* + *Note: Short links will be expanded when added to Powertools for AWS Lambda (Python) documentation* validations: required: true - type: textarea @@ -44,7 +44,7 @@ body: description: | Any notes you might want to share with us related to this material. - *Note: These notes are explicitly to Powertools maintainers. It will not be added to the community resources page.* + *Note: These notes are explicitly to Powertools for AWS Lambda (Python) maintainers. It will not be added to the community resources page.* validations: required: false - type: checkboxes @@ -52,5 +52,5 @@ body: attributes: label: Acknowledgment options: - - label: I understand this content may be removed from Powertools documentation if it doesn't conform with the [Code of Conduct](https://aws.github.io/code-of-conduct) + - label: I understand this content may be removed from Powertools for AWS Lambda (Python) documentation if it doesn't conform with the [Code of Conduct](https://aws.github.io/code-of-conduct) required: true diff --git a/.github/ISSUE_TEMPLATE/static_typing.yml b/.github/ISSUE_TEMPLATE/static_typing.yml index 60f216d3b92..42168abaa1f 100644 --- a/.github/ISSUE_TEMPLATE/static_typing.yml +++ b/.github/ISSUE_TEMPLATE/static_typing.yml @@ -34,7 +34,7 @@ body: - type: input id: version attributes: - label: AWS Lambda Powertools for Python version + label: Powertools for AWS Lambda (Python) version placeholder: "latest, 1.25.6" value: latest validations: diff --git a/.github/ISSUE_TEMPLATE/support_powertools.yml b/.github/ISSUE_TEMPLATE/support_powertools.yml index e03b1627044..c2c5f33676c 100644 --- a/.github/ISSUE_TEMPLATE/support_powertools.yml +++ b/.github/ISSUE_TEMPLATE/support_powertools.yml @@ -1,6 +1,6 @@ -name: Support Lambda Powertools (become a reference) -description: Add your organization's name or logo to the Lambda Powertools documentation -title: "[Support Lambda Powertools]: <your organization name>" +name: Support Powertools for AWS Lambda (Python) (become a reference) +description: Add your organization's name or logo to the Powertools for AWS Lambda (Python) documentation +title: "[Support Powertools for AWS Lambda (Python)]: <your organization name>" labels: ["customer-reference"] body: - type: markdown @@ -42,13 +42,13 @@ body: id: use_case attributes: label: (Optional) Use case - description: How are you using Lambda Powertools today? *features, etc.* + description: How are you using Powertools for AWS Lambda (Python) today? *features, etc.* validations: required: false - type: checkboxes id: other_languages attributes: - label: Also using other Lambda Powertools languages? + label: Also using other Powertools for AWS Lambda languages? options: - label: Java required: false @@ -59,6 +59,6 @@ body: - type: markdown attributes: value: | - *By raising a Support Lambda Powertools issue, you are granting AWS permission to use your company's name (and/or logo) for the limited purpose described here. You are also confirming that you have authority to grant such permission.* + *By raising a Support Powertools for AWS Lambda (Python) issue, you are granting AWS permission to use your company's name (and/or logo) for the limited purpose described here. You are also confirming that you have authority to grant such permission.* *You can opt-out at any time by commenting or reopening this issue.* diff --git a/.github/ISSUE_TEMPLATE/tech_debt.yml b/.github/ISSUE_TEMPLATE/tech_debt.yml index f2933cb4ce8..bca5dd25c8a 100644 --- a/.github/ISSUE_TEMPLATE/tech_debt.yml +++ b/.github/ISSUE_TEMPLATE/tech_debt.yml @@ -50,9 +50,9 @@ body: attributes: label: Acknowledgment options: - - label: This request meets [Lambda Powertools Tenets](https://awslabs.github.io/aws-lambda-powertools-python/latest/#tenets) + - label: This request meets [Powertools for AWS Lambda (Python) Tenets](https://awslabs.github.io/aws-lambda-powertools-python/latest/#tenets) required: true - - label: Should this be considered in other Lambda Powertools languages? i.e. [Java](https://github.com/awslabs/aws-lambda-powertools-java/), [TypeScript](https://github.com/awslabs/aws-lambda-powertools-typescript/), and [.NET](https://github.com/awslabs/aws-lambda-powertools-dotnet/) + - label: Should this be considered in other Powertools for AWS Lambda languages? i.e. [Java](https://github.com/awslabs/aws-lambda-powertools-java/), [TypeScript](https://github.com/awslabs/aws-lambda-powertools-typescript/), and [.NET](https://github.com/awslabs/aws-lambda-powertools-dotnet/) required: false - type: markdown attributes: diff --git a/.github/actions/create-pr/action.yml b/.github/actions/create-pr/action.yml index b7713a6c785..dcf2df738bd 100644 --- a/.github/actions/create-pr/action.yml +++ b/.github/actions/create-pr/action.yml @@ -3,7 +3,7 @@ description: "Create a PR and a temporary branch, close duplicates" # PROCESS # -# 1. Setup git client using Powertools bot username +# 1. Setup git client using Powertools for AWS Lambda (Python) bot username # 2. Pushes staged files to a temporary branch # 3. Creates a PR from temporary branch against a target branch (typically trunk: develop, main, etc.) # 4. Searches for duplicate PRs with the same title @@ -63,7 +63,7 @@ runs: - id: setup-git name: Git client setup and refresh tip run: | - git config user.name "Powertools bot" + git config user.name "Powertools for AWS Lambda (Python) bot" git config user.email "aws-lambda-powertools-feedback@amazon.com" git config pull.rebase true git config remote.origin.url >&- diff --git a/.github/boring-cyborg.yml b/.github/boring-cyborg.yml index 7764a1d73d7..006db19c585 100644 --- a/.github/boring-cyborg.yml +++ b/.github/boring-cyborg.yml @@ -97,7 +97,7 @@ labelPRBasedOnFilePath: firstPRWelcomeComment: > Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. - In the meantime, check out the #python channel on our AWS Lambda Powertools Discord: [Invite link](https://discord.gg/B8zZKbbyET) + In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: [Invite link](https://discord.gg/B8zZKbbyET) # Comment to be posted to congratulate user on their first merged PR firstPRMergeComment: > @@ -107,7 +107,7 @@ firstPRMergeComment: > firstIssueWelcomeComment: > Thanks for opening your first issue here! We'll come back to you as soon as we can. - In the meantime, check out the #python channel on our AWS Lambda Powertools Discord: [Invite link](https://discord.gg/B8zZKbbyET) + In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: [Invite link](https://discord.gg/B8zZKbbyET) ###### IssueLink Adder ################################################################################################# # Insert Issue (Jira/Github etc) link in PR description based on the Issue ID in PR title. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 789104dd6db..e48de960b43 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -140,7 +140,7 @@ jobs: - id: setup-git name: Git client setup and refresh tip run: | - git config user.name "Powertools bot" + git config user.name "Powertools for AWS Lambda (Python) bot" git config user.email "aws-lambda-powertools-feedback@amazon.com" git config remote.origin.url >&- - name: Create Git Tag diff --git a/CHANGELOG.md b/CHANGELOG.md index 4839a50912a..5e40d717474 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,7 +80,7 @@ * **deps-dev:** bump cfn-lint from 0.77.2 to 0.77.3 ([#2165](https://github.com/awslabs/aws-lambda-powertools-python/issues/2165)) * **deps-dev:** bump mkdocs-material from 9.1.6 to 9.1.8 ([#2162](https://github.com/awslabs/aws-lambda-powertools-python/issues/2162)) * **deps-dev:** bump coverage from 7.2.3 to 7.2.4 ([#2179](https://github.com/awslabs/aws-lambda-powertools-python/issues/2179)) -* **governance:** add Lambda Powertools for .NET in issue templates ([#2196](https://github.com/awslabs/aws-lambda-powertools-python/issues/2196)) +* **governance:** add Powertools for AWS Lambda (.NET) in issue templates ([#2196](https://github.com/awslabs/aws-lambda-powertools-python/issues/2196)) <a name="v2.14.1"></a> @@ -368,7 +368,7 @@ ## Documentation * **event_handlers:** Fix REST API - HTTP Methods documentation ([#1936](https://github.com/awslabs/aws-lambda-powertools-python/issues/1936)) -* **home:** update powertools definition +* **home:** update Powertools for AWS Lambda (Python) definition * **we-made-this:** add CI/CD using Feature Flags video ([#1940](https://github.com/awslabs/aws-lambda-powertools-python/issues/1940)) * **we-made-this:** add Feature Flags post ([#1939](https://github.com/awslabs/aws-lambda-powertools-python/issues/1939)) @@ -1249,7 +1249,7 @@ * **event-handler:** snippets split, improved, and lint ([#1279](https://github.com/awslabs/aws-lambda-powertools-python/issues/1279)) * **graphql:** snippets split, improved, and lint ([#1287](https://github.com/awslabs/aws-lambda-powertools-python/issues/1287)) -* **homepage:** emphasize additional powertools languages ([#1292](https://github.com/awslabs/aws-lambda-powertools-python/issues/1292)) +* **homepage:** emphasize additional Powertools for AWS Lambda languages ([#1292](https://github.com/awslabs/aws-lambda-powertools-python/issues/1292)) * **metrics:** snippets split, improved, and lint ## Maintenance @@ -1720,7 +1720,7 @@ ## Features * **ci:** auto-notify & close issues on release -* **logger:** clone powertools logger config to any Python logger ([#927](https://github.com/awslabs/aws-lambda-powertools-python/issues/927)) +* **logger:** clone Powertools for AWS Lambda (Python) logger config to any Python logger ([#927](https://github.com/awslabs/aws-lambda-powertools-python/issues/927)) ## Maintenance @@ -1936,7 +1936,7 @@ ## Features -* expose jmespath powertools functions ([#736](https://github.com/awslabs/aws-lambda-powertools-python/issues/736)) +* expose jmespath Powertools for AWS Lambda (Python) functions ([#736](https://github.com/awslabs/aws-lambda-powertools-python/issues/736)) * add get_raw_configuration property in store; expose store * boto3 sessions in batch, parameters & idempotency ([#717](https://github.com/awslabs/aws-lambda-powertools-python/issues/717)) * **feature-flags:** Bring your own logger for debug ([#709](https://github.com/awslabs/aws-lambda-powertools-python/issues/709)) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 3525147f68f..114ac52bf1e 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -96,7 +96,7 @@ These are the most common labels used by maintainers to triage issues, pull requ | size/XL | PRs between 500-999 LOC, often PRs that grown with feedback | PR automation | | size/XXL | PRs with 1K+ LOC, largely documentation related | PR automation | | tests | PRs that add or change tests | PR automation | -| `<utility>` | PRs related to a Powertools utility, e.g. `parameters`, `tracer` | PR automation | +| `<utility>` | PRs related to a Powertools for AWS Lambda (Python) utility, e.g. `parameters`, `tracer` | PR automation | | feature | New features or minor changes | PR/Release automation | | dependencies | Changes that touch dependencies, e.g. Dependabot, etc. | PR/ automation | | github-actions | Changes in GitHub workflows | PR automation | @@ -231,7 +231,7 @@ To run locally, you need [AWS CDK CLI](https://docs.aws.amazon.com/cdk/v2/guide/ ### Releasing a documentation hotfix -You can rebuild the latest documentation without a full release via this [GitHub Actions Workflow](https://github.com/awslabs/aws-lambda-powertools-python/actions/workflows/rebuild_latest_docs.yml). Choose `Run workflow`, keep `develop` as the branch, and input the latest Powertools version available. +You can rebuild the latest documentation without a full release via this [GitHub Actions Workflow](https://github.com/awslabs/aws-lambda-powertools-python/actions/workflows/rebuild_latest_docs.yml). Choose `Run workflow`, keep `develop` as the branch, and input the latest Powertools for AWS Lambda (Python) version available. This workflow will update both user guide and API documentation. diff --git a/README.md b/README.md index ee025f52261..9aa79dc3f2c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ <!-- markdownlint-disable MD013 MD041 MD043 --> -# AWS Lambda Powertools for Python +# Powertools for AWS Lambda (Python) [![Build](https://github.com/awslabs/aws-lambda-powertools-python/actions/workflows/python_build.yml/badge.svg)](https://github.com/awslabs/aws-lambda-powertools-python/actions/workflows/python_build.yml) [![codecov.io](https://codecov.io/github/awslabs/aws-lambda-powertools-python/branch/develop/graphs/badge.svg)](https://app.codecov.io/gh/awslabs/aws-lambda-powertools-python) ![PythonSupport](https://img.shields.io/static/v1?label=python&message=%203.7|%203.8|%203.9|%203.10&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) [![Join our Discord](https://dcbadge.vercel.app/api/server/B8zZKbbyET)](https://discord.gg/B8zZKbbyET) -Powertools is a developer toolkit to implement Serverless [best practices and increase developer velocity](https://awslabs.github.io/aws-lambda-powertools-python/latest/#features). +Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverless [best practices and increase developer velocity](https://awslabs.github.io/aws-lambda-powertools-python/latest/#features). > Also available in [Java](https://github.com/awslabs/aws-lambda-powertools-java), [Typescript](https://github.com/awslabs/aws-lambda-powertools-typescript), and [.NET](https://awslabs.github.io/aws-lambda-powertools-dotnet/). @@ -45,11 +45,11 @@ With [pip](https://pip.pypa.io/en/latest/index.html) installed, run: ``pip insta * [Serverless E-commerce platform](https://github.com/aws-samples/aws-serverless-ecommerce-platform) * [Serverless GraphQL Nanny Booking Api](https://github.com/trey-rosius/babysitter_api) -## How to support AWS Lambda Powertools for Python? +## How to support Powertools for AWS Lambda (Python)? ### Becoming a reference customer -Knowing which companies are using this library is important to help prioritize the project internally. If your company is using AWS Lambda Powertools for Python, you can request to have your name and logo added to the README file by raising a [Support Lambda Powertools (become a reference)](https://github.com/awslabs/aws-lambda-powertools-python/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E) issue. +Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (Python), you can request to have your name and logo added to the README file by raising a [Support Powertools for AWS Lambda (Python) (become a reference)](https://github.com/awslabs/aws-lambda-powertools-python/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E) issue. The following companies, among others, use Powertools: @@ -65,20 +65,20 @@ The following companies, among others, use Powertools: ### Sharing your work -Share what you did with Powertools πŸ’žπŸ’ž. Blog post, workshops, presentation, sample apps and others. Check out what the community has already shared about Powertools [here](https://awslabs.github.io/aws-lambda-powertools-python/latest/we_made_this/). +Share what you did with Powertools for AWS Lambda (Python) πŸ’žπŸ’ž. Blog post, workshops, presentation, sample apps and others. Check out what the community has already shared about Powertools for AWS Lambda (Python) [here](https://awslabs.github.io/aws-lambda-powertools-python/latest/we_made_this/). ### Using Lambda Layer or SAR -This helps us understand who uses Powertools in a non-intrusive way, and helps us gain future investments for other Powertools languages. When [using Layers](https://awslabs.github.io/aws-lambda-powertools-python/latest/#lambda-layer), you can add Powertools as a dev dependency (or as part of your virtual env) to not impact the development process. +This helps us understand who uses Powertools for AWS Lambda (Python) in a non-intrusive way, and helps us gain future investments for other Powertools for AWS Lambda languages. When [using Layers](https://awslabs.github.io/aws-lambda-powertools-python/latest/#lambda-layer), you can add Powertools for AWS Lambda (Python) as a dev dependency (or as part of your virtual env) to not impact the development process. ## Credits * Structured logging initial implementation from [aws-lambda-logging](https://gitlab.com/hadrien/aws_lambda_logging) -* Powertools idea [DAZN Powertools](https://github.com/getndazn/dazn-lambda-powertools/) +* Powertools for AWS Lambda (Python) idea [DAZN Powertools](https://github.com/getndazn/dazn-lambda-powertools/) ## Connect -* **AWS Lambda Powertools on Discord**: `#python` - **[Invite link](https://discord.gg/B8zZKbbyET)** +* **Powertools for AWS Lambda on Discord**: `#python` - **[Invite link](https://discord.gg/B8zZKbbyET)** * **Email**: aws-lambda-powertools-feedback@amazon.com ## Security disclosures diff --git a/aws_lambda_powertools/logging/formatter.py b/aws_lambda_powertools/logging/formatter.py index db80876c798..600a1e726c4 100644 --- a/aws_lambda_powertools/logging/formatter.py +++ b/aws_lambda_powertools/logging/formatter.py @@ -54,7 +54,7 @@ def clear_state(self): class LambdaPowertoolsFormatter(BasePowertoolsFormatter): - """AWS Lambda Powertools Logging formatter. + """Powertools for AWS Lambda (Python) Logging formatter. Formats the log message as a JSON encoded string. If the message is a dict it will be used directly. diff --git a/aws_lambda_powertools/logging/logger.py b/aws_lambda_powertools/logging/logger.py index f9c33c70ba6..981bc0fc0d9 100644 --- a/aws_lambda_powertools/logging/logger.py +++ b/aws_lambda_powertools/logging/logger.py @@ -598,7 +598,7 @@ def structure_logs(self, append: bool = False, formatter_options: Optional[Dict] formatter_options = formatter_options or {} # There are 3 operational modes for this method - ## 1. Register a Powertools Formatter for the first time + ## 1. Register a Powertools for AWS Lambda (Python) Formatter for the first time ## 2. Append new keys to the current logger formatter; deprecated in favour of append_keys ## 3. Add new keys and discard existing to the registered formatter @@ -609,9 +609,9 @@ def structure_logs(self, append: bool = False, formatter_options: Optional[Dict] formatter = self.logger_formatter or LambdaPowertoolsFormatter(**formatter_options, **log_keys) # type: ignore # noqa: E501 self.registered_handler.setFormatter(formatter) - # when using a custom Lambda Powertools Formatter - # standard and custom keys that are not Powertools Formatter parameters should be appended - # and custom keys that might happen to be Powertools Formatter parameters should be discarded + # when using a custom Powertools for AWS Lambda (Python) Formatter + # standard and custom keys that are not Powertools for AWS Lambda (Python) Formatter parameters should be appended + # and custom keys that might happen to be Powertools for AWS Lambda (Python) Formatter parameters should be discarded # this prevents adding them as custom keys, for example, `json_default=<callable>` # see https://github.com/awslabs/aws-lambda-powertools-python/issues/1263 custom_keys = {k: v for k, v in log_keys.items() if k not in RESERVED_FORMATTER_CUSTOM_KEYS} @@ -718,7 +718,7 @@ def set_package_logger( Example ------- - **Enables debug logging for AWS Lambda Powertools package** + **Enables debug logging for Powertools for AWS Lambda (Python) package** >>> aws_lambda_powertools.logging.logger import set_package_logger >>> set_package_logger() diff --git a/aws_lambda_powertools/logging/utils.py b/aws_lambda_powertools/logging/utils.py index 5cd8093073a..6a62a79055f 100644 --- a/aws_lambda_powertools/logging/utils.py +++ b/aws_lambda_powertools/logging/utils.py @@ -17,7 +17,7 @@ def copy_config_to_registered_loggers( Parameters ---------- source_logger : Logger - Powertools Logger to copy configuration from + Powertools for AWS Lambda (Python) Logger to copy configuration from log_level : Union[int, str], optional Logging level to set to registered loggers, by default uses source_logger logging level include : Optional[Set[str]], optional @@ -34,7 +34,7 @@ def copy_config_to_registered_loggers( # 3. Include and exclude set? Add Logger if it’s in include and not in exclude # 4. Only exclude set? Ignore Logger in the excluding list - # Exclude source and powertools package logger by default + # Exclude source and Powertools for AWS Lambda (Python) package logger by default # If source logger is a child ensure we exclude parent logger to not break child logger # from receiving/pushing updates to keys being added/removed source_logger_name = source_logger.name.split(".")[0] diff --git a/aws_lambda_powertools/package_logger.py b/aws_lambda_powertools/package_logger.py index e6c58ba9549..6783d0c3e50 100644 --- a/aws_lambda_powertools/package_logger.py +++ b/aws_lambda_powertools/package_logger.py @@ -5,7 +5,7 @@ def set_package_logger_handler(stream=None): - """Sets up Lambda Powertools package logging. + """Sets up Powertools for AWS Lambda (Python) package logging. By default, we discard any output to not interfere with customers logging. diff --git a/aws_lambda_powertools/utilities/validation/exceptions.py b/aws_lambda_powertools/utilities/validation/exceptions.py index 2f13ff64188..8789e3f2e80 100644 --- a/aws_lambda_powertools/utilities/validation/exceptions.py +++ b/aws_lambda_powertools/utilities/validation/exceptions.py @@ -22,7 +22,7 @@ def __init__( Parameters ---------- message : str, optional - Powertools formatted error message + Powertools for AWS Lambda (Python) formatted error message validation_message : str, optional Containing human-readable information what is wrong (e.g. `data.property[index] must be smaller than or equal to 42`) diff --git a/benchmark/README.md b/benchmark/README.md index 84b48129d94..c6901af28dc 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -1,6 +1,6 @@ # Cold Start Benchmark -The [benchmark.sh script](./benchmark.sh) is a bash script to compare the cold-start time of using the AWS Lambda Powertools in a semi-automated way. It does so by deploying two Lambda functions which both have the aws-lambda-powertools module installed. One Lambda function will import and initialize the three core utilities (`Metrics`, `Logger`, `Tracer`), while the other one will not. +The [benchmark.sh script](./benchmark.sh) is a bash script to compare the cold-start time of using the Powertools for AWS Lambda (Python) in a semi-automated way. It does so by deploying two Lambda functions which both have the aws-lambda-powertools module installed. One Lambda function will import and initialize the three core utilities (`Metrics`, `Logger`, `Tracer`), while the other one will not. Please note that this requires the [SAM CLI](https://github.com/aws/aws-sam-cli) version 1.2.0 or later. diff --git a/docs/core/event_handler/api_gateway.md b/docs/core/event_handler/api_gateway.md index 3dc6401ea8d..4f984ecea6f 100644 --- a/docs/core/event_handler/api_gateway.md +++ b/docs/core/event_handler/api_gateway.md @@ -340,7 +340,7 @@ For convenience, these are the default values when using `CORSConfig` to enable You can use the `Response` class to have full control over the response. For example, you might want to add additional headers, cookies, or set a custom Content-type. ???+ info - Powertools serializes headers and cookies according to the type of input event. + Powertools for AWS Lambda (Python) serializes headers and cookies according to the type of input event. Some event sources require headers and cookies to be encoded as `multiValueHeaders`. ???+ warning "Using multiple values for HTTP headers in ALB?" diff --git a/docs/core/event_handler/appsync.md b/docs/core/event_handler/appsync.md index 14a638b6123..789bf788004 100644 --- a/docs/core/event_handler/appsync.md +++ b/docs/core/event_handler/appsync.md @@ -156,7 +156,7 @@ Assuming you have [Amplify CLI installed](https://docs.amplify.aws/cli/start/ins ???+ note Amplify CLI generated functions use `Pipenv` as a dependency manager. Your function source code is located at **`amplify/backend/function/your-function-name`**. -Within your function's folder, add Powertools as a dependency with `pipenv install aws-lambda-powertools`. +Within your function's folder, add Powertools for AWS Lambda (Python) as a dependency with `pipenv install aws-lambda-powertools`. Use the following code for `merchantInfo` and `searchMerchant` functions respectively. diff --git a/docs/core/logger.md b/docs/core/logger.md index 2f0472368c3..064328dabb0 100644 --- a/docs/core/logger.md +++ b/docs/core/logger.md @@ -441,7 +441,7 @@ If you prefer configuring it separately, or you'd want to bring this JSON Format ???+ info When `POWERTOOLS_DEV` env var is present and set to `"true"`, Logger's default serializer (`json.dumps`) will pretty-print log messages for easier readability. -```python hl_lines="2 7-8" title="Pre-configuring Lambda Powertools Formatter" +```python hl_lines="2 7-8" title="Pre-configuring Powertools for AWS Lambda (Python) Formatter" --8<-- "examples/logger/src/powertools_formatter_setup.py" ``` @@ -618,7 +618,7 @@ The `log` argument is the final log record containing [our standard keys](#stand For exceptional cases where you want to completely replace our formatter logic, you can subclass `BasePowertoolsFormatter`. ???+ warning - You will need to implement `append_keys`, `clear_state`, override `format`, and optionally `remove_keys` to keep the same feature set Powertools Logger provides. This also means keeping state of logging keys added. + You will need to implement `append_keys`, `clear_state`, override `format`, and optionally `remove_keys` to keep the same feature set Powertools for AWS Lambda (Python) Logger provides. This also means keeping state of logging keys added. === "bring_your_own_formatter_from_scratch.py" @@ -688,7 +688,7 @@ for the given name and level to the logging module. By default, this logs all bo ---8<-- "examples/logger/src/enabling_boto_logging.py" ``` -### How can I enable Powertools logging for imported libraries? +### How can I enable Powertools for AWS Lambda (Python) logging for imported libraries? You can copy the Logger setup to all or sub-sets of registered external loggers. Use the `copy_config_to_registered_logger` method to do this. @@ -703,7 +703,7 @@ By default all registered loggers will be modified. You can change this behavior ### How can I add standard library logging attributes to a log record? -The Python standard library log records contains a [large set of attributes](https://docs.python.org/3/library/logging.html#logrecord-attributes){target="_blank"}, however only a few are included in Powertools Logger log record by default. +The Python standard library log records contains a [large set of attributes](https://docs.python.org/3/library/logging.html#logrecord-attributes){target="_blank"}, however only a few are included in Powertools for AWS Lambda (Python) Logger log record by default. You can include any of these logging attributes as key value arguments (`kwargs`) when instantiating `Logger` or `LambdaPowertoolsFormatter`. @@ -721,7 +721,7 @@ You can also add them later anywhere in your code with `append_keys`, or remove ---8<-- "examples/logger/src/append_and_remove_keys_output.json" ``` -For log records originating from Powertools Logger, the `name` attribute will be the same as `service`, for log records coming from standard library logger, it will be the name of the logger (i.e. what was used as name argument to `logging.getLogger`). +For log records originating from Powertools for AWS Lambda (Python) Logger, the `name` attribute will be the same as `service`, for log records coming from standard library logger, it will be the name of the logger (i.e. what was used as name argument to `logging.getLogger`). ### What's the difference between `append_keys` and `extra`? @@ -741,6 +741,6 @@ Here's an example where we persist `payment_id` not `request_id`. Note that `pay ---8<-- "examples/logger/src/append_keys_vs_extra_output.json" ``` -### How do I aggregate and search Powertools logs across accounts? +### How do I aggregate and search Powertools for AWS Lambda (Python) logs across accounts? As of now, ElasticSearch (ELK) or 3rd party solutions are best suited to this task. Please refer to this [discussion for more details](https://github.com/awslabs/aws-lambda-powertools-python/issues/460) diff --git a/docs/core/tracer.md b/docs/core/tracer.md index ae4af4e9cd5..0b701928d10 100644 --- a/docs/core/tracer.md +++ b/docs/core/tracer.md @@ -23,7 +23,7 @@ Tracer is an opinionated thin wrapper for [AWS X-Ray Python SDK](https://github. ### Install -!!! info "This is not necessary if you're installing Powertools via [Lambda Layer/SAR](../index.md#lambda-layer){target="_blank"}" +!!! info "This is not necessary if you're installing Powertools for AWS Lambda (Python) via [Lambda Layer/SAR](../index.md#lambda-layer){target="_blank"}" Add `aws-lambda-powertools[tracer]` as a dependency in your preferred tool: _e.g._, _requirements.txt_, _pyproject.toml_. This will ensure you have the required dependencies before using Tracer. diff --git a/docs/index.md b/docs/index.md index 2d64d574215..1a475cf0e02 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,14 +1,14 @@ --- title: Homepage -description: AWS Lambda Powertools for Python +description: Powertools for AWS Lambda (Python) --- <!-- markdownlint-disable MD043 MD013 --> -Powertools is a developer toolkit to implement Serverless best practices and increase developer velocity. +Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverless best practices and increase developer velocity. ???+ tip - Powertools is also available for [Java](https://awslabs.github.io/aws-lambda-powertools-java/){target="_blank"}, [TypeScript](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/){target="_blank"}, and [.NET](https://awslabs.github.io/aws-lambda-powertools-dotnet/){target="_blank"} + Powertools for AWS Lambda (Python) is also available for [Java](https://awslabs.github.io/aws-lambda-powertools-java/){target="_blank"}, [TypeScript](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/){target="_blank"}, and [.NET](https://awslabs.github.io/aws-lambda-powertools-dotnet/){target="_blank"} ??? hint "Support this project by becoming a reference customer, sharing your work, or using Layers/SAR :heart:" @@ -18,13 +18,13 @@ Powertools is a developer toolkit to implement Serverless best practices and inc 2) [**Share your work**](https://github.com/awslabs/aws-lambda-powertools-python/issues/new?assignees=&labels=community-content&template=share_your_work.yml&title=%5BI+Made+This%5D%3A+%3CTITLE%3E). Blog posts, video, sample projects you used Powertools! - 3) Use [**Lambda Layers**](#lambda-layer) or [**SAR**](#sar), if possible. This helps us understand who uses Powertools in a non-intrusive way, and helps us gain future investments for other Powertools languages. + 3) Use [**Lambda Layers**](#lambda-layer) or [**SAR**](#sar), if possible. This helps us understand who uses Powertools for AWS Lambda (Python) in a non-intrusive way, and helps us gain future investments for other Powertools for AWS Lambda languages. - When using Layers, you can add Powertools as a dev dependency (or as part of your virtual env) to not impact the development process. + When using Layers, you can add Powertools for AWS Lambda (Python) as a dev dependency (or as part of your virtual env) to not impact the development process. ## Install -You can install Powertools using one of the following options: +You can install Powertools for AWS Lambda (Python) using one of the following options: * **Lambda Layer (x86_64)**: [**arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:32**](#){: .copyMe}:clipboard: * **Lambda Layer (arm64)**: [**arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:32**](#){: .copyMe}:clipboard: @@ -42,16 +42,16 @@ You can install Powertools using one of the following options: ### Local development -!!! info "Using Powertools via Lambda Layer? Simply add [**`"aws-lambda-powertools[all]"`**](#){: .copyMe}:clipboard: as a development dependency." +!!! info "Using Powertools for AWS Lambda (Python) via Lambda Layer? Simply add [**`"aws-lambda-powertools[all]"`**](#){: .copyMe}:clipboard: as a development dependency." -Powertools relies on the [AWS SDK bundled in the Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html){target="_blank"}. This helps us achieve an optimal package size and initialization. However, when developing locally, you need to install AWS SDK as a development dependency (not as a production dependency): +Powertools for AWS Lambda (Python) relies on the [AWS SDK bundled in the Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html){target="_blank"}. This helps us achieve an optimal package size and initialization. However, when developing locally, you need to install AWS SDK as a development dependency (not as a production dependency): * **Pip**: [**`pip install "aws-lambda-powertools[aws-sdk]"`**](#){: .copyMe}:clipboard: * **Poetry**: [**`poetry add "aws-lambda-powertools[aws-sdk]" --group dev`**](#){: .copyMe}:clipboard: * **Pipenv**: [**`pipenv install --dev "aws-lambda-powertools[aws-sdk]"`**](#){: .copyMe}:clipboard: ??? question "Why is that necessary?" - Powertools relies on the AWS SDK being available to use in the target runtime (AWS Lambda). + Powertools for AWS Lambda (Python) relies on the AWS SDK being available to use in the target runtime (AWS Lambda). As a result, it affects your favorite IDE in terms of code auto-completion, or running your tests suite locally with no Lambda emulation such as [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html){target="_blank"}. @@ -60,7 +60,7 @@ Powertools relies on the [AWS SDK bundled in the Lambda runtime](https://docs.aw In this context, `[aws-sdk]` is an alias to the `boto3` package. Due to dependency resolution, it'll either install: * **(A)** the SDK version available in [Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html){target="_blank"} -* **(B)** a more up-to-date version if another package you use also depends on `boto3`, for example [Powertools Tracer](core/tracer.md){target="_blank"} +* **(B)** a more up-to-date version if another package you use also depends on `boto3`, for example [Powertools for AWS Lambda (Python) Tracer](core/tracer.md){target="_blank"} ### Lambda Layer @@ -70,7 +70,7 @@ In this context, `[aws-sdk]` is an alias to the `boto3` package. Due to dependen For our Layers, we compile and optimize [all dependencies](https://github.com/awslabs/aws-lambda-powertools-python/blob/develop/pyproject.toml#L98){target="_blank"}, and [remove duplicate dependencies already available in the Lambda runtime](https://github.com/awslabs/cdk-aws-lambda-powertools-layer/blob/main/layer/Python/Dockerfile#L36){target="_blank"} to achieve the most optimal size. -You can include Powertools Lambda Layer using [AWS Lambda Console](https://docs.aws.amazon.com/lambda/latest/dg/invocation-layers.html#invocation-layers-using){target="_blank"}, or your preferred deployment framework. +You can include Powertools for AWS Lambda (Python) Lambda Layer using [AWS Lambda Console](https://docs.aws.amazon.com/lambda/latest/dg/invocation-layers.html#invocation-layers-using){target="_blank"}, or your preferred deployment framework. ??? note "Note: Click to expand and copy any regional Lambda Layer ARN" @@ -580,14 +580,14 @@ Compared with the [public Layer ARN](#lambda-layer) option, SAR allows you to ch variable "aws_powertools_version" { type = string default = "2.0.0" - description = "The AWS Powertools release version" + description = "The Powertools for AWS Lambda (Python) release version" } output "deployed_powertools_sar_version" { value = data.aws_serverlessapplicationrepository_application.sar_app.semantic_version } - # Fetch Powertools Layer ARN from deployed SAR App + # Fetch Powertools for AWS Lambda (Python) Layer ARN from deployed SAR App output "aws_lambda_powertools_layer_arn" { value = aws_serverlessapplicationrepository_cloudformation_stack.deploy_sar_stack.outputs.LayerVersionArn } @@ -635,7 +635,7 @@ Compared with the [public Layer ARN](#lambda-layer) option, SAR allows you to ch - serverlessrepo:CreateCloudFormationTemplate - serverlessrepo:GetCloudFormationTemplate Resource: - # this is arn of the powertools SAR app + # this is arn of the Powertools for AWS Lambda (Python) SAR app - arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer - Sid: S3AccessLayer Effect: Allow @@ -643,7 +643,7 @@ Compared with the [public Layer ARN](#lambda-layer) option, SAR allows you to ch - s3:GetObject Resource: # AWS publishes to an external S3 bucket locked down to your account ID - # The below example is us publishing lambda powertools + # The below example is us publishing Powertools for AWS Lambda (Python) # Bucket: awsserverlessrepo-changesets-plntc6bfnfj # Key: *****/arn:aws:serverlessrepo:eu-west-1:057560766410:applications-aws-lambda-powertools-python-layer-versions-1.10.2/aeeccf50-****-****-****-********* - arn:aws:s3:::awsserverlessrepo-changesets-*/* @@ -675,7 +675,7 @@ sam init --app-template hello-world-powertools-python --name sam-app --package-t ## Features -Core utilities such as Tracing, Logging, Metrics, and Event Handler will be available across all Powertools languages. Additional utilities are subjective to each language ecosystem and customer demand. +Core utilities such as Tracing, Logging, Metrics, and Event Handler will be available across all Powertools for AWS Lambda languages. Additional utilities are subjective to each language ecosystem and customer demand. | Utility | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -737,11 +737,11 @@ As a best practice for libraries, Powertools module logging statements are suppr When necessary, you can use `POWERTOOLS_DEBUG` environment variable to enable debugging. This will provide additional information on every internal operation. -## How to support AWS Lambda Powertools for Python? +## How to support Powertools for AWS Lambda (Python)? ### Becoming a reference customer -Knowing which companies are using this library is important to help prioritize the project internally. If your company is using AWS Lambda Powertools for Python, you can request to have your name and logo added to the README file by raising a [Support Lambda Powertools (become a reference)](https://github.com/awslabs/aws-lambda-powertools-python/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E){target="_blank"} issue. +Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (Python), you can request to have your name and logo added to the README file by raising a [Support Powertools for AWS Lambda (Python) (become a reference)](https://github.com/awslabs/aws-lambda-powertools-python/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E){target="_blank"} issue. The following companies, among others, use Powertools: @@ -757,11 +757,11 @@ The following companies, among others, use Powertools: ### Sharing your work -Share what you did with Powertools πŸ’žπŸ’ž. Blog post, workshops, presentation, sample apps and others. Check out what the community has already shared about Powertools [here](https://awslabs.github.io/aws-lambda-powertools-python/latest/we_made_this/). +Share what you did with Powertools for AWS Lambda (Python) πŸ’žπŸ’ž. Blog post, workshops, presentation, sample apps and others. Check out what the community has already shared about Powertools for AWS Lambda (Python) [here](https://awslabs.github.io/aws-lambda-powertools-python/latest/we_made_this/). ### Using Lambda Layer or SAR -This helps us understand who uses Powertools in a non-intrusive way, and helps us gain future investments for other Powertools languages. When [using Layers](https://awslabs.github.io/aws-lambda-powertools-python/latest/#lambda-layer), you can add Powertools as a dev dependency (or as part of your virtual env) to not impact the development process. +This helps us understand who uses Powertools for AWS Lambda (Python) in a non-intrusive way, and helps us gain future investments for other Powertools for AWS Lambda languages. When [using Layers](https://awslabs.github.io/aws-lambda-powertools-python/latest/#lambda-layer), you can add Powertools for AWS Lambda (Python) as a dev dependency (or as part of your virtual env) to not impact the development process. ## Tenets diff --git a/docs/roadmap.md b/docs/roadmap.md index 084028672ac..bd082bc8ef7 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -93,7 +93,7 @@ Our end-to-end mechanism follows four major steps: ## Disclaimer -The AWS Lambda Powertools team values feedback and guidance from its community of users, although final decisions on inclusion into the project will be made by AWS. +The Powertools for AWS Lambda (Python) team values feedback and guidance from its community of users, although final decisions on inclusion into the project will be made by AWS. We determine the high-level direction for our open roadmap based on customer feedback and popularity (πŸ‘πŸ½ and comments), security and operational impacts, and business value. Where features don’t meet our goals and longer-term strategy, we will communicate that clearly and openly as quickly as possible with an explanation of why the decision was made. diff --git a/docs/tutorial/index.md b/docs/tutorial/index.md index 9965d70d267..29ec6ebadd2 100644 --- a/docs/tutorial/index.md +++ b/docs/tutorial/index.md @@ -1,11 +1,11 @@ --- title: Tutorial -description: Powertools introduction +description: Powertools for AWS Lambda (Python) introduction --- <!-- markdownlint-disable MD043 MD041 --> -This tutorial progressively introduces Lambda Powertools core utilities by using one feature at a time. +This tutorial progressively introduces Powertools for AWS Lambda (Python) core utilities by using one feature at a time. ## Requirements @@ -323,7 +323,7 @@ We can massively simplify cross-cutting concerns while keeping it lightweight by ???+ tip This is available for both [REST API (API Gateway, ALB)](../core/event_handler/api_gateway.md){target="_blank"} and [GraphQL API (AppSync)](../core/event_handler/appsync.md){target="_blank"}. -Let's include Lambda Powertools as a dependency in `requirement.txt`, and use Event Handler to refactor our previous example. +Let's include Powertools for AWS Lambda (Python) as a dependency in `requirement.txt`, and use Event Handler to refactor our previous example. === "app.py" @@ -452,11 +452,11 @@ We could start by creating a dictionary with Lambda context information or somet ### Simplifying with Logger ???+ question "Surely this could be easier, right?" - Yes! Powertools Logger to the rescue :-) + Yes! Powertools for AWS Lambda (Python) Logger to the rescue :-) -As we already have Lambda Powertools as a dependency, we can simply import [Logger](../core/logger.md){target="_blank"}. +As we already have Powertools for AWS Lambda (Python) as a dependency, we can simply import [Logger](../core/logger.md){target="_blank"}. -```python title="Refactoring with Lambda Powertools Logger" hl_lines="1 3 5 12 18 22" +```python title="Refactoring with Powertools for AWS Lambda (Python) Logger" hl_lines="1 3 5 12 18 22" from aws_lambda_powertools import Logger from aws_lambda_powertools.event_handler import APIGatewayRestResolver from aws_lambda_powertools.logging import correlation_paths @@ -485,7 +485,7 @@ def lambda_handler(event, context): Let's break this down: -* **L5**: We add Lambda Powertools Logger; the boilerplate is now done for you. By default, we set `INFO` as the logging level if `LOG_LEVEL` env var isn't set. +* **L5**: We add Powertools for AWS Lambda (Python) Logger; the boilerplate is now done for you. By default, we set `INFO` as the logging level if `LOG_LEVEL` env var isn't set. * **L22**: We use `logger.inject_lambda_context` decorator to inject key information from Lambda context into every log. * **L22**: We also instruct Logger to use the incoming API Gateway Request ID as a [correlation id](../core/logger.md##set_correlation_id-method) automatically. * **L22**: Since we're in dev, we also use `log_event=True` to automatically log each incoming request for debugging. This can be also set via [environment variables](./index.md#environment-variables){target="_blank"}. @@ -535,7 +535,7 @@ It's a [two-step process](https://docs.aws.amazon.com/lambda/latest/dg/services- 1. Enable tracing in your Lambda function. 2. Instrument your application code. -Let's explore how we can instrument our code with [AWS X-Ray SDK](https://docs.aws.amazon.com/xray-sdk-for-python/latest/reference/index.html){target="_blank"}, and then simplify it with [Lambda Powertools Tracer](../core/tracer.md){target="_blank"} feature. +Let's explore how we can instrument our code with [AWS X-Ray SDK](https://docs.aws.amazon.com/xray-sdk-for-python/latest/reference/index.html){target="_blank"}, and then simplify it with [Powertools for AWS Lambda (Python) Tracer](../core/tracer.md){target="_blank"} feature. === "app.py" @@ -725,12 +725,12 @@ If you choose any of the traces available, try opening the `handler` subsegment Cross-cutting concerns like filtering traces by Cold Start, including response as well as exceptions as tracing metadata can take a considerable amount of boilerplate. -We can simplify our previous patterns by using [Lambda Powertools Tracer](../core/tracer.md){target="_blank"}; a thin wrapper on top of X-Ray SDK. +We can simplify our previous patterns by using [Powertools for AWS Lambda (Python) Tracer](../core/tracer.md){target="_blank"}; a thin wrapper on top of X-Ray SDK. ???+ note You can now safely remove `aws-xray-sdk` from `requirements.txt`; keep `aws-lambda-powertools` only. -```python title="Refactoring with Lambda Powertools Tracer" hl_lines="1 6 11 13 19 21 27" +```python title="Refactoring with Powertools for AWS Lambda (Python) Tracer" hl_lines="1 6 11 13 19 21 27" from aws_lambda_powertools import Logger, Tracer from aws_lambda_powertools.event_handler import APIGatewayRestResolver from aws_lambda_powertools.logging import correlation_paths @@ -771,14 +771,14 @@ Decorators, annotations and metadata are largely the same, except we now have a Another subtle difference is that you can now run your Lambda functions and unit test them locally without having to explicitly disable Tracer. -Lambda Powertools optimizes for Lambda compute environment. As such, we add these and other common approaches to accelerate your development, so you don't worry about implementing every cross-cutting concern. +Powertools for AWS Lambda (Python) optimizes for Lambda compute environment. As such, we add these and other common approaches to accelerate your development, so you don't worry about implementing every cross-cutting concern. ???+ tip You can [opt-out some of these behaviours](../core/tracer/#advanced){target="_blank"} like disabling response capturing, explicitly patching only X modules, etc. Repeat the process of building, deploying, and invoking your application via the API endpoint. Within the [AWS X-Ray Console](https://console.aws.amazon.com/xray/home#/traces/){target="_blank"}, you should see a similar view: -![AWS X-Ray Console trace view using Lambda Powertools Tracer](../media/tracer_utility_showcase_2.png) +![AWS X-Ray Console trace view using Powertools for AWS Lambda (Python) Tracer](../media/tracer_utility_showcase_2.png) ???+ tip Consider using [Amazon CloudWatch ServiceLens view](https://console.aws.amazon.com/cloudwatch/home#servicelens:service-map/map){target="_blank"} as it aggregates AWS X-Ray traces and CloudWatch metrics and logs in one view. @@ -801,7 +801,7 @@ By default, AWS Lambda adds [invocation and performance metrics](https://docs.aw ???+ tip You can [optionally enable detailed metrics](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html#api-gateway-metricdimensions){target="_blank"} per each API route, stage, and method in API Gateway. -Let's expand our application with custom metrics using AWS SDK to see how it works, then let's upgrade it with Lambda Powertools :-) +Let's expand our application with custom metrics using AWS SDK to see how it works, then let's upgrade it with Powertools for AWS Lambda (Python) :-) === "app.py" @@ -936,7 +936,7 @@ Within `template.yaml`, we add [CloudWatchPutMetricPolicy](https://docs.aws.amaz ### Simplifying with Metrics -[Lambda Powertools Metrics](../core/metrics.md){target="_blank} uses [Amazon CloudWatch Embedded Metric Format (EMF)](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format.html) to create custom metrics **asynchronously** via a native integration with Lambda. +[Powertools for AWS Lambda (Python) Metrics](../core/metrics.md){target="_blank} uses [Amazon CloudWatch Embedded Metric Format (EMF)](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format.html) to create custom metrics **asynchronously** via a native integration with Lambda. In general terms, EMF is a specification that expects metrics in a JSON payload within CloudWatch Logs. Lambda ingests all logs emitted by a given function into CloudWatch Logs. CloudWatch automatically looks up for log entries that follow the EMF format and transforms them into a CloudWatch metric. @@ -945,7 +945,7 @@ In general terms, EMF is a specification that expects metrics in a JSON payload Let's implement that using [Metrics](../core/metrics.md){target="_blank}: -```python title="Refactoring with Lambda Powertools Metrics" hl_lines="1 4 9 18 27 33" +```python title="Refactoring with Powertools for AWS Lambda (Python) Metrics" hl_lines="1 4 9 18 27 33" from aws_lambda_powertools import Logger, Tracer, Metrics from aws_lambda_powertools.event_handler import APIGatewayRestResolver from aws_lambda_powertools.logging import correlation_paths @@ -1034,7 +1034,7 @@ If you're curious about how the EMF portion of your function logs look like, you ## Final considerations -We covered a lot of ground here and we only scratched the surface of the feature set available within Lambda Powertools. +We covered a lot of ground here and we only scratched the surface of the feature set available within Powertools for AWS Lambda (Python). When it comes to the observability features ([Tracer](../core/tracer.md){target="_blank"}, [Metrics](../core/metrics.md){target="_blank"}, [Logging](../core/logger.md){target="_blank"}), don't stop there! The goal here is to ensure you can ask arbitrary questions to assess your system's health; these features are only part of the wider story! @@ -1043,7 +1043,7 @@ This requires a change in mindset to ensure operational excellence is part of th ???+ tip You can find more details on other leading practices described in the [Well-Architected Serverless Lens](https://aws.amazon.com/blogs/aws/new-serverless-lens-in-aws-well-architected-tool/). - Lambda Powertools is largely designed to make some of these practices easier to adopt from day 1. + Powertools for AWS Lambda (Python) is largely designed to make some of these practices easier to adopt from day 1. ???+ question "Have ideas for other tutorials?" You can open up a [documentation issue](https://github.com/awslabs/aws-lambda-powertools-python/issues/new?assignees=&labels=documentation&template=documentation-improvements.md&title=Tutorial%20Suggestion){target="_blank"}, or via e-mail [aws-lambda-powertools-feedback@amazon.com](mailto:aws-lambda-powertools-feedback@amazon.com). diff --git a/docs/upgrade.md b/docs/upgrade.md index 948ce6fc873..097c2d35b2a 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -1,15 +1,15 @@ --- title: Upgrade guide -description: Guide to update between major Powertools versions +description: Guide to update between major Powertools for AWS Lambda (Python) versions --- <!-- markdownlint-disable MD043 --> ## End of support v1 -!!! warning "On March 31st, 2023, AWS Lambda Powertools for Python v1 reached end of support and will no longer receive updates or releases. If you are still using v1, we strongly recommend you to read our upgrade guide and update to the latest version." +!!! warning "On March 31st, 2023, Powertools for AWS Lambda (Python) v1 reached end of support and will no longer receive updates or releases. If you are still using v1, we strongly recommend you to read our upgrade guide and update to the latest version." -Given our commitment to all of our customers using AWS Lambda Powertools for Python, we will keep [Pypi](https://pypi.org/project/aws-lambda-powertools/) v1 releases and documentation 1.x versions to prevent any disruption. +Given our commitment to all of our customers using Powertools for AWS Lambda (Python), we will keep [Pypi](https://pypi.org/project/aws-lambda-powertools/) v1 releases and documentation 1.x versions to prevent any disruption. ## Migrate to v2 from v1 diff --git a/docs/utilities/feature_flags.md b/docs/utilities/feature_flags.md index efe41c2f82f..79657c436f6 100644 --- a/docs/utilities/feature_flags.md +++ b/docs/utilities/feature_flags.md @@ -257,7 +257,7 @@ You can also have features enabled only at specific days, for example: enable ch ???+ info "How should I use timezones?" You can use any [IANA time zone](https://www.iana.org/time-zones){target="_blank"} (as originally specified in [PEP 615](https://peps.python.org/pep-0615/){target="_blank"}) as part of your rules definition. - Powertools takes care of converting and calculate the correct timestamps for you. + Powertools for AWS Lambda (Python) takes care of converting and calculate the correct timestamps for you. When using `SCHEDULE_BETWEEN_DATETIME_RANGE`, use timestamps without timezone information, and specify the timezone manually. This way, you'll avoid hitting problems with day light savings. @@ -453,7 +453,7 @@ These are the available options for further customization. | **max_age** | `5` | Number of seconds to cache feature flags configuration fetched from AWS AppConfig | | **sdk_config** | `None` | [Botocore Config object](https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html){target="_blank"} | | **jmespath_options** | `None` | For advanced use cases when you want to bring your own [JMESPath functions](https://github.com/jmespath/jmespath.py#custom-functions){target="_blank"} | -| **logger** | `logging.Logger` | Logger to use for debug. You can optionally supply an instance of Powertools Logger. | +| **logger** | `logging.Logger` | Logger to use for debug. You can optionally supply an instance of Powertools for AWS Lambda (Python) Logger. | === "appconfig_provider_options.py" diff --git a/docs/utilities/idempotency.md b/docs/utilities/idempotency.md index 81afa8b0117..f43dc68487f 100644 --- a/docs/utilities/idempotency.md +++ b/docs/utilities/idempotency.md @@ -410,7 +410,7 @@ Imagine the function executes successfully, but the client never receives the re ???+ note This is automatically done when you decorate your Lambda handler with [@idempotent decorator](#idempotent-decorator). -To prevent against extended failed retries when a [Lambda function times out](https://aws.amazon.com/premiumsupport/knowledge-center/lambda-verify-invocation-timeouts/), Powertools calculates and includes the remaining invocation available time as part of the idempotency record. +To prevent against extended failed retries when a [Lambda function times out](https://aws.amazon.com/premiumsupport/knowledge-center/lambda-verify-invocation-timeouts/), Powertools for AWS Lambda (Python) calculates and includes the remaining invocation available time as part of the idempotency record. ???+ example If a second invocation happens **after** this timestamp, and the record is marked as `INPROGRESS`, we will execute the invocation again as if it was in the `EXPIRED` state (e.g, `expire_seconds` field elapsed). @@ -1156,7 +1156,7 @@ def lambda_handler(event, context): return {"message": event['message'], "statusCode": 200} ``` -???+ tip "Tip: JMESPath Powertools functions are also available" +???+ tip "Tip: JMESPath Powertools for AWS Lambda (Python) functions are also available" Built-in functions known in the validation utility like `powertools_json`, `powertools_base64`, `powertools_base64_gzip` are also available to use in this utility. ## Testing your code diff --git a/docs/utilities/jmespath_functions.md b/docs/utilities/jmespath_functions.md index e86fb824faf..5550cdc507e 100644 --- a/docs/utilities/jmespath_functions.md +++ b/docs/utilities/jmespath_functions.md @@ -6,7 +6,7 @@ description: Utility <!-- markdownlint-disable MD043 --> ???+ tip - JMESPath is a query language for JSON used by AWS CLI, AWS Python SDK, and AWS Lambda Powertools for Python. + JMESPath is a query language for JSON used by AWS CLI, AWS Python SDK, and Powertools for AWS Lambda (Python). Built-in [JMESPath](https://jmespath.org/){target="_blank"} Functions to easily deserialize common encoded JSON payloads in Lambda functions. @@ -23,7 +23,7 @@ Built-in [JMESPath](https://jmespath.org/){target="_blank"} Functions to easily You might have events that contains encoded JSON payloads as string, base64, or even in compressed format. It is a common use case to decode and extract them partially or fully as part of your Lambda function invocation. -Powertools also have utilities like [validation](validation.md), [idempotency](idempotency.md), or [feature flags](feature_flags.md) where you might need to extract a portion of your data before using them. +Powertools for AWS Lambda (Python) also have utilities like [validation](validation.md), [idempotency](idempotency.md), or [feature flags](feature_flags.md) where you might need to extract a portion of your data before using them. ???+ info "Terminology" **Envelope** is the terminology we use for the **JMESPath expression** to extract your JSON object from your data input. We might use those two terms interchangeably. @@ -90,7 +90,7 @@ These are all built-in envelopes you can use along with their expression as a re You can use our built-in JMESPath functions within your envelope expression. They handle deserialization for common data formats found in AWS Lambda event sources such as JSON strings, base64, and uncompress gzip data. ???+ info - We use these everywhere in Powertools to easily decode and unwrap events from Amazon API Gateway, Amazon Kinesis, AWS CloudWatch Logs, etc. + We use these everywhere in Powertools for AWS Lambda (Python) to easily decode and unwrap events from Amazon API Gateway, Amazon Kinesis, AWS CloudWatch Logs, etc. #### powertools_json function @@ -187,7 +187,7 @@ This sample will decompress and decode base64 data from Cloudwatch Logs, then us ???+ warning This should only be used for advanced use cases where you have special formats not covered by the built-in functions. -For special binary formats that you want to decode before applying JSON Schema validation, you can bring your own [JMESPath function](https://github.com/jmespath/jmespath.py#custom-functions){target="_blank"} and any additional option via `jmespath_options` param. To keep Powertools built-in functions, you can subclass from `PowertoolsFunctions`. +For special binary formats that you want to decode before applying JSON Schema validation, you can bring your own [JMESPath function](https://github.com/jmespath/jmespath.py#custom-functions){target="_blank"} and any additional option via `jmespath_options` param. To keep Powertools for AWS Lambda (Python) built-in functions, you can subclass from `PowertoolsFunctions`. Here is an example of how to decompress messages using [snappy](https://github.com/andrix/python-snappy){target="_blank"}: diff --git a/docs/utilities/middleware_factory.md b/docs/utilities/middleware_factory.md index 4d125b3c006..1552311ea17 100644 --- a/docs/utilities/middleware_factory.md +++ b/docs/utilities/middleware_factory.md @@ -109,9 +109,9 @@ When executed, your middleware name will [appear in AWS X-Ray Trace details as]( ![Middleware simple Tracer](../media/middleware_factory_tracer_1.png) -### Combining Powertools utilities +### Combining Powertools for AWS Lambda (Python) utilities -You can create your own middleware and combine many features of Lambda Powertools such as [trace](../core/logger.md), [logs](../core/logger.md), [feature flags](feature_flags.md), [validation](validation.md), [jmespath_functions](jmespath_functions.md) and others to abstract non-functional code. +You can create your own middleware and combine many features of Powertools for AWS Lambda (Python) such as [trace](../core/logger.md), [logs](../core/logger.md), [feature flags](feature_flags.md), [validation](validation.md), [jmespath_functions](jmespath_functions.md) and others to abstract non-functional code. In the example below, we create a Middleware with the following features: diff --git a/docs/utilities/parser.md b/docs/utilities/parser.md index 38e12c0792d..543ac3b9ef6 100644 --- a/docs/utilities/parser.md +++ b/docs/utilities/parser.md @@ -16,7 +16,7 @@ This utility provides data parsing and deep validation using [Pydantic](https:// ### Install -!!! info "This is not necessary if you're installing Powertools via [Lambda Layer/SAR](../index.md#lambda-layer){target="_blank"}" +!!! info "This is not necessary if you're installing Powertools for AWS Lambda (Python) via [Lambda Layer/SAR](../index.md#lambda-layer){target="_blank"}" Add `aws-lambda-powertools[parser]` as a dependency in your preferred tool: _e.g._, _requirements.txt_, _pyproject.toml_. This will ensure you have the required dependencies before using Parser. diff --git a/docs/utilities/validation.md b/docs/utilities/validation.md index 277a1f91f81..cef3b1e3134 100644 --- a/docs/utilities/validation.md +++ b/docs/utilities/validation.md @@ -32,7 +32,7 @@ You can also use the standalone `validate` function, if you want more control ov ### Install -!!! info "This is not necessary if you're installing Powertools via [Lambda Layer/SAR](../index.md#lambda-layer){target="_blank"}" +!!! info "This is not necessary if you're installing Powertools for AWS Lambda (Python) via [Lambda Layer/SAR](../index.md#lambda-layer){target="_blank"}" Add `aws-lambda-powertools[validation]` as a dependency in your preferred tool: _e.g._, _requirements.txt_, _pyproject.toml_. This will ensure you have the required dependencies before using Validation. diff --git a/docs/we_made_this.md b/docs/we_made_this.md index a9022b68e5d..c7aed5d658d 100644 --- a/docs/we_made_this.md +++ b/docs/we_made_this.md @@ -1,11 +1,11 @@ --- title: We Made This (Community) -description: Blog posts, tutorials, and videos about AWS Lambda Powertools created by the Powertools Community. +description: Blog posts, tutorials, and videos about Powertools for AWS Lambda (Python) created by the Powertools for AWS Lambda (Python) Community. --- <!-- markdownlint-disable MD001 MD043 --> -This space is dedicated to highlight our awesome community content featuring Powertools πŸ™! +This space is dedicated to highlight our awesome community content featuring Powertools for AWS Lambda (Python) πŸ™! !!! info "[Get your content featured here](https://github.com/awslabs/aws-lambda-powertools-python/issues/new?assignees=&labels=community-content&template=share_your_work.yml&title=%5BI+Made+This%5D%3A+%3CTITLE%3E){target="_blank"}!" @@ -13,15 +13,15 @@ This space is dedicated to highlight our awesome community content featuring Pow [![Join our Discord](https://dcbadge.vercel.app/api/server/B8zZKbbyET)](https://discord.gg/B8zZKbbyET){target="_blank"} -Join us on [Discord](https://discord.gg/B8zZKbbyET){target="_blank"} to connect with the Powertools community πŸ‘‹. Ask questions, learn from each other, contribute, hang out with key contributors, and more! +Join us on [Discord](https://discord.gg/B8zZKbbyET){target="_blank"} to connect with the Powertools for AWS Lambda (Python) community πŸ‘‹. Ask questions, learn from each other, contribute, hang out with key contributors, and more! ## Blog posts -### AWS Lambda Cookbook β€” Following best practices with Lambda Powertools +### AWS Lambda Cookbook β€” Following best practices with Powertools for AWS Lambda (Python) > **Author: [Ran Isenberg](mailto:ran.isenberg@ranthebuilder.cloud) [:material-twitter:](https://twitter.com/IsenbergRan){target="_blank"} [:material-linkedin:](https://www.linkedin.com/in/ranisenberg/){target="_blank"}** -A collection of articles explaining in detail how Lambda Powertools helps with a Serverless adoption strategy and its challenges. +A collection of articles explaining in detail how Powertools for AWS Lambda (Python) helps with a Serverless adoption strategy and its challenges. * [Part 1 - Logging](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-elevate-your-handler-s-code-part-1-logging){:target="_blank"} @@ -43,7 +43,7 @@ This article dives into what idempotency means for APIs, their use cases, and ho * [blog.walmsles.io/making-all-your-apis-idempotent](https://blog.walmsles.io/making-all-your-apis-idempotent){target="_blank"} -### Deep dive on Lambda Powertools Idempotency feature +### Deep dive on Powertools for AWS Lambda (Python) Idempotency feature > **Author: [Michael Walmsley](https://twitter.com/walmsles){target="_blank"}** :material-twitter: @@ -51,11 +51,11 @@ This article describes how to best calculate your idempotency token, implementat * [blog.walmsles.io/aws-lambda-powertools-idempotency-a-deeper-dive](https://blog.walmsles.io/aws-lambda-powertools-idempotency-a-deeper-dive){target="_blank"} -### Developing AWS Lambda functions with AWS Lambda Powertools +### Developing AWS Lambda functions with Powertools for AWS Lambda (Python) > **Author: [Stephan Huber](https://linkedin.com/in/sthuber90){target="_blank"}** :material-linkedin: -This article walks through how to add Powertools to an existing project, covers Tracer, Logger, Metrics, and JSON Schema Validation. +This article walks through how to add Powertools for AWS Lambda (Python) to an existing project, covers Tracer, Logger, Metrics, and JSON Schema Validation. * [globaldatanet.com/tech-blog/develop-lambda-functions-with-aws-lambda-powertools](https://globaldatanet.com/tech-blog/develop-lambda-functions-with-aws-lambda-powertools){target="_blank"} @@ -72,7 +72,7 @@ This article walks through a sample AWS EventBridge cookiecutter template presen > **Author: [Ran Isenberg](mailto:ran.isenberg@ranthebuilder.cloud) [:material-twitter:](https://twitter.com/IsenbergRan){target="_blank"} [:material-linkedin:](https://www.linkedin.com/in/ranisenberg/){target="_blank"}** -This article walks through how CyberArk uses Powertools to implement Feature Flags with AWS AppConfig +This article walks through how CyberArk uses Powertools for AWS Lambda (Python) to implement Feature Flags with AWS AppConfig * [aws.amazon.com/blogs/mt/how-cyberark-implements-feature-flags-with-aws-appconfig](https://aws.amazon.com/blogs/mt/how-cyberark-implements-feature-flags-with-aws-appconfig){target="_blank"} @@ -82,13 +82,13 @@ This article walks through how CyberArk uses Powertools to implement Feature Fla > **Author: [Ran Isenberg](mailto:ran.isenberg@ranthebuilder.cloud) [:material-twitter:](https://twitter.com/IsenbergRan){target="_blank"} [:material-linkedin:](https://www.linkedin.com/in/ranisenberg/){target="_blank"}** -When building applications with AWS Lambda it is critical to verify the data structure and validate the input due to the multiple different sources that can trigger them. In this session Ran Isenberg (CyberArk) will present one of the interesting features of AWS Lambda Powertools for python: the parser. +When building applications with AWS Lambda it is critical to verify the data structure and validate the input due to the multiple different sources that can trigger them. In this session Ran Isenberg (CyberArk) will present one of the interesting features of Powertools for AWS Lambda (Python) for python: the parser. In this session you will learn how to increase code quality, extensibility and testability, boost you productivity and ship rock solid apps to production. <iframe src="https://player.twitch.tv/?video=1034744364&parent=awslabs.github.io&autoplay=false" frameborder="0" allowfullscreen="true" scrolling="no" height="378" width="620"></iframe> -#### Talk DEV to me | Feature Flags with AWS Lambda Powertools +#### Talk DEV to me | Feature Flags with Powertools for AWS Lambda (Python) > **Author: [Ran Isenberg](mailto:ran.isenberg@ranthebuilder.cloud) [:material-twitter:](https://twitter.com/IsenbergRan){target="_blank"} [:material-linkedin:](https://www.linkedin.com/in/ranisenberg/){target="_blank"}** @@ -102,7 +102,7 @@ A deep dive in the [Feature Flags](./utilities/feature_flags.md){target="_blank" Feature flags can improve your CI/CD process by enabling capabilities otherwise not possible, thus making them an enabler of DevOps and a crucial part of continuous integration. Partial rollouts, A/B testing, and the ability to quickly change a configuration without redeploying code are advantages you gain by using features flags. -In this talk, you will learn the added value of using feature flags as part of your CI/CD process and how AWS Lambda Powertools can help with that. +In this talk, you will learn the added value of using feature flags as part of your CI/CD process and how Powertools for AWS Lambda (Python) can help with that. <iframe width="620" height="378" src="https://www.youtube.com/embed/3IT4UzN9Jds" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> @@ -114,7 +114,7 @@ In this talk, you will learn the added value of using feature flags as part of y This repo contains documentation for a live coding workshop for the AWS Programming and Tools Meetup in Melbourne. The workshop will start with the SAM Cli "Hello World" example API project. -Throughout the labs we will introduce each of the AWS Lambda Powertools Core utilities to showcase how simple they are to use and adopt for all your projects, and how powerful they are at bringing you closer to the Well Architected Serverless Lens. +Throughout the labs we will introduce each of the Powertools for AWS Lambda (Python) Core utilities to showcase how simple they are to use and adopt for all your projects, and how powerful they are at bringing you closer to the Well Architected Serverless Lens. * :material-github: [github.com/walmsles/lambda-powertools-coding-workshop](https://github.com/walmsles/lambda-powertools-coding-workshop){target="_blank"} @@ -130,7 +130,7 @@ Throughout the labs we will introduce each of the AWS Lambda Powertools Core uti This repository provides a working, deployable, open source based, AWS Lambda handler and [AWS CDK](https://aws.amazon.com/cdk/){target="_blank"} Python code. -This handler embodies Serverless best practices and has all the bells and whistles for a proper production ready handler. It uses many of the AWS Lambda Powertools utilities for Python. +This handler embodies Serverless best practices and has all the bells and whistles for a proper production ready handler. It uses many of the Powertools for AWS Lambda (Python) utilities for Python. :material-github: [github.com/ran-isenberg/aws-lambda-handler-cookbook](https://github.com/ran-isenberg/aws-lambda-handler-cookbook){:target="_blank"} @@ -138,8 +138,8 @@ This handler embodies Serverless best practices and has all the bells and whistl > **Author: [Santiago Garcia Arango](mailto:san99tiago@gmail.com) [:material-web:](https://san99tiago.com/){target="_blank"} [:material-linkedin:](https://www.linkedin.com/in/san99tiago/){target="_blank"}** -This repository contains a well documented example of a Transactional Messages App that illustrates how to use Lambda PowerTools to process SQS messages in batches (with IaC on top of CDK). +This repository contains a well documented example of a Transactional Messages App that illustrates how to use Powertools for AWS Lambda (Python) to process SQS messages in batches (with IaC on top of CDK). -It uses LambdaPowerTools Logger, Tracing, DataClasses and includes unit tests. +It uses Powertools for AWS Lambda (Python) Logger, Tracing, DataClasses and includes unit tests. :material-github: [github.com/san99tiago/aws-cdk-transactional-messages](https://github.com/san99tiago/aws-cdk-transactional-messages){:target="_blank"} diff --git a/examples/event_handler_graphql/sam/template.yaml b/examples/event_handler_graphql/sam/template.yaml index 7639114802c..b676d957b9d 100644 --- a/examples/event_handler_graphql/sam/template.yaml +++ b/examples/event_handler_graphql/sam/template.yaml @@ -9,7 +9,7 @@ Globals: Tracing: Active Environment: Variables: - # Powertools env vars: https://awslabs.github.io/aws-lambda-powertools-python/latest/#environment-variables + # Powertools for AWS Lambda (Python) env vars: https://awslabs.github.io/aws-lambda-powertools-python/latest/#environment-variables LOG_LEVEL: INFO POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1 POWERTOOLS_LOGGER_LOG_EVENT: true diff --git a/layer/README.md b/layer/README.md index 99da0083ffc..3d43a66a7f1 100644 --- a/layer/README.md +++ b/layer/README.md @@ -1,11 +1,11 @@ <!-- markdownlint-disable MD041 MD043--> -# CDK Powertools layer +# CDK Powertools for AWS Lambda (Python) layer -This is a CDK project to build and deploy AWS Lambda Powertools [Lambda layer](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-concepts.html#gettingstarted-concepts-layer) to multiple commercial regions. +This is a CDK project to build and deploy Powertools for AWS Lambda (Python) [Lambda layer](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-concepts.html#gettingstarted-concepts-layer) to multiple commercial regions. ## Build the layer -To build the layer construct you need to provide the Powertools version that is [available in PyPi](https://pypi.org/project/aws-lambda-powertools/). +To build the layer construct you need to provide the Powertools for AWS Lambda (Python) version that is [available in PyPi](https://pypi.org/project/aws-lambda-powertools/). You can pass it as a context variable when running `synth` or `deploy`, ```shell @@ -22,6 +22,6 @@ The layer stack writes the layer ARN after the deployment as SSM parameter and t ## Version tracking AWS Lambda versions Lambda layers by incrementing a number at the end of the ARN. -This makes it challenging to know which Powertools version a layer contains. -For better tracking of the ARNs and the corresponding version we need to keep track which powertools version was deployed to which layer. -To achieve that we created two components. First, we created a version tracking app which receives events via EventBridge. Second, after a successful canary deployment we send the layer ARN, Powertools version, and the region to this EventBridge. +This makes it challenging to know which Powertools for AWS Lambda (Python) version a layer contains. +For better tracking of the ARNs and the corresponding version we need to keep track which Powertools for AWS Lambda (Python) version was deployed to which layer. +To achieve that we created two components. First, we created a version tracking app which receives events via EventBridge. Second, after a successful canary deployment we send the layer ARN, Powertools for AWS Lambda (Python) version, and the region to this EventBridge. diff --git a/layer/app.py b/layer/app.py index f9d0f778df0..7bc5d8b0103 100644 --- a/layer/app.py +++ b/layer/app.py @@ -13,7 +13,7 @@ if not POWERTOOLS_VERSION: raise ValueError( - "Please set the version for Powertools by passing the '--context version=<version>' parameter to the CDK " + "Please set the version for Powertools for AWS Lambda (Python) by passing the '--context version=<version>' parameter to the CDK " "synth step." ) diff --git a/layer/layer/canary/app.py b/layer/layer/canary/app.py index e9d8d5d7679..9dea0297690 100644 --- a/layer/layer/canary/app.py +++ b/layer/layer/canary/app.py @@ -81,17 +81,17 @@ def check_envs(): def verify_powertools_version() -> None: """ - fetches the version that we import from the powertools layer and compares + fetches the version that we import from the Powertools for AWS Lambda (Python) layer and compares it with expected version set in environment variable, which we pass during deployment. :raise ValueError if the expected version is not the same as the version we get from the layer """ - logger.info("Checking Powertools version in library...") + logger.info("Checking Powertools for AWS Lambda (Python) version in library...") current_version = version("aws_lambda_powertools") if powertools_version != current_version: raise ValueError( - f'Expected Powertools version is "{powertools_version}", but layer contains version "{current_version}"' + f'Expected Powertools for AWS Lambda (Python) version is "{powertools_version}", but layer contains version "{current_version}"' ) - logger.info(f"Current Powertools version is: {current_version} [{_get_architecture()}]") + logger.info(f"Current Powertools for AWS Lambda (Python) version is: {current_version} [{_get_architecture()}]") def send_notification(): diff --git a/layer/pyproject.toml b/layer/pyproject.toml index 5be2628e825..f3ea621cf0f 100644 --- a/layer/pyproject.toml +++ b/layer/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "aws-lambda-powertools-python-layer" version = "1.1.0" -description = "AWS Lambda Powertools for Python Lambda Layers" +description = "Powertools for AWS Lambda (Python) Lambda Layers" authors = ["DevAx <aws-devax-open-source@amazon.com>"] license = "MIT" diff --git a/layer/scripts/layer-balancer/main.go b/layer/scripts/layer-balancer/main.go index cf2f0c1728e..0a800a5c524 100644 --- a/layer/scripts/layer-balancer/main.go +++ b/layer/scripts/layer-balancer/main.go @@ -32,12 +32,12 @@ type LayerInfo struct { var canonicalLayers = []LayerInfo{ { Name: "AWSLambdaPowertoolsPythonV2", - Description: "Lambda Powertools for Python [x86_64] with extra dependencies version bump", + Description: "Powertools for AWS Lambda (Python) [x86_64] with extra dependencies version bump", Architecture: types.ArchitectureX8664, }, { Name: "AWSLambdaPowertoolsPythonV2-Arm64", - Description: "Lambda Powertools for Python [arm64] with extra dependencies version bump", + Description: "Powertools for AWS Lambda (Python) [arm64] with extra dependencies version bump", Architecture: types.ArchitectureArm64, }, } diff --git a/mkdocs.yml b/mkdocs.yml index 2880881af91..ce383a1b028 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,5 +1,5 @@ -site_name: AWS Lambda Powertools for Python -site_description: AWS Lambda Powertools for Python +site_name: Powertools for AWS Lambda (Python) +site_description: Powertools for AWS Lambda (Python) site_author: Amazon Web Services repo_url: https://github.com/awslabs/aws-lambda-powertools-python edit_uri: edit/develop/docs diff --git a/pyproject.toml b/pyproject.toml index 1ac5b04408d..77a7b470597 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "aws_lambda_powertools" version = "2.15.0" -description = "AWS Lambda Powertools is a developer toolkit to implement Serverless best practices and increase developer velocity." +description = "Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverless best practices and increase developer velocity." authors = ["Amazon Web Services"] include = ["aws_lambda_powertools/py.typed", "THIRD-PARTY-LICENSES"] classifiers=[ @@ -114,7 +114,7 @@ branch = true [tool.coverage.html] directory = "test_report" -title = "Lambda Powertools Test Coverage" +title = "Powertools for AWS Lambda (Python) Test Coverage" [tool.coverage.report] fail_under = 90 diff --git a/tests/e2e/idempotency/test_idempotency_dynamodb.py b/tests/e2e/idempotency/test_idempotency_dynamodb.py index 31382ff9050..f82a6c84441 100644 --- a/tests/e2e/idempotency/test_idempotency_dynamodb.py +++ b/tests/e2e/idempotency/test_idempotency_dynamodb.py @@ -35,7 +35,7 @@ def idempotency_table_name(infrastructure: dict) -> str: @pytest.mark.xdist_group(name="idempotency") def test_ttl_caching_expiration_idempotency(ttl_cache_expiration_handler_fn_arn: str): # GIVEN - payload = json.dumps({"message": "Lambda Powertools - TTL 5s"}) + payload = json.dumps({"message": "Powertools for AWS Lambda (Python) - TTL 5s"}) # WHEN # first execution @@ -65,8 +65,8 @@ def test_ttl_caching_expiration_idempotency(ttl_cache_expiration_handler_fn_arn: @pytest.mark.xdist_group(name="idempotency") def test_ttl_caching_timeout_idempotency(ttl_cache_timeout_handler_fn_arn: str): # GIVEN - payload_timeout_execution = json.dumps({"sleep": 5, "message": "Lambda Powertools - TTL 1s"}) - payload_working_execution = json.dumps({"sleep": 0, "message": "Lambda Powertools - TTL 1s"}) + payload_timeout_execution = json.dumps({"sleep": 5, "message": "Powertools for AWS Lambda (Python) - TTL 1s"}) + payload_working_execution = json.dumps({"sleep": 0, "message": "Powertools for AWS Lambda (Python) - TTL 1s"}) # WHEN # first call should fail due to timeout @@ -89,7 +89,7 @@ def test_ttl_caching_timeout_idempotency(ttl_cache_timeout_handler_fn_arn: str): @pytest.mark.xdist_group(name="idempotency") def test_parallel_execution_idempotency(parallel_execution_handler_fn_arn: str): # GIVEN - arguments = json.dumps({"message": "Lambda Powertools - Parallel execution"}) + arguments = json.dumps({"message": "Powertools for AWS Lambda (Python) - Parallel execution"}) # WHEN # executing Lambdas in parallel @@ -107,7 +107,7 @@ def test_parallel_execution_idempotency(parallel_execution_handler_fn_arn: str): @pytest.mark.xdist_group(name="idempotency") def test_idempotent_function_thread_safety(function_thread_safety_handler_fn_arn: str): # GIVEN - payload = json.dumps({"message": "Lambda Powertools - Idempotent function thread safety check"}) + payload = json.dumps({"message": "Powertools for AWS Lambda (Python) - Idempotent function thread safety check"}) # WHEN # first execution diff --git a/tests/e2e/parameters/infrastructure.py b/tests/e2e/parameters/infrastructure.py index 58065ea9848..db76a68def3 100644 --- a/tests/e2e/parameters/infrastructure.py +++ b/tests/e2e/parameters/infrastructure.py @@ -40,7 +40,7 @@ def _create_app_config(self, function: Function): self.stack, id="appconfig-app", name=f"powertools-e2e-{service_name}", - description="Lambda Powertools End-to-End testing for AppConfig", + description="Powertools for AWS Lambda (Python) End-to-End testing for AppConfig", ) CfnOutput(self.stack, "AppConfigApplication", value=cfn_application.name) @@ -49,7 +49,7 @@ def _create_app_config(self, function: Function): "appconfig-env", application_id=cfn_application.ref, name=f"powertools-e2e{service_name}", - description="Lambda Powertools End-to-End testing environment", + description="Powertools for AWS Lambda (Python) End-to-End testing environment", ) CfnOutput(self.stack, "AppConfigEnvironment", value=cfn_environment.name) diff --git a/tests/e2e/utils/data_fetcher/logs.py b/tests/e2e/utils/data_fetcher/logs.py index 79fcee9290b..c81bd1bca7d 100644 --- a/tests/e2e/utils/data_fetcher/logs.py +++ b/tests/e2e/utils/data_fetcher/logs.py @@ -31,7 +31,7 @@ def __init__( filter_expression: Optional[str] = None, minimum_log_entries: int = 1, ): - """Fetch and expose Powertools Logger logs from CloudWatch Logs + """Fetch and expose Powertools for AWS Lambda (Python) Logger logs from CloudWatch Logs Parameters ---------- diff --git a/tests/functional/idempotency/test_idempotency.py b/tests/functional/idempotency/test_idempotency.py index 23d0537e533..358a8dd76a1 100644 --- a/tests/functional/idempotency/test_idempotency.py +++ b/tests/functional/idempotency/test_idempotency.py @@ -1058,7 +1058,7 @@ def test_custom_jmespath_function_overrides_builtin_functions( config_with_jmespath_options: IdempotencyConfig, persistence_store: DynamoDBPersistenceLayer ): # GIVEN a persistence store with a custom jmespath_options - # AND use a builtin powertools custom function + # AND use a builtin Powertools for AWS Lambda (Python) custom function persistence_store.configure(config_with_jmespath_options) with pytest.raises(jmespath.exceptions.UnknownFunctionError, match="Unknown function: powertools_json()"): diff --git a/tests/functional/test_logger.py b/tests/functional/test_logger.py index 412a9358553..00f7a8e4482 100644 --- a/tests/functional/test_logger.py +++ b/tests/functional/test_logger.py @@ -885,7 +885,7 @@ def test_set_package_logger_handler_with_powertools_debug_env_var(stdout, monkey logger = logging.getLogger("aws_lambda_powertools") # WHEN set_package_logger is used at initialization - # and any Powertools operation is used (e.g., Tracer) + # and any Powertools for AWS Lambda (Python) operation is used (e.g., Tracer) set_package_logger_handler(stream=stdout) Tracer(disabled=True) diff --git a/tests/functional/test_logger_utils.py b/tests/functional/test_logger_utils.py index 0e0c7fc7766..b1a1b12ee76 100644 --- a/tests/functional/test_logger_utils.py +++ b/tests/functional/test_logger_utils.py @@ -50,13 +50,13 @@ def service_name(): def test_copy_config_to_ext_loggers(stdout, logger, log_level): - # GIVEN two external loggers and powertools logger initialized + # GIVEN two external loggers and Powertools for AWS Lambda (Python) logger initialized logger_1 = logger() logger_2 = logger() powertools_logger = Logger(service=service_name(), level=log_level.INFO.value, stream=stdout) - # WHEN configuration copied from powertools logger to ALL external loggers + # WHEN configuration copied from Powertools for AWS Lambda (Python) logger to ALL external loggers # AND external loggers used utils.copy_config_to_registered_loggers(source_logger=powertools_logger) msg = "test message1" @@ -64,7 +64,7 @@ def test_copy_config_to_ext_loggers(stdout, logger, log_level): logger_2.info(msg) logs = capture_multiple_logging_statements_output(stdout) - # THEN all external loggers used Powertools handler, formatter and log level + # THEN all external loggers used Powertools for AWS Lambda (Python) handler, formatter and log level for index, logger in enumerate([logger_1, logger_2]): assert len(logger.handlers) == 1 assert isinstance(logger.handlers[0], logging.StreamHandler) @@ -75,18 +75,18 @@ def test_copy_config_to_ext_loggers(stdout, logger, log_level): def test_copy_config_to_ext_loggers_include(stdout, logger, log_level): - # GIVEN an external logger and powertools logger initialized + # GIVEN an external logger and Powertools for AWS Lambda (Python) logger initialized logger = logger() powertools_logger = Logger(service=service_name(), level=log_level.INFO.value, stream=stdout) - # WHEN configuration copied from powertools logger to INCLUDED external loggers + # WHEN configuration copied from Powertools for AWS Lambda (Python) logger to INCLUDED external loggers # AND our external logger used utils.copy_config_to_registered_loggers(source_logger=powertools_logger, include={logger.name}) msg = "test message2" logger.info(msg) log = capture_logging_output(stdout) - # THEN included external loggers used Powertools handler, formatter and log level. + # THEN included external loggers used Powertools for AWS Lambda (Python) handler, formatter and log level. assert len(logger.handlers) == 1 assert isinstance(logger.handlers[0], logging.StreamHandler) assert isinstance(logger.handlers[0].formatter, formatter.LambdaPowertoolsFormatter) @@ -96,11 +96,11 @@ def test_copy_config_to_ext_loggers_include(stdout, logger, log_level): def test_copy_config_to_ext_loggers_wrong_include(stdout, logger, log_level): - # GIVEN an external logger and powertools logger initialized + # GIVEN an external logger and Powertools for AWS Lambda (Python) for AWS Lambda (Python) logger initialized logger = logger() powertools_logger = Logger(service=service_name(), level=log_level.INFO.value, stream=stdout) - # WHEN configuration copied from powertools logger to INCLUDED NON EXISTING external loggers + # WHEN configuration copied from Powertools for AWS Lambda (Python) for AWS Lambda (Python) logger to INCLUDED NON EXISTING external loggers utils.copy_config_to_registered_loggers(source_logger=powertools_logger, include={"non-existing-logger"}) # THEN existing external logger is not modified @@ -108,11 +108,11 @@ def test_copy_config_to_ext_loggers_wrong_include(stdout, logger, log_level): def test_copy_config_to_ext_loggers_exclude(stdout, logger, log_level): - # GIVEN an external logger and powertools logger initialized + # GIVEN an external logger and Powertools for AWS Lambda (Python) logger initialized logger = logger() powertools_logger = Logger(service=service_name(), level=log_level.INFO.value, stream=stdout) - # WHEN configuration copied from powertools logger to ALL BUT external logger + # WHEN configuration copied from Powertools for AWS Lambda (Python) logger to ALL BUT external logger utils.copy_config_to_registered_loggers(source_logger=powertools_logger, exclude={logger.name}) # THEN external logger is not modified @@ -120,13 +120,13 @@ def test_copy_config_to_ext_loggers_exclude(stdout, logger, log_level): def test_copy_config_to_ext_loggers_include_exclude(stdout, logger, log_level): - # GIVEN two external loggers and powertools logger initialized + # GIVEN two external loggers and Powertools for AWS Lambda (Python) logger initialized logger_1 = logger() logger_2 = logger() powertools_logger = Logger(service=service_name(), level=log_level.INFO.value, stream=stdout) - # WHEN configuration copied from powertools logger to INCLUDED external loggers + # WHEN configuration copied from Powertools for AWS Lambda (Python) logger to INCLUDED external loggers # AND external logger_1 is also in EXCLUDE list utils.copy_config_to_registered_loggers( source_logger=powertools_logger, include={logger_1.name, logger_2.name}, exclude={logger_1.name} @@ -135,7 +135,7 @@ def test_copy_config_to_ext_loggers_include_exclude(stdout, logger, log_level): logger_2.info(msg) log = capture_logging_output(stdout) - # THEN logger_1 is not modified and Logger_2 used Powertools handler, formatter and log level + # THEN logger_1 is not modified and Logger_2 used Powertools for AWS Lambda (Python) handler, formatter and log level assert not logger_1.handlers assert len(logger_2.handlers) == 1 assert isinstance(logger_2.handlers[0], logging.StreamHandler) @@ -146,16 +146,16 @@ def test_copy_config_to_ext_loggers_include_exclude(stdout, logger, log_level): def test_copy_config_to_ext_loggers_clean_old_handlers(stdout, logger, log_level): - # GIVEN an external logger with handler and powertools logger initialized + # GIVEN an external logger with handler and Powertools for AWS Lambda (Python) logger initialized logger = logger() handler = logging.NullHandler() logger.addHandler(handler) powertools_logger = Logger(service=service_name(), level=log_level.INFO.value, stream=stdout) - # WHEN configuration copied from powertools logger to ALL external loggers + # WHEN configuration copied from Powertools for AWS Lambda (Python) logger to ALL external loggers utils.copy_config_to_registered_loggers(source_logger=powertools_logger) - # THEN old logger's handler removed and Powertools configuration used instead + # THEN old logger's handler removed and Powertools for AWS Lambda (Python) configuration used instead assert len(logger.handlers) == 1 assert isinstance(logger.handlers[0], logging.StreamHandler) assert isinstance(logger.handlers[0].formatter, formatter.LambdaPowertoolsFormatter) @@ -163,11 +163,11 @@ def test_copy_config_to_ext_loggers_clean_old_handlers(stdout, logger, log_level @pytest.mark.parametrize("level_to_set", ["WARNING", 30]) def test_copy_config_to_ext_loggers_custom_log_level(stdout, logger, log_level, level_to_set): - # GIVEN an external logger and powertools logger initialized + # GIVEN an external logger and Powertools for AWS Lambda (Python) logger initialized logger = logger() powertools_logger = Logger(service=service_name(), level=log_level.CRITICAL.value, stream=stdout) - # WHEN configuration copied from powertools logger to INCLUDED external logger + # WHEN configuration copied from Powertools for AWS Lambda (Python) logger to INCLUDED external logger # AND external logger used with custom log_level utils.copy_config_to_registered_loggers( source_logger=powertools_logger, include={logger.name}, log_level=level_to_set @@ -176,7 +176,7 @@ def test_copy_config_to_ext_loggers_custom_log_level(stdout, logger, log_level, logger.warning(msg) log = capture_logging_output(stdout) - # THEN external logger used Powertools handler, formatter and CUSTOM log level. + # THEN external logger used Powertools for AWS Lambda (Python) handler, formatter and CUSTOM log level. assert len(logger.handlers) == 1 assert isinstance(logger.handlers[0], logging.StreamHandler) assert isinstance(logger.handlers[0].formatter, formatter.LambdaPowertoolsFormatter) @@ -187,10 +187,10 @@ def test_copy_config_to_ext_loggers_custom_log_level(stdout, logger, log_level, def test_copy_config_to_ext_loggers_should_not_break_append_keys(stdout, log_level): - # GIVEN powertools logger initialized + # GIVEN Powertools for AWS Lambda (Python) logger initialized powertools_logger = Logger(service=service_name(), level=log_level.INFO.value, stream=stdout) - # WHEN configuration copied from powertools logger to ALL external loggers + # WHEN configuration copied from Powertools for AWS Lambda (Python) logger to ALL external loggers utils.copy_config_to_registered_loggers(source_logger=powertools_logger) # THEN append_keys should not raise an exception @@ -198,8 +198,8 @@ def test_copy_config_to_ext_loggers_should_not_break_append_keys(stdout, log_lev def test_copy_config_to_parent_loggers_only(stdout): - # GIVEN Powertools Logger and Child Logger are initialized - # and Powertools Logger config is copied over + # GIVEN Powertools for AWS Lambda (Python) Logger and Child Logger are initialized + # and Powertools for AWS Lambda (Python) Logger config is copied over service = service_name() child = Logger(stream=stdout, service=service, child=True) parent = Logger(stream=stdout, service=service) @@ -220,8 +220,8 @@ def test_copy_config_to_parent_loggers_only(stdout): def test_copy_config_to_parent_loggers_only_with_exclude(stdout): - # GIVEN Powertools Logger and Child Logger are initialized - # and Powertools Logger config is copied over with exclude set + # GIVEN Powertools for AWS Lambda (Python) Logger and Child Logger are initialized + # and Powertools for AWS Lambda (Python) Logger config is copied over with exclude set service = service_name() child = Logger(stream=stdout, service=service, child=True) parent = Logger(stream=stdout, service=service) @@ -242,7 +242,7 @@ def test_copy_config_to_parent_loggers_only_with_exclude(stdout): def test_copy_config_to_ext_loggers_no_duplicate_logs(stdout, logger, log_level): - # GIVEN an root logger, external logger and powertools logger initialized + # GIVEN an root logger, external logger and Powertools for AWS Lambda (Python) logger initialized root_logger = logging.getLogger() handler = logging.StreamHandler(stdout) @@ -255,7 +255,7 @@ def test_copy_config_to_ext_loggers_no_duplicate_logs(stdout, logger, log_level) powertools_logger = Logger(service=service_name(), level=log_level.CRITICAL.value, stream=stdout) level = log_level.WARNING.name - # WHEN configuration copied from powertools logger + # WHEN configuration copied from Powertools for AWS Lambda (Python) logger # AND external logger used with custom log_level utils.copy_config_to_registered_loggers(source_logger=powertools_logger, include={logger.name}, log_level=level) msg = "test message4" @@ -268,14 +268,14 @@ def test_copy_config_to_ext_loggers_no_duplicate_logs(stdout, logger, log_level) def test_logger_name_is_included_during_copy(stdout, logger, log_level): - # GIVEN two external loggers and powertools logger initialized + # GIVEN two external loggers and Powertools for AWS Lambda (Python) logger initialized logger_1: logging.Logger = logger() logger_2: logging.Logger = logger() msg = "test message1" powertools_logger = Logger(service=service_name(), level=log_level.INFO.value, stream=stdout) - # WHEN configuration copied from powertools logger to ALL external loggers + # WHEN configuration copied from Powertools for AWS Lambda (Python) logger to ALL external loggers # AND external loggers used utils.copy_config_to_registered_loggers(source_logger=powertools_logger, include={logger_1.name, logger_2.name}) logger_1.info(msg) From be0bd32c5f45ce9fccb1f9fa16fd38b13484d5b4 Mon Sep 17 00:00:00 2001 From: Simon Thulbourn <sthulb@users.noreply.github.com> Date: Tue, 23 May 2023 17:23:39 +0200 Subject: [PATCH 2/4] Update we_made_this.md Signed-off-by: Simon Thulbourn <sthulb@users.noreply.github.com> --- docs/we_made_this.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/we_made_this.md b/docs/we_made_this.md index c7aed5d658d..f160b30e39c 100644 --- a/docs/we_made_this.md +++ b/docs/we_made_this.md @@ -17,11 +17,11 @@ Join us on [Discord](https://discord.gg/B8zZKbbyET){target="_blank"} to connect ## Blog posts -### AWS Lambda Cookbook β€” Following best practices with Powertools for AWS Lambda (Python) +### AWS Lambda Cookbook β€” Following best practices with Lambda Powertools > **Author: [Ran Isenberg](mailto:ran.isenberg@ranthebuilder.cloud) [:material-twitter:](https://twitter.com/IsenbergRan){target="_blank"} [:material-linkedin:](https://www.linkedin.com/in/ranisenberg/){target="_blank"}** -A collection of articles explaining in detail how Powertools for AWS Lambda (Python) helps with a Serverless adoption strategy and its challenges. +A collection of articles explaining in detail how Lambda Powertools helps with a Serverless adoption strategy and its challenges. * [Part 1 - Logging](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-elevate-your-handler-s-code-part-1-logging){:target="_blank"} @@ -43,7 +43,7 @@ This article dives into what idempotency means for APIs, their use cases, and ho * [blog.walmsles.io/making-all-your-apis-idempotent](https://blog.walmsles.io/making-all-your-apis-idempotent){target="_blank"} -### Deep dive on Powertools for AWS Lambda (Python) Idempotency feature +### Deep dive on Lambda Powertools Idempotency feature > **Author: [Michael Walmsley](https://twitter.com/walmsles){target="_blank"}** :material-twitter: @@ -51,11 +51,11 @@ This article describes how to best calculate your idempotency token, implementat * [blog.walmsles.io/aws-lambda-powertools-idempotency-a-deeper-dive](https://blog.walmsles.io/aws-lambda-powertools-idempotency-a-deeper-dive){target="_blank"} -### Developing AWS Lambda functions with Powertools for AWS Lambda (Python) +### Developing AWS Lambda functions with AWS Lambda Powertools > **Author: [Stephan Huber](https://linkedin.com/in/sthuber90){target="_blank"}** :material-linkedin: -This article walks through how to add Powertools for AWS Lambda (Python) to an existing project, covers Tracer, Logger, Metrics, and JSON Schema Validation. +This article walks through how to add Powertools to an existing project, covers Tracer, Logger, Metrics, and JSON Schema Validation. * [globaldatanet.com/tech-blog/develop-lambda-functions-with-aws-lambda-powertools](https://globaldatanet.com/tech-blog/develop-lambda-functions-with-aws-lambda-powertools){target="_blank"} @@ -72,7 +72,7 @@ This article walks through a sample AWS EventBridge cookiecutter template presen > **Author: [Ran Isenberg](mailto:ran.isenberg@ranthebuilder.cloud) [:material-twitter:](https://twitter.com/IsenbergRan){target="_blank"} [:material-linkedin:](https://www.linkedin.com/in/ranisenberg/){target="_blank"}** -This article walks through how CyberArk uses Powertools for AWS Lambda (Python) to implement Feature Flags with AWS AppConfig +This article walks through how CyberArk uses Powertools to implement Feature Flags with AWS AppConfig * [aws.amazon.com/blogs/mt/how-cyberark-implements-feature-flags-with-aws-appconfig](https://aws.amazon.com/blogs/mt/how-cyberark-implements-feature-flags-with-aws-appconfig){target="_blank"} @@ -82,13 +82,13 @@ This article walks through how CyberArk uses Powertools for AWS Lambda (Python) > **Author: [Ran Isenberg](mailto:ran.isenberg@ranthebuilder.cloud) [:material-twitter:](https://twitter.com/IsenbergRan){target="_blank"} [:material-linkedin:](https://www.linkedin.com/in/ranisenberg/){target="_blank"}** -When building applications with AWS Lambda it is critical to verify the data structure and validate the input due to the multiple different sources that can trigger them. In this session Ran Isenberg (CyberArk) will present one of the interesting features of Powertools for AWS Lambda (Python) for python: the parser. +When building applications with AWS Lambda it is critical to verify the data structure and validate the input due to the multiple different sources that can trigger them. In this session Ran Isenberg (CyberArk) will present one of the interesting features of AWS Lambda Powertools for python: the parser. In this session you will learn how to increase code quality, extensibility and testability, boost you productivity and ship rock solid apps to production. <iframe src="https://player.twitch.tv/?video=1034744364&parent=awslabs.github.io&autoplay=false" frameborder="0" allowfullscreen="true" scrolling="no" height="378" width="620"></iframe> -#### Talk DEV to me | Feature Flags with Powertools for AWS Lambda (Python) +#### Talk DEV to me | Feature Flags with AWS Lambda Powertools > **Author: [Ran Isenberg](mailto:ran.isenberg@ranthebuilder.cloud) [:material-twitter:](https://twitter.com/IsenbergRan){target="_blank"} [:material-linkedin:](https://www.linkedin.com/in/ranisenberg/){target="_blank"}** @@ -102,7 +102,7 @@ A deep dive in the [Feature Flags](./utilities/feature_flags.md){target="_blank" Feature flags can improve your CI/CD process by enabling capabilities otherwise not possible, thus making them an enabler of DevOps and a crucial part of continuous integration. Partial rollouts, A/B testing, and the ability to quickly change a configuration without redeploying code are advantages you gain by using features flags. -In this talk, you will learn the added value of using feature flags as part of your CI/CD process and how Powertools for AWS Lambda (Python) can help with that. +In this talk, you will learn the added value of using feature flags as part of your CI/CD process and how AWS Lambda Powertools can help with that. <iframe width="620" height="378" src="https://www.youtube.com/embed/3IT4UzN9Jds" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> @@ -114,7 +114,7 @@ In this talk, you will learn the added value of using feature flags as part of y This repo contains documentation for a live coding workshop for the AWS Programming and Tools Meetup in Melbourne. The workshop will start with the SAM Cli "Hello World" example API project. -Throughout the labs we will introduce each of the Powertools for AWS Lambda (Python) Core utilities to showcase how simple they are to use and adopt for all your projects, and how powerful they are at bringing you closer to the Well Architected Serverless Lens. +Throughout the labs we will introduce each of the AWS Lambda Powertools Core utilities to showcase how simple they are to use and adopt for all your projects, and how powerful they are at bringing you closer to the Well Architected Serverless Lens. * :material-github: [github.com/walmsles/lambda-powertools-coding-workshop](https://github.com/walmsles/lambda-powertools-coding-workshop){target="_blank"} @@ -130,7 +130,7 @@ Throughout the labs we will introduce each of the Powertools for AWS Lambda (Pyt This repository provides a working, deployable, open source based, AWS Lambda handler and [AWS CDK](https://aws.amazon.com/cdk/){target="_blank"} Python code. -This handler embodies Serverless best practices and has all the bells and whistles for a proper production ready handler. It uses many of the Powertools for AWS Lambda (Python) utilities for Python. +This handler embodies Serverless best practices and has all the bells and whistles for a proper production ready handler. It uses many of the AWS Lambda Powertools utilities for Python. :material-github: [github.com/ran-isenberg/aws-lambda-handler-cookbook](https://github.com/ran-isenberg/aws-lambda-handler-cookbook){:target="_blank"} @@ -138,8 +138,8 @@ This handler embodies Serverless best practices and has all the bells and whistl > **Author: [Santiago Garcia Arango](mailto:san99tiago@gmail.com) [:material-web:](https://san99tiago.com/){target="_blank"} [:material-linkedin:](https://www.linkedin.com/in/san99tiago/){target="_blank"}** -This repository contains a well documented example of a Transactional Messages App that illustrates how to use Powertools for AWS Lambda (Python) to process SQS messages in batches (with IaC on top of CDK). +This repository contains a well documented example of a Transactional Messages App that illustrates how to use Lambda PowerTools to process SQS messages in batches (with IaC on top of CDK). -It uses Powertools for AWS Lambda (Python) Logger, Tracing, DataClasses and includes unit tests. +It uses LambdaPowerTools Logger, Tracing, DataClasses and includes unit tests. :material-github: [github.com/san99tiago/aws-cdk-transactional-messages](https://github.com/san99tiago/aws-cdk-transactional-messages){:target="_blank"} From 07e001ba3ea6c0576a52189030759ac9484258cb Mon Sep 17 00:00:00 2001 From: Simon Thulbourn <sthulb@users.noreply.github.com> Date: Tue, 23 May 2023 15:28:52 +0000 Subject: [PATCH 3/4] fix linting issues --- aws_lambda_powertools/logging/logger.py | 8 ++++---- tests/functional/test_logger_utils.py | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/aws_lambda_powertools/logging/logger.py b/aws_lambda_powertools/logging/logger.py index 981bc0fc0d9..e1b1eb7f342 100644 --- a/aws_lambda_powertools/logging/logger.py +++ b/aws_lambda_powertools/logging/logger.py @@ -610,10 +610,10 @@ def structure_logs(self, append: bool = False, formatter_options: Optional[Dict] self.registered_handler.setFormatter(formatter) # when using a custom Powertools for AWS Lambda (Python) Formatter - # standard and custom keys that are not Powertools for AWS Lambda (Python) Formatter parameters should be appended - # and custom keys that might happen to be Powertools for AWS Lambda (Python) Formatter parameters should be discarded - # this prevents adding them as custom keys, for example, `json_default=<callable>` - # see https://github.com/awslabs/aws-lambda-powertools-python/issues/1263 + # standard and custom keys that are not Powertools for AWS Lambda (Python) Formatter parameters + # should be appended and custom keys that might happen to be Powertools for AWS Lambda (Python) + # Formatter parameters should be discarded this prevents adding them as custom keys, for example, + # `json_default=<callable>` see https://github.com/awslabs/aws-lambda-powertools-python/issues/1263 custom_keys = {k: v for k, v in log_keys.items() if k not in RESERVED_FORMATTER_CUSTOM_KEYS} return self.registered_formatter.append_keys(**custom_keys) diff --git a/tests/functional/test_logger_utils.py b/tests/functional/test_logger_utils.py index b1a1b12ee76..23796b74e6c 100644 --- a/tests/functional/test_logger_utils.py +++ b/tests/functional/test_logger_utils.py @@ -100,7 +100,8 @@ def test_copy_config_to_ext_loggers_wrong_include(stdout, logger, log_level): logger = logger() powertools_logger = Logger(service=service_name(), level=log_level.INFO.value, stream=stdout) - # WHEN configuration copied from Powertools for AWS Lambda (Python) for AWS Lambda (Python) logger to INCLUDED NON EXISTING external loggers + # WHEN configuration copied from Powertools for AWS Lambda (Python) for AWS Lambda (Python) logger + # to INCLUDED NON EXISTING external loggers utils.copy_config_to_registered_loggers(source_logger=powertools_logger, include={"non-existing-logger"}) # THEN existing external logger is not modified @@ -135,7 +136,8 @@ def test_copy_config_to_ext_loggers_include_exclude(stdout, logger, log_level): logger_2.info(msg) log = capture_logging_output(stdout) - # THEN logger_1 is not modified and Logger_2 used Powertools for AWS Lambda (Python) handler, formatter and log level + # THEN logger_1 is not modified and Logger_2 used Powertools for AWS Lambda (Python) handler, formatter and log + # level assert not logger_1.handlers assert len(logger_2.handlers) == 1 assert isinstance(logger_2.handlers[0], logging.StreamHandler) From a4560cc51e9431cd3d7b25c1d9067f918cd6be01 Mon Sep 17 00:00:00 2001 From: Leandro Damascena <leandro.damascena@gmail.com> Date: Tue, 30 May 2023 21:54:05 +0100 Subject: [PATCH 4/4] docs: missing rename templates --- examples/logger/sam/template.yaml | 2 +- examples/metrics/sam/template.yaml | 2 +- examples/tracer/sam/template.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/logger/sam/template.yaml b/examples/logger/sam/template.yaml index c45f6cd5e3b..7e4bde3512d 100644 --- a/examples/logger/sam/template.yaml +++ b/examples/logger/sam/template.yaml @@ -1,6 +1,6 @@ AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 -Description: AWS Lambda Powertools Tracer doc examples +Description: Powertools for AWS Lambda (Python) version Globals: Function: diff --git a/examples/metrics/sam/template.yaml b/examples/metrics/sam/template.yaml index 9f2784680e5..f300066b752 100644 --- a/examples/metrics/sam/template.yaml +++ b/examples/metrics/sam/template.yaml @@ -1,6 +1,6 @@ AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 -Description: AWS Lambda Powertools Metrics doc examples +Description: Powertools for AWS Lambda (Python) version Globals: Function: diff --git a/examples/tracer/sam/template.yaml b/examples/tracer/sam/template.yaml index 788c007cd86..f0da401d516 100644 --- a/examples/tracer/sam/template.yaml +++ b/examples/tracer/sam/template.yaml @@ -1,6 +1,6 @@ AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 -Description: AWS Lambda Powertools Tracer doc examples +Description: Powertools for AWS Lambda (Python) version Globals: Function: