Skip to content

Commit

Permalink
Merge branch 'develop' into chore/revert-cdk-dep
Browse files Browse the repository at this point in the history
* develop: (21 commits)
  chore: cleanup, add test for single and nested
  fix(parameters): make cache aware of single vs multiple calls
  docs: Add nathan hanks post community (aws-powertools#3727)
  chore(deps-dev): bump isort from 5.11.5 to 5.13.2 (aws-powertools#3723)
  chore(deps-dev): bump cfn-lint from 0.83.8 to 0.85.0 (aws-powertools#3724)
  chore(deps): bump actions/download-artifact from 4.1.1 to 4.1.2 (aws-powertools#3725)
  chore(deps-dev): bump types-python-dateutil from 2.8.19.14 to 2.8.19.20240106 (aws-powertools#3720)
  chore(ci): enable Redis e2e tests (aws-powertools#3718)
  chore(deps-dev): bump pytest from 7.4.4 to 8.0.0 (aws-powertools#3711)
  chore(deps): bump actions/upload-artifact from 3.1.3 to 4.3.1 (aws-powertools#3714)
  chore(ci): changelog rebuild (aws-powertools#3715)
  chore(deps-dev): bump mypy from 1.4.1 to 1.8.0 (aws-powertools#3710)
  chore(deps-dev): bump httpx from 0.24.1 to 0.26.0 (aws-powertools#3712)
  chore(deps): bump actions/download-artifact from 3.0.2 to 4.1.1 (aws-powertools#3612)
  chore(deps): bump codecov/codecov-action from 3.1.6 to 4.0.1 (aws-powertools#3700)
  chore(deps-dev): bump coverage from 7.2.7 to 7.4.1 (aws-powertools#3713)
  chore(deps-dev): bump the boto-typing group with 7 updates (aws-powertools#3709)
  chore(deps): bump squidfunk/mkdocs-material from `a4a2029` to `e0d6c67` in /docs (aws-powertools#3708)
  chore(deps): bump release-drafter/release-drafter from 5.25.0 to 6.0.0 (aws-powertools#3699)
  chore(ci): drop support for Python 3.7 (aws-powertools#3638)
  ...
  • Loading branch information
heitorlessa committed Feb 7, 2024
2 parents 73b2ad1 + e7d8dae commit 322ceb1
Show file tree
Hide file tree
Showing 53 changed files with 300 additions and 754 deletions.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ body:
attributes:
label: AWS Lambda function runtime
options:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/static_typing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ body:
attributes:
label: AWS Lambda function runtime
options:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: 'Dependency Review'
uses: actions/dependency-review-action@c74b580d73376b7750d3d2a50bfb8adc2c937507 # v3.1.5
uses: actions/dependency-review-action@4901385134134e04cec5fbe5ddfe3b2c5bd5d976 # v4.0.0
2 changes: 1 addition & 1 deletion .github/workflows/ossf_scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
repo_token: ${{ secrets.SCORECARD_TOKEN }} # read-only fine-grained token to read branch protection settings

- name: "Upload results"
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: SARIF file
path: results.sarif
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_v2_layer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ jobs:
- name: zip output
run: zip -r cdk.out.zip cdk.out
- name: Archive CDK artifacts
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: cdk-layer-artefact
path: layer/cdk.out.zip
Expand Down Expand Up @@ -258,7 +258,7 @@ jobs:
artifact_name: ${{ inputs.source_code_artifact_name }}

- name: Download CDK layer artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
name: cdk-layer-stack
path: cdk-layer-stack/
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/quality_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
env:
PYTHON: "${{ matrix.python-version }}"
permissions:
Expand All @@ -71,7 +71,7 @@ jobs:
- name: Complexity baseline
run: make complexity-baseline
- name: Upload coverage to Codecov
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # 3.1.6
uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # 4.0.1
with:
file: ./coverage.xml
env_vars: PYTHON
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quality_check_pydanticv2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
env:
PYTHON: "${{ matrix.python-version }}"
permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/record_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
script: |
const script = require('.github/scripts/save_pr_details.js')
await script({github, context, core})
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: pr
path: pr.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ jobs:
permissions:
contents: write # create release in draft mode
steps:
- uses: release-drafter/release-drafter@09c613e259eb8d4e7c81c2cb00618eb5fc4575a7 # v5.20.1
- uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v5.20.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions .github/workflows/reusable_deploy_v2_layer_stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ jobs:
- name: install deps
run: poetry install
- name: Download artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
name: ${{ inputs.artefact-name }}
path: layer
Expand All @@ -197,11 +197,12 @@ jobs:
cat cdk-layer-stack/${{ matrix.region }}-layer-version.txt
- name: Save Layer ARN artifact
if: ${{ inputs.stage == 'PROD' }}
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: cdk-layer-stack
path: ./layer/cdk-layer-stack/* # NOTE: upload-artifact does not inherit working-directory setting.
if-no-files-found: error
retention-days: 1
overwrite: true
- name: CDK Deploy Canary
run: npx cdk deploy --app cdk.out --context region=${{ matrix.region }} --parameters DeployStage="${{ inputs.stage }}" --parameters HasARM64Support=${{ matrix.has_arm64_support }} 'CanaryV2Stack' --require-approval never --verbose
2 changes: 1 addition & 1 deletion .github/workflows/reusable_deploy_v2_sar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
with:
node-version: ${{ env.NODE_VERSION }}
- name: Download artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
name: ${{ inputs.artefact-name }}
- name: Unzip artefact
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
strategy:
fail-fast: false # needed so if a version fails, the others will still be able to complete and cleanup
matrix:
version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
if: ${{ github.actor != 'dependabot[bot]' && github.repository == 'aws-powertools/powertools-lambda-python' }}
steps:
- name: "Checkout"
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@

## Maintenance

* **ci:** drop support for Python 3.7 ([#3638](https://github.com/aws-powertools/powertools-lambda-python/issues/3638))
* **deps:** bump squidfunk/mkdocs-material from `a4a2029` to `e0d6c67` in /docs ([#3708](https://github.com/aws-powertools/powertools-lambda-python/issues/3708))
* **deps:** bump release-drafter/release-drafter from 5.25.0 to 6.0.0 ([#3699](https://github.com/aws-powertools/powertools-lambda-python/issues/3699))
* **deps:** bump actions/dependency-review-action from 3.1.5 to 4.0.0 ([#3646](https://github.com/aws-powertools/powertools-lambda-python/issues/3646))
* **deps:** bump codecov/codecov-action from 3.1.6 to 4.0.1 ([#3700](https://github.com/aws-powertools/powertools-lambda-python/issues/3700))
* **deps:** bump actions/download-artifact from 3.0.2 to 4.1.1 ([#3612](https://github.com/aws-powertools/powertools-lambda-python/issues/3612))
* **deps-dev:** bump the boto-typing group with 7 updates ([#3709](https://github.com/aws-powertools/powertools-lambda-python/issues/3709))
* **deps-dev:** bump coverage from 7.2.7 to 7.4.1 ([#3713](https://github.com/aws-powertools/powertools-lambda-python/issues/3713))
* **deps-dev:** bump ruff from 0.1.15 to 0.2.0 ([#3702](https://github.com/aws-powertools/powertools-lambda-python/issues/3702))
* **deps-dev:** bump aws-cdk from 2.125.0 to 2.126.0 ([#3701](https://github.com/aws-powertools/powertools-lambda-python/issues/3701))
* **deps-dev:** bump httpx from 0.24.1 to 0.26.0 ([#3712](https://github.com/aws-powertools/powertools-lambda-python/issues/3712))


<a name="v2.33.0"></a>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

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

Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverless [best practices and increase developer velocity](https://docs.powertools.aws.dev/lambda/python/latest/#features).

Expand Down
51 changes: 0 additions & 51 deletions aws_lambda_powertools/logging/compat.py

This file was deleted.

22 changes: 0 additions & 22 deletions aws_lambda_powertools/logging/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
overload,
)

from aws_lambda_powertools.logging import compat
from aws_lambda_powertools.shared import constants
from aws_lambda_powertools.shared.functions import (
extract_event_from_common_models,
Expand Down Expand Up @@ -302,9 +301,6 @@ def _init_logger(
self.addHandler(self.logger_handler)
self.structure_logs(formatter_options=formatter_options, **kwargs)

# Maintenance: We can drop this upon Py3.7 EOL. It's a backport for "location" key to work
self._logger.findCaller = compat.findCaller # type: ignore[method-assign]

# Pytest Live Log feature duplicates log records for colored output
# but we explicitly add a filter for log deduplication.
# This flag disables this protection when you explicit want logs to be duplicated (#262)
Expand Down Expand Up @@ -467,9 +463,6 @@ def info(
extra = extra or {}
extra = {**extra, **kwargs}

# Maintenance: We can drop this upon Py3.7 EOL. It's a backport for "location" key to work
if sys.version_info < (3, 8): # pragma: no cover
return self._logger.info(msg, *args, exc_info=exc_info, stack_info=stack_info, extra=extra)
return self._logger.info(
msg,
*args,
Expand All @@ -492,9 +485,6 @@ def error(
extra = extra or {}
extra = {**extra, **kwargs}

# Maintenance: We can drop this upon Py3.7 EOL. It's a backport for "location" key to work
if sys.version_info < (3, 8): # pragma: no cover
return self._logger.error(msg, *args, exc_info=exc_info, stack_info=stack_info, extra=extra)
return self._logger.error(
msg,
*args,
Expand All @@ -517,9 +507,6 @@ def exception(
extra = extra or {}
extra = {**extra, **kwargs}

# Maintenance: We can drop this upon Py3.7 EOL. It's a backport for "location" key to work
if sys.version_info < (3, 8): # pragma: no cover
return self._logger.exception(msg, *args, exc_info=exc_info, stack_info=stack_info, extra=extra)
return self._logger.exception(
msg,
*args,
Expand All @@ -542,9 +529,6 @@ def critical(
extra = extra or {}
extra = {**extra, **kwargs}

# Maintenance: We can drop this upon Py3.7 EOL. It's a backport for "location" key to work
if sys.version_info < (3, 8): # pragma: no cover
return self._logger.critical(msg, *args, exc_info=exc_info, stack_info=stack_info, extra=extra)
return self._logger.critical(
msg,
*args,
Expand All @@ -567,9 +551,6 @@ def warning(
extra = extra or {}
extra = {**extra, **kwargs}

# Maintenance: We can drop this upon Py3.7 EOL. It's a backport for "location" key to work
if sys.version_info < (3, 8): # pragma: no cover
return self._logger.warning(msg, *args, exc_info=exc_info, stack_info=stack_info, extra=extra)
return self._logger.warning(
msg,
*args,
Expand All @@ -592,9 +573,6 @@ def debug(
extra = extra or {}
extra = {**extra, **kwargs}

# Maintenance: We can drop this upon Py3.7 EOL. It's a backport for "location" key to work
if sys.version_info < (3, 8): # pragma: no cover
return self._logger.debug(msg, *args, exc_info=exc_info, stack_info=stack_info, extra=extra)
return self._logger.debug(
msg,
*args,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ def serialize_metric_set(
],
},
# NOTE: Mypy doesn't recognize splats '** syntax' in TypedDict
**dimensions, # type: ignore[misc] # "service": "test_service"
**metadata, # "username": "test"
**dimensions, # "service": "test_service"
**metadata, # type: ignore[typeddict-item] # "username": "test"
**metric_names_and_values, # "single_metric": 1.0
}

Expand Down
8 changes: 1 addition & 7 deletions aws_lambda_powertools/shared/types.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import sys
from typing import Any, Callable, Dict, List, TypeVar, Union

if sys.version_info >= (3, 8):
from typing import Literal, Protocol, TypedDict
else:
from typing_extensions import Literal, Protocol, TypedDict
from typing import Any, Callable, Dict, List, Literal, Protocol, TypedDict, TypeVar, Union

if sys.version_info >= (3, 9):
from typing import Annotated
Expand All @@ -16,7 +11,6 @@
else:
from typing_extensions import NotRequired


# Even though `get_args` and `get_origin` were added in Python 3.8, they only handle Annotated correctly on 3.10.
# So for python < 3.10 we use the backport from typing_extensions.
if sys.version_info >= (3, 10):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from functools import cached_property
from typing import Any, Dict, Iterator, Optional

from aws_lambda_powertools.utilities.data_classes.common import DictWrapper
Expand All @@ -23,12 +24,9 @@ def decoded_data(self) -> str:
"""Decodes the data as a str"""
return base64_decode(self.data)

@property
@cached_property
def json_data(self) -> Any:
"""Parses the data as json"""
if self._json_data is None:
self._json_data = self._json_deserializer(self.decoded_data)
return self._json_data
return self._json_deserializer(self.decoded_data)

@property
def connection_id(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import tempfile
import zipfile
from functools import cached_property
from typing import Any, Dict, List, Optional
from urllib.parse import unquote_plus

Expand All @@ -17,12 +18,13 @@ def user_parameters(self) -> Optional[str]:
"""User parameters"""
return self.get("UserParameters", None)

@property
@cached_property
def decoded_user_parameters(self) -> Optional[Dict[str, Any]]:
"""Json Decoded user parameters"""
if self._json_data is None and self.user_parameters is not None:
self._json_data = self._json_deserializer(self.user_parameters)
return self._json_data
if self.user_parameters is not None:
return self._json_deserializer(self.user_parameters)

return None


class CodePipelineActionConfiguration(DictWrapper):
Expand Down
Loading

0 comments on commit 322ceb1

Please sign in to comment.