From 741b87a86371777fbd5ba30a7384ed7bfc0de21f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Thu, 29 Sep 2022 13:40:12 +0200 Subject: [PATCH 01/36] feat(layers): add initial support for publishing v2 beta layer --- .github/workflows/publish_v2_layer.yaml | 86 ++++++++++++++++ .../reusable_deploy_v2_layer_stack.yml | 99 +++++++++++++++++++ 2 files changed, 185 insertions(+) create mode 100644 .github/workflows/publish_v2_layer.yaml create mode 100644 .github/workflows/reusable_deploy_v2_layer_stack.yml diff --git a/.github/workflows/publish_v2_layer.yaml b/.github/workflows/publish_v2_layer.yaml new file mode 100644 index 00000000000..4645c1a0a10 --- /dev/null +++ b/.github/workflows/publish_v2_layer.yaml @@ -0,0 +1,86 @@ +name: Deploy v2 layer to all regions + +permissions: + id-token: write + contents: read + +on: + workflow_dispatch: + inputs: + latest_published_version: + description: "Latest PyPi published version to rebuild latest docs for, e.g. v1.22.0" + default: "v1.22.0" + required: true + # workflow_run: + # workflows: ["Publish to PyPi"] + # types: + # - completed + +jobs: + build-layer: + runs-on: ubuntu-latest + if: ${{ (github.event.workflow_run.conclusion == 'success') || (github.event_name == 'workflow_dispatch') }} + defaults: + run: + working-directory: ./layer + steps: + - name: checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Install poetry + run: pipx install poetry + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "16.12" + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: "3.9" + cache: "pip" + - name: Resolve and install project dependencies + # CDK spawns system python when compiling stack + # therefore it ignores both activated virtual env and cached interpreter by GH + run: | + poetry export --format requirements.txt --output requirements.txt + pip install -r requirements.txt + - name: Set release notes tag + run: | + RELEASE_INPUT=${{ inputs.latest_published_version }} + LATEST_TAG=$(git describe --tag --abbrev=0) + RELEASE_TAG_VERSION=${RELEASE_INPUT:-$LATEST_TAG} + echo RELEASE_TAG_VERSION="${RELEASE_TAG_VERSION:1}" >> "$GITHUB_ENV" + - name: install cdk and deps + run: | + npm install -g aws-cdk@2.29.0 + cdk --version + - name: CDK build + run: cdk synth --context version="$RELEASE_TAG_VERSION" -o cdk.out + - name: zip output + run: zip -r cdk.out.zip cdk.out + - name: Archive CDK artifacts + uses: actions/upload-artifact@v3 + with: + name: cdk-layer-artefact + path: layer/cdk.out.zip + + deploy-beta: + needs: + - build-layer + uses: ./.github/workflows/reusable_deploy_v2_layer_stack.yml + secrets: inherit + with: + stage: "BETA" + artefact-name: "cdk-layer-artefact" + environment: "layer-beta" + + # deploy-prod: + # needs: + # - deploy-beta + # uses: ./.github/workflows/reusable_deploy_layer_stack.yml + # secrets: inherit + # with: + # stage: "PROD" + # artefact-name: "cdk-layer-artefact" + # environment: "layer-prod" diff --git a/.github/workflows/reusable_deploy_v2_layer_stack.yml b/.github/workflows/reusable_deploy_v2_layer_stack.yml new file mode 100644 index 00000000000..fe02b868e72 --- /dev/null +++ b/.github/workflows/reusable_deploy_v2_layer_stack.yml @@ -0,0 +1,99 @@ +name: Deploy CDK Layer v2 stack + +permissions: + id-token: write + contents: read + +on: + workflow_call: + inputs: + stage: + description: "Deployment stage (BETA, PROD)" + required: true + type: string + artefact-name: + description: "CDK Layer Artefact name to download" + required: true + type: string + environment: + description: "GitHub Environment to use for encrypted secrets" + required: true + type: string + +jobs: + deploy-cdk-stack: + runs-on: ubuntu-latest + environment: ${{ inputs.environment }} + defaults: + run: + working-directory: ./layer + strategy: + fail-fast: false + matrix: + region: + [ + "af-south-1", + "eu-central-1", + "us-east-1", + "us-east-2", + "us-west-1", + "us-west-2", + "ap-east-1", + "ap-south-1", + "ap-northeast-1", + "ap-northeast-2", + "ap-southeast-1", + "ap-southeast-2", + "ca-central-1", + "eu-west-1", + "eu-west-2", + "eu-west-3", + "eu-south-1", + "eu-north-1", + "sa-east-1", + "ap-southeast-3", + "ap-northeast-3", + "me-south-1", + ] + steps: + - name: checkout + uses: actions/checkout@v3 + - name: Install poetry + run: pipx install poetry + - name: aws credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-region: ${{ matrix.region }} + role-to-assume: ${{ secrets.AWS_LAYERS_ROLE_ARN }} + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "16.12" + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: "3.9" + cache: "pip" + - name: Resolve and install project dependencies + # CDK spawns system python when compiling stack + # therefore it ignores both activated virtual env and cached interpreter by GH + run: | + poetry export --format requirements.txt --output requirements.txt + pip install -r requirements.txt + - name: install cdk and deps + run: | + npm install -g aws-cdk@2.29.0 + cdk --version + - name: install deps + run: poetry install + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.artefact-name }} + path: layer + - name: unzip artefact + run: unzip cdk.out.zip + - name: CDK Deploy Layer + run: cdk deploy --app cdk.out --context region=${{ matrix.region }} 'LayerStack' --require-approval never --verbose + - name: CDK Deploy Canary + run: cdk deploy --app cdk.out --context region=${{ matrix.region}} --parameters DeployStage="${{ inputs.stage }}" 'CanaryStack' --require-approval never --verbose From b850cf1e39b54f3784e70c80ae07a2b66049981d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Thu, 29 Sep 2022 13:46:49 +0200 Subject: [PATCH 02/36] chore(layer): rename workflow --- .github/workflows/{publish_v2_layer.yaml => publish_v2_layer.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{publish_v2_layer.yaml => publish_v2_layer.yml} (100%) diff --git a/.github/workflows/publish_v2_layer.yaml b/.github/workflows/publish_v2_layer.yml similarity index 100% rename from .github/workflows/publish_v2_layer.yaml rename to .github/workflows/publish_v2_layer.yml From 3294d888497d6f3f2bd9cc4747efabcaeef5fcd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Fri, 30 Sep 2022 11:26:57 +0200 Subject: [PATCH 03/36] chore(deps): moved extra dependencies into an extra poetry group --- Makefile | 4 +-- poetry.lock | 88 +++++++++++++++++++++++++------------------------- pyproject.toml | 6 ++-- 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/Makefile b/Makefile index 7a212738c53..e3f94f12ebd 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,12 @@ target: dev: pip install --upgrade pip pre-commit poetry - poetry install --extras "pydantic" + poetry install --extras "extras" pre-commit install dev-gitpod: pip install --upgrade pip poetry - poetry install --extras "pydantic" + poetry install --extras "extras" pre-commit install format: diff --git a/poetry.lock b/poetry.lock index dce35f097e6..0ce0dccd8a6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -7,10 +7,10 @@ optional = false python-versions = ">=3.5" [package.extras] -dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"] -docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] -tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "cloudpickle"] -tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "cloudpickle"] +dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy (>=0.900,!=0.940)", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "sphinx", "sphinx-notfound-page", "zope.interface"] +docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"] +tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "zope.interface"] +tests_no_zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins"] [[package]] name = "aws-cdk-lib" @@ -62,7 +62,7 @@ name = "aws-xray-sdk" version = "2.10.0" description = "The AWS X-Ray SDK for Python (the SDK) enables Python developers to record and emit information from within their applications to the AWS X-Ray service." category = "main" -optional = false +optional = true python-versions = "*" [package.dependencies] @@ -84,7 +84,7 @@ PyYAML = ">=5.3.1" stevedore = ">=1.20.0" [package.extras] -test = ["coverage (>=4.5.4)", "fixtures (>=3.0.0)", "flake8 (>=4.0.0)", "stestr (>=2.5.0)", "testscenarios (>=0.5.0)", "testtools (>=2.3.0)", "toml", "beautifulsoup4 (>=4.8.0)", "pylint (==1.9.4)"] +test = ["beautifulsoup4 (>=4.8.0)", "coverage (>=4.5.4)", "fixtures (>=3.0.0)", "flake8 (>=4.0.0)", "pylint (==1.9.4)", "stestr (>=2.5.0)", "testscenarios (>=0.5.0)", "testtools (>=2.3.0)", "toml"] toml = ["toml"] yaml = ["pyyaml"] @@ -113,14 +113,14 @@ uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "boto3" -version = "1.24.85" +version = "1.24.86" description = "The AWS SDK for Python" -category = "main" +category = "dev" optional = false python-versions = ">= 3.7" [package.dependencies] -botocore = ">=1.27.85,<1.28.0" +botocore = ">=1.27.86,<1.28.0" jmespath = ">=0.7.1,<2.0.0" s3transfer = ">=0.6.0,<0.7.0" @@ -129,7 +129,7 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.27.85" +version = "1.27.86" description = "Low-level, data-driven core of boto 3." category = "main" optional = false @@ -205,7 +205,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "constructs" -version = "10.1.121" +version = "10.1.122" description = "A programming model for software-defined state" category = "dev" optional = false @@ -247,8 +247,8 @@ optional = true python-versions = ">=3.6,<4.0" [package.extras] -dnssec = ["cryptography (>=2.6,<37.0)"] curio = ["curio (>=1.2,<2.0)", "sniffio (>=1.1,<2.0)"] +dnssec = ["cryptography (>=2.6,<37.0)"] doh = ["h2 (>=4.1.0)", "httpx (>=0.21.1)", "requests (>=2.23.0,<3.0.0)", "requests-toolbelt (>=0.9.1,<0.10.0)"] idna = ["idna (>=2.1,<4.0)"] trio = ["trio (>=0.14,<0.20)"] @@ -305,7 +305,7 @@ optional = false python-versions = "*" [package.extras] -devel = ["colorama", "jsonschema", "json-spec", "pylint", "pytest", "pytest-benchmark", "pytest-cache", "validictory"] +devel = ["colorama", "json-spec", "jsonschema", "pylint", "pytest", "pytest-benchmark", "pytest-cache", "validictory"] [[package]] name = "filelock" @@ -464,7 +464,7 @@ python-versions = "*" python-dateutil = ">=2.8.1" [package.extras] -dev = ["wheel", "flake8", "markdown", "twine"] +dev = ["flake8", "markdown", "twine", "wheel"] [[package]] name = "gitdb" @@ -510,9 +510,9 @@ typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} zipp = ">=0.5" [package.extras] -docs = ["sphinx (>=3.5)", "jaraco.packaging (>=9)", "rst.linker (>=1.9)", "furo", "jaraco.tidelift (>=1.4)"] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)"] perf = ["ipython"] -testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "flake8 (<5)", "pytest-cov", "pytest-enabler (>=1.3)", "packaging", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)", "importlib-resources (>=1.3)"] +testing = ["flake8 (<5)", "flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)"] [[package]] name = "iniconfig" @@ -531,10 +531,10 @@ optional = false python-versions = ">=3.6.1,<4.0" [package.extras] -pipfile_deprecated_finder = ["pipreqs", "requirementslib"] -requirements_deprecated_finder = ["pipreqs", "pip-api"] colors = ["colorama (>=0.4.3,<0.5.0)"] +pipfile_deprecated_finder = ["pipreqs", "requirementslib"] plugins = ["setuptools"] +requirements_deprecated_finder = ["pip-api", "pipreqs"] [[package]] name = "jinja2" @@ -617,7 +617,7 @@ python-versions = ">=3.6" importlib-metadata = {version = ">=4.4", markers = "python_version < \"3.10\""} [package.extras] -testing = ["pyyaml", "coverage"] +testing = ["coverage", "pyyaml"] [[package]] name = "markupsafe" @@ -658,8 +658,8 @@ pyyaml = ">=5.1" verspec = "*" [package.extras] -test = ["shtab", "flake8 (>=3.0)", "coverage"] -dev = ["shtab", "flake8 (>=3.0)", "coverage"] +dev = ["coverage", "flake8 (>=3.0)", "shtab"] +test = ["coverage", "flake8 (>=3.0)", "shtab"] [[package]] name = "mkdocs" @@ -908,8 +908,8 @@ optional = false python-versions = ">=3.7" [package.extras] -docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx-autodoc-typehints (>=1.12)", "sphinx (>=4)"] -test = ["appdirs (==1.4.4)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)", "pytest (>=6)"] +docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx (>=4)", "sphinx-autodoc-typehints (>=1.12)"] +test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)"] [[package]] name = "pluggy" @@ -923,8 +923,8 @@ python-versions = ">=3.6" importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} [package.extras] -testing = ["pytest-benchmark", "pytest"] -dev = ["tox", "pre-commit"] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] [[package]] name = "publication" @@ -1012,7 +1012,7 @@ optional = false python-versions = ">=3.6.8" [package.extras] -diagrams = ["railroad-diagrams", "jinja2"] +diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pytest" @@ -1079,7 +1079,7 @@ coverage = {version = ">=5.2.1", extras = ["toml"]} pytest = ">=4.6" [package.extras] -testing = ["virtualenv", "pytest-xdist", "six", "process-tests", "hunter", "fields"] +testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] [[package]] name = "pytest-forked" @@ -1105,7 +1105,7 @@ python-versions = ">=3.7" pytest = ">=5.0" [package.extras] -dev = ["pre-commit", "tox", "pytest-asyncio"] +dev = ["pre-commit", "pytest-asyncio", "tox"] [[package]] name = "pytest-xdist" @@ -1210,7 +1210,7 @@ py = ">=1.4.26,<2.0.0" name = "s3transfer" version = "0.6.0" description = "An Amazon S3 Transfer Manager" -category = "main" +category = "dev" optional = false python-versions = ">= 3.7" @@ -1273,8 +1273,8 @@ optional = false python-versions = ">=3.5.3" [package.extras] -test = ["mypy", "typing-extensions", "pytest"] doc = ["sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] +test = ["mypy", "pytest", "typing-extensions"] [[package]] name = "types-requests" @@ -1312,8 +1312,8 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4" [package.extras] -brotli = ["brotlicffi (>=0.8.0)", "brotli (>=1.0.9)", "brotlipy (>=0.6.0)"] -secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "urllib3-secure-extra", "ipaddress"] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] +secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [[package]] @@ -1325,7 +1325,7 @@ optional = false python-versions = "*" [package.extras] -test = ["pytest", "pretend", "mypy", "flake8 (>=3.7)", "coverage"] +test = ["coverage", "flake8 (>=3.7)", "mypy", "pretend", "pytest"] [[package]] name = "watchdog" @@ -1343,7 +1343,7 @@ name = "wrapt" version = "1.14.1" description = "Module for decorators, wrappers and monkey patching." category = "main" -optional = false +optional = true python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" [[package]] @@ -1368,16 +1368,16 @@ optional = false python-versions = ">=3.7" [package.extras] -docs = ["sphinx", "jaraco.packaging (>=9)", "rst.linker (>=1.9)", "jaraco.tidelift (>=1.4)"] -testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.3)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)"] +docs = ["jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx"] +testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] [extras] -pydantic = ["pydantic", "email-validator"] +extras = ["pydantic", "email-validator", "aws-xray-sdk"] [metadata] lock-version = "1.1" python-versions = "^3.7.4" -content-hash = "8e6f77254a423026d119eab852c8774f47dab8b656d6e2e1aa25533ae9479fd1" +content-hash = "577e2f184b040ccf49d3ffaf827eab506176dbfb5764d6abc4d0cfc9c1db7e84" [metadata.files] attrs = [ @@ -1427,12 +1427,12 @@ black = [ {file = "black-22.8.0.tar.gz", hash = "sha256:792f7eb540ba9a17e8656538701d3eb1afcb134e3b45b71f20b25c77a8db7e6e"}, ] boto3 = [ - {file = "boto3-1.24.85-py3-none-any.whl", hash = "sha256:714b06755bd76b2001f7099a8e406604c0a0e76a8ff0425480bf1555bcbecee1"}, - {file = "boto3-1.24.85.tar.gz", hash = "sha256:2c9004c1f0a47807c73247abe8cb2b8a7054c34b9cf6e90f448d51560de20ca1"}, + {file = "boto3-1.24.86-py3-none-any.whl", hash = "sha256:c1d4e5d73d7720402c6538965efd6df5807492db8a71f30221dc11355d06db05"}, + {file = "boto3-1.24.86.tar.gz", hash = "sha256:59e9c39c867b5fd0575a50d8fafdf72c823c5510254a8615dff24f1584408121"}, ] botocore = [ - {file = "botocore-1.27.85-py3-none-any.whl", hash = "sha256:06b3ebacbe9a532074db4ad68040235e3c7bd52741e3ff6710cef8ab144ecdfe"}, - {file = "botocore-1.27.85.tar.gz", hash = "sha256:2b4c86178b5a5a2baa0a065aaf9ef9d33a7ac67bf3f30e39005de151b0408cac"}, + {file = "botocore-1.27.86-py3-none-any.whl", hash = "sha256:830359c8bf22f2a386431825060ff9666519c032f2ccd4a69f1a702f7195f6c0"}, + {file = "botocore-1.27.86.tar.gz", hash = "sha256:dcfe1825b84d17cf11653f8bb4bc77c2f172dcec1dc68eee932d68e5e6ed89d5"}, ] cattrs = [] certifi = [ @@ -1453,8 +1453,8 @@ click = [ ] colorama = [] constructs = [ - {file = "constructs-10.1.121-py3-none-any.whl", hash = "sha256:16758d45bc4b44ad880405d3b74738a1437fb2748659e95bd0f80358b42bc466"}, - {file = "constructs-10.1.121.tar.gz", hash = "sha256:63641b80db2435a7f5d4fa33af077703e8e1114c89210a1fa4d10c1cc7b9a6e6"}, + {file = "constructs-10.1.122-py3-none-any.whl", hash = "sha256:2c1c120d737c2c728c2960bc042d5a22da36b2ad38d42885f8f1e4b8cc573524"}, + {file = "constructs-10.1.122.tar.gz", hash = "sha256:220ce3b4dbc30401e54e22c0779cfab8d740ac176326609f5391101133432583"}, ] coverage = [ {file = "coverage-6.5.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ef8674b0ee8cc11e2d574e3e2998aea5df5ab242e012286824ea3c6970580e53"}, diff --git a/pyproject.toml b/pyproject.toml index 411e36d0d6a..a08bc84954b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,9 +20,8 @@ license = "MIT-0" [tool.poetry.dependencies] python = "^3.7.4" -aws-xray-sdk = "^2.8.0" +aws-xray-sdk = { version = "^2.8.0", optional = true } fastjsonschema = "^2.14.5" -boto3 = "^1.18" pydantic = {version = "^1.8.2", optional = true } email-validator = {version = "*", optional = true } @@ -32,6 +31,7 @@ email-validator = {version = "*", optional = true } coverage = {extras = ["toml"], version = "^6.2"} pytest = "^7.0.1" black = "^22.8" +boto3 = "^1.18" flake8-builtins = "^1.5.3" flake8-comprehensions = "^3.7.0" flake8-debugger = "^4.0.0" @@ -77,7 +77,7 @@ checksumdir = "^1.2.0" importlib-metadata = "^4.13" [tool.poetry.extras] -pydantic = ["pydantic", "email-validator"] +extras = ["pydantic", "email-validator", "aws-xray-sdk"] [tool.coverage.run] source = ["aws_lambda_powertools"] From 57be7ee5246c36c06986610161e7eec2d568bb37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Fri, 30 Sep 2022 12:01:51 +0200 Subject: [PATCH 04/36] feat(layers): add regular and arm64 flavours --- layer/app.py | 5 ++- layer/layer/canary/app.py | 6 ++- layer/layer/canary_stack.py | 83 ++++++++++++++++++++++++++++++------- layer/layer/layer_stack.py | 51 +++++++++++++++++++++-- layer/pyproject.toml | 6 +-- 5 files changed, 128 insertions(+), 23 deletions(-) diff --git a/layer/app.py b/layer/app.py index 50f8090482e..659d217d9fb 100644 --- a/layer/app.py +++ b/layer/app.py @@ -8,7 +8,8 @@ app = cdk.App() POWERTOOLS_VERSION: str = app.node.try_get_context("version") -SSM_PARAM_LAYER_ARN: str = "/layers/powertools-layer-arn" +SSM_PARAM_LAYER_ARN: str = "/layers/powertools-layer-v2-arn" +SSM_PARAM_ARM64_LAYER_ARN: str = "/layers/powertools-layer-v2-arm64-arn" if not POWERTOOLS_VERSION: raise ValueError( @@ -21,6 +22,7 @@ "LayerStack", powertools_version=POWERTOOLS_VERSION, ssm_paramter_layer_arn=SSM_PARAM_LAYER_ARN, + ssm_parameter_arm64_layer_arn=SSM_PARAM_ARM64_LAYER_ARN, ) CanaryStack( @@ -28,6 +30,7 @@ "CanaryStack", powertools_version=POWERTOOLS_VERSION, ssm_paramter_layer_arn=SSM_PARAM_LAYER_ARN, + ssm_parameter_arm64_layer_arn=SSM_PARAM_ARM64_LAYER_ARN, ) app.synth() diff --git a/layer/layer/canary/app.py b/layer/layer/canary/app.py index 1011fc654c2..684df36d8c5 100644 --- a/layer/layer/canary/app.py +++ b/layer/layer/canary/app.py @@ -1,6 +1,7 @@ import datetime import json import os +import platform from importlib.metadata import version import boto3 @@ -66,7 +67,7 @@ def verify_powertools_version() -> None: current_version = version("aws_lambda_powertools") if powertools_version != current_version: raise ValueError( - f'Expected powertoosl version is "{powertools_version}", but layer contains version "{current_version}"' + f'Expected powertools version is "{powertools_version}", but layer contains version "{current_version}"' ) logger.info(f"Current Powertools version is: {current_version}") @@ -80,6 +81,8 @@ def send_notification(): "Not sending notification to event bus, because this is not the PROD stage" ) return + + architecture = platform.uname()[4] event = { "Time": datetime.datetime.now(), "Source": "powertools.layer.canary", @@ -90,6 +93,7 @@ def send_notification(): "version": powertools_version, "region": os.environ["AWS_REGION"], "layerArn": layer_arn, + "architecture": architecture, } ), } diff --git a/layer/layer/canary_stack.py b/layer/layer/canary_stack.py index 426b3a4c87c..42a794cf2b9 100644 --- a/layer/layer/canary_stack.py +++ b/layer/layer/canary_stack.py @@ -2,12 +2,16 @@ from aws_cdk import CfnParameter, CustomResource, Duration, Stack from aws_cdk.aws_iam import Effect, ManagedPolicy, PolicyStatement, Role, ServicePrincipal -from aws_cdk.aws_lambda import Code, Function, LayerVersion, Runtime +from aws_cdk.aws_lambda import Architecture, Code, Function, LayerVersion, Runtime from aws_cdk.aws_logs import RetentionDays from aws_cdk.aws_ssm import StringParameter from aws_cdk.custom_resources import Provider from constructs import Construct +VERSION_TRACKING_EVENT_BUS_ARN: str = ( + "arn:aws:events:eu-central-1:027876851704:event-bus/VersionTrackingEventBus" +) + class CanaryStack(Stack): def __init__( @@ -16,29 +20,70 @@ def __init__( construct_id: str, powertools_version: str, ssm_paramter_layer_arn: str, + ssm_parameter_arm64_layer_arn: str, **kwargs, ) -> None: super().__init__(scope, construct_id, **kwargs) - VERSION_TRACKING_EVENT_BUS_ARN: str = ( - "arn:aws:events:eu-central-1:027876851704:event-bus/VersionTrackingEventBus" - ) - layer_arn = StringParameter.from_string_parameter_attributes( self, "LayerVersionArnParam", parameter_name=ssm_paramter_layer_arn ).string_value + Canary( + self, + "Canary-x86-64", + layer_arn=layer_arn, + powertools_version=powertools_version, + architecture=Architecture.X86_64(), + ) - layer = LayerVersion.from_layer_version_arn(self, "PowertoolsLayer", layer_version_arn=layer_arn) - deploy_stage = CfnParameter(self, "DeployStage", description="Deployment stage for canary").value_as_string + layer_arm64_arn = StringParameter.from_string_parameter_attributes( + self, + "LayerArm64VersionArnParam", + parameter_name=ssm_parameter_arm64_layer_arn, + ).string_value + Canary( + self, + "Canary-arm64", + layer_arn=layer_arm64_arn, + powertools_version=powertools_version, + architecture=Architecture.ARM_64(), + ) - execution_role = Role(self, "LambdaExecutionRole", assumed_by=ServicePrincipal("lambda.amazonaws.com")) + +class Canary(Construct): + def __init__( + self, + scope: Construct, + construct_id: str, + layer_arn: str, + powertools_version: str, + architecture: Architecture, + ): + super().__init__(scope, construct_id) + + layer = LayerVersion.from_layer_version_arn( + self, "PowertoolsLayer", layer_version_arn=layer_arn + ) + deploy_stage = CfnParameter( + self, "DeployStage", description="Deployment stage for canary" + ).value_as_string + + execution_role = Role( + self, + "LambdaExecutionRole", + assumed_by=ServicePrincipal("lambda.amazonaws.com"), + ) execution_role.add_managed_policy( - ManagedPolicy.from_aws_managed_policy_name("service-role/AWSLambdaBasicExecutionRole") + ManagedPolicy.from_aws_managed_policy_name( + "service-role/AWSLambdaBasicExecutionRole" + ) ) execution_role.add_to_policy( - PolicyStatement(effect=Effect.ALLOW, actions=["lambda:GetFunction"], resources=["*"]) + PolicyStatement( + effect=Effect.ALLOW, actions=["lambda:GetFunction"], resources=["*"] + ) ) canary_lambda = Function( @@ -49,7 +94,8 @@ def __init__( layers=[layer], memory_size=512, timeout=Duration.seconds(10), - runtime=Runtime.PYTHON_3_9, + runtime=Runtime.PYTHON_3_9(), + architecture=architecture, log_retention=RetentionDays.ONE_MONTH, role=execution_role, environment={ @@ -62,13 +108,22 @@ def __init__( canary_lambda.add_to_role_policy( PolicyStatement( - effect=Effect.ALLOW, actions=["events:PutEvents"], resources=[VERSION_TRACKING_EVENT_BUS_ARN] + effect=Effect.ALLOW, + actions=["events:PutEvents"], + resources=[VERSION_TRACKING_EVENT_BUS_ARN], ) ) # custom resource provider configuration provider = Provider( - self, "CanaryCustomResource", on_event_handler=canary_lambda, log_retention=RetentionDays.ONE_MONTH + self, + "CanaryCustomResource", + on_event_handler=canary_lambda, + log_retention=RetentionDays.ONE_MONTH, ) # force to recreate resource on each deployment with randomized name - CustomResource(self, f"CanaryTrigger-{str(uuid.uuid4())[0:7]}", service_token=provider.service_token) + CustomResource( + self, + f"CanaryTrigger-{str(uuid.uuid4())[0:7]}", + service_token=provider.service_token, + ) diff --git a/layer/layer/layer_stack.py b/layer/layer/layer_stack.py index f15232eb560..54445722588 100644 --- a/layer/layer/layer_stack.py +++ b/layer/layer/layer_stack.py @@ -1,5 +1,5 @@ from aws_cdk import CfnOutput, RemovalPolicy, Stack -from aws_cdk.aws_lambda import CfnLayerVersionPermission +from aws_cdk.aws_lambda import Architecture, CfnLayerVersionPermission from aws_cdk.aws_ssm import StringParameter from cdk_lambda_powertools_python_layer import LambdaPowertoolsLayer from constructs import Construct @@ -7,12 +7,32 @@ class LayerStack(Stack): def __init__( - self, scope: Construct, construct_id: str, powertools_version: str, ssm_paramter_layer_arn: str, **kwargs + self, + scope: Construct, + construct_id: str, + powertools_version: str, + ssm_paramter_layer_arn: str, + ssm_parameter_arm64_layer_arn: str, + **kwargs ) -> None: super().__init__(scope, construct_id, **kwargs) layer = LambdaPowertoolsLayer( - self, "Layer", layer_version_name="AWSLambdaPowertoolsPython", version=powertools_version + self, + "Layer", + layer_version_name="AWSLambdaPowertoolsPythonV2", + version=powertools_version, + include_extras=True, + compatible_architectures=[Architecture.X86_64()], + ) + + layer_arm64 = LambdaPowertoolsLayer( + self, + "Layer-ARM64", + layer_version_name="AWSLambdaPowertoolsPythonV2-Arm64", + version=powertools_version, + include_extras=True, + compatible_architectures=[Architecture.ARM_64()], ) layer_permission = CfnLayerVersionPermission( @@ -23,9 +43,32 @@ def __init__( principal="*", ) + layer_permission_arm64 = CfnLayerVersionPermission( + self, + "PublicLayerAccessArm64", + action="lambda:GetLayerVersion", + layer_version_arn=layer_arm64.layer_version_arn, + principal="*", + ) + layer_permission.apply_removal_policy(RemovalPolicy.RETAIN) + layer_permission_arm64.apply_removal_policy(RemovalPolicy.RETAIN) + layer.apply_removal_policy(RemovalPolicy.RETAIN) + layer_arm64.apply_removal_policy(RemovalPolicy.RETAIN) - StringParameter(self, "VersionArn", parameter_name=ssm_paramter_layer_arn, string_value=layer.layer_version_arn) + StringParameter( + self, + "VersionArn", + parameter_name=ssm_paramter_layer_arn, + string_value=layer.layer_version_arn, + ) + StringParameter( + self, + "Arm64VersionArn", + parameter_name=ssm_parameter_arm64_layer_arn, + string_value=layer_arm64.layer_version_arn, + ) CfnOutput(self, "LatestLayerArn", value=layer.layer_version_arn) + CfnOutput(self, "LatestArm64LayerArn", value=layer_arm64.layer_version_arn) diff --git a/layer/pyproject.toml b/layer/pyproject.toml index 7f219453a72..00ee6842f90 100644 --- a/layer/pyproject.toml +++ b/layer/pyproject.toml @@ -1,14 +1,14 @@ [tool.poetry] name = "aws-lambda-powertools-python-layer" -version = "0.1.0" +version = "1.1.0" description = "AWS Lambda Powertools for Python Lambda Layers" authors = ["DevAx "] license = "MIT" [tool.poetry.dependencies] python = "^3.9" -cdk-lambda-powertools-python-layer = "^2.0.49" -aws-cdk-lib = "^2.35.0" +cdk-lambda-powertools-python-layer = "^3.0.0" +aws-cdk-lib = "^2.42.0" [tool.poetry.dev-dependencies] pytest = "^7.1.2" From c141cdc2d9843caf3b702731ce29c8db2634137a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Fri, 30 Sep 2022 12:06:49 +0200 Subject: [PATCH 05/36] chore(deps): move fastjsonschema to optinal dependency group --- poetry.lock | 6 +++--- pyproject.toml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/poetry.lock b/poetry.lock index 0ce0dccd8a6..85e20532dd4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -301,7 +301,7 @@ name = "fastjsonschema" version = "2.16.2" description = "Fastest Python implementation of JSON schema" category = "main" -optional = false +optional = true python-versions = "*" [package.extras] @@ -1372,12 +1372,12 @@ docs = ["jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9) testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] [extras] -extras = ["pydantic", "email-validator", "aws-xray-sdk"] +extras = ["pydantic", "email-validator", "aws-xray-sdk", "fastjsonschema"] [metadata] lock-version = "1.1" python-versions = "^3.7.4" -content-hash = "577e2f184b040ccf49d3ffaf827eab506176dbfb5764d6abc4d0cfc9c1db7e84" +content-hash = "8fdc06d5f06e06cbfc1c96afa052e380878d0caa6b34174e3fc9584e074ca32b" [metadata.files] attrs = [ diff --git a/pyproject.toml b/pyproject.toml index a08bc84954b..78b892a3a14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ license = "MIT-0" [tool.poetry.dependencies] python = "^3.7.4" aws-xray-sdk = { version = "^2.8.0", optional = true } -fastjsonschema = "^2.14.5" +fastjsonschema = { version = "^2.14.5", optional = true } pydantic = {version = "^1.8.2", optional = true } email-validator = {version = "*", optional = true } @@ -77,7 +77,7 @@ checksumdir = "^1.2.0" importlib-metadata = "^4.13" [tool.poetry.extras] -extras = ["pydantic", "email-validator", "aws-xray-sdk"] +extras = ["pydantic", "email-validator", "aws-xray-sdk", "fastjsonschema"] [tool.coverage.run] source = ["aws_lambda_powertools"] From 0ba4d381d7d8f632eb470ee7ce54244abf565df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Fri, 30 Sep 2022 12:26:38 +0200 Subject: [PATCH 06/36] feat(layers): use qmeu for arm64 builds --- .github/workflows/publish_v2_layer.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish_v2_layer.yml b/.github/workflows/publish_v2_layer.yml index 4645c1a0a10..51aaf141405 100644 --- a/.github/workflows/publish_v2_layer.yml +++ b/.github/workflows/publish_v2_layer.yml @@ -51,9 +51,14 @@ jobs: LATEST_TAG=$(git describe --tag --abbrev=0) RELEASE_TAG_VERSION=${RELEASE_INPUT:-$LATEST_TAG} echo RELEASE_TAG_VERSION="${RELEASE_TAG_VERSION:1}" >> "$GITHUB_ENV" + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + id: builder + uses: docker/setup-buildx-action@v2 - name: install cdk and deps run: | - npm install -g aws-cdk@2.29.0 + npm install -g aws-cdk@2.44.0 cdk --version - name: CDK build run: cdk synth --context version="$RELEASE_TAG_VERSION" -o cdk.out From 55e7e2d6a11bc129fef6aa22da618d13fc8ce21d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Fri, 30 Sep 2022 12:29:49 +0200 Subject: [PATCH 07/36] fix(layers): pinned github actions --- .github/workflows/publish_v2_layer.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish_v2_layer.yml b/.github/workflows/publish_v2_layer.yml index 51aaf141405..d55fd1c9425 100644 --- a/.github/workflows/publish_v2_layer.yml +++ b/.github/workflows/publish_v2_layer.yml @@ -52,10 +52,10 @@ jobs: RELEASE_TAG_VERSION=${RELEASE_INPUT:-$LATEST_TAG} echo RELEASE_TAG_VERSION="${RELEASE_TAG_VERSION:1}" >> "$GITHUB_ENV" - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 # v2.0.0 - name: Set up Docker Buildx id: builder - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # v2.0.0 - name: install cdk and deps run: | npm install -g aws-cdk@2.44.0 From ec4f5e66335d5e9c3d19ebfffd7695b8fc0df355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Mon, 3 Oct 2022 11:36:26 +0200 Subject: [PATCH 08/36] chore: create extra dependency groups per utility --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 78b892a3a14..6aa1953bf62 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,10 @@ checksumdir = "^1.2.0" importlib-metadata = "^4.13" [tool.poetry.extras] -extras = ["pydantic", "email-validator", "aws-xray-sdk", "fastjsonschema"] +parser = ["pydantic", "email-validator"] +validation = ["fastjsonschema"] +tracer = ["aws-xray-sdk"] +all = ["pydantic", "email-validator", "aws-xray-sdk", "fastjsonschema"] [tool.coverage.run] source = ["aws_lambda_powertools"] From 43bc98f729dba515acc1a70de0473a572a551ed3 Mon Sep 17 00:00:00 2001 From: Ruben Fonseca Date: Mon, 3 Oct 2022 21:00:14 +0200 Subject: [PATCH 09/36] chore: apply suggestions from code review Co-authored-by: Heitor Lessa --- .github/workflows/publish_v2_layer.yml | 2 +- Makefile | 4 ++-- layer/app.py | 6 +++--- layer/layer/canary/app.py | 2 +- layer/layer/canary_stack.py | 6 +++--- layer/layer/layer_stack.py | 6 +++--- pyproject.toml | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish_v2_layer.yml b/.github/workflows/publish_v2_layer.yml index d55fd1c9425..da5db45a0dc 100644 --- a/.github/workflows/publish_v2_layer.yml +++ b/.github/workflows/publish_v2_layer.yml @@ -9,7 +9,7 @@ on: inputs: latest_published_version: description: "Latest PyPi published version to rebuild latest docs for, e.g. v1.22.0" - default: "v1.22.0" + default: "v2.0.0" required: true # workflow_run: # workflows: ["Publish to PyPi"] diff --git a/Makefile b/Makefile index e3f94f12ebd..ba4c2943f84 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,12 @@ target: dev: pip install --upgrade pip pre-commit poetry - poetry install --extras "extras" + poetry install --extras "all" pre-commit install dev-gitpod: pip install --upgrade pip poetry - poetry install --extras "extras" + poetry install --extras "all" pre-commit install format: diff --git a/layer/app.py b/layer/app.py index 659d217d9fb..e44b05d453d 100644 --- a/layer/app.py +++ b/layer/app.py @@ -9,7 +9,7 @@ POWERTOOLS_VERSION: str = app.node.try_get_context("version") SSM_PARAM_LAYER_ARN: str = "/layers/powertools-layer-v2-arn" -SSM_PARAM_ARM64_LAYER_ARN: str = "/layers/powertools-layer-v2-arm64-arn" +SSM_PARAM_LAYER_ARM64_ARN: str = "/layers/powertools-layer-v2-arm64-arn" if not POWERTOOLS_VERSION: raise ValueError( @@ -22,7 +22,7 @@ "LayerStack", powertools_version=POWERTOOLS_VERSION, ssm_paramter_layer_arn=SSM_PARAM_LAYER_ARN, - ssm_parameter_arm64_layer_arn=SSM_PARAM_ARM64_LAYER_ARN, + ssm_parameter_layer_arm64_arn=SSM_PARAM_LAYER_ARM64_ARN, ) CanaryStack( @@ -30,7 +30,7 @@ "CanaryStack", powertools_version=POWERTOOLS_VERSION, ssm_paramter_layer_arn=SSM_PARAM_LAYER_ARN, - ssm_parameter_arm64_layer_arn=SSM_PARAM_ARM64_LAYER_ARN, + ssm_parameter_layer_arm64_arn=SSM_PARAM_LAYER_ARM64_ARN, ) app.synth() diff --git a/layer/layer/canary/app.py b/layer/layer/canary/app.py index 684df36d8c5..24f8bf2662f 100644 --- a/layer/layer/canary/app.py +++ b/layer/layer/canary/app.py @@ -67,7 +67,7 @@ def verify_powertools_version() -> None: 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 version is "{powertools_version}", but layer contains version "{current_version}"' ) logger.info(f"Current Powertools version is: {current_version}") diff --git a/layer/layer/canary_stack.py b/layer/layer/canary_stack.py index 42a794cf2b9..e519517a2e5 100644 --- a/layer/layer/canary_stack.py +++ b/layer/layer/canary_stack.py @@ -20,7 +20,7 @@ def __init__( construct_id: str, powertools_version: str, ssm_paramter_layer_arn: str, - ssm_parameter_arm64_layer_arn: str, + ssm_parameter_layer_arm64_arn: str, **kwargs, ) -> None: super().__init__(scope, construct_id, **kwargs) @@ -39,7 +39,7 @@ def __init__( layer_arm64_arn = StringParameter.from_string_parameter_attributes( self, "LayerArm64VersionArnParam", - parameter_name=ssm_parameter_arm64_layer_arn, + parameter_name=ssm_parameter_layer_arm64_arn, ).string_value Canary( self, @@ -94,7 +94,7 @@ def __init__( layers=[layer], memory_size=512, timeout=Duration.seconds(10), - runtime=Runtime.PYTHON_3_9(), + runtime=Runtime.PYTHON_3_9, architecture=architecture, log_retention=RetentionDays.ONE_MONTH, role=execution_role, diff --git a/layer/layer/layer_stack.py b/layer/layer/layer_stack.py index 54445722588..7856edb0eeb 100644 --- a/layer/layer/layer_stack.py +++ b/layer/layer/layer_stack.py @@ -12,7 +12,7 @@ def __init__( construct_id: str, powertools_version: str, ssm_paramter_layer_arn: str, - ssm_parameter_arm64_layer_arn: str, + ssm_parameter_layer_arm64_arn: str, **kwargs ) -> None: super().__init__(scope, construct_id, **kwargs) @@ -66,9 +66,9 @@ def __init__( StringParameter( self, "Arm64VersionArn", - parameter_name=ssm_parameter_arm64_layer_arn, + parameter_name=ssm_parameter_layer_arm64_arn, string_value=layer_arm64.layer_version_arn, ) CfnOutput(self, "LatestLayerArn", value=layer.layer_version_arn) - CfnOutput(self, "LatestArm64LayerArn", value=layer_arm64.layer_version_arn) + CfnOutput(self, "LatestLayerArm64Arn", value=layer_arm64.layer_version_arn) diff --git a/pyproject.toml b/pyproject.toml index 6aa1953bf62..f011b9d841d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,8 +77,8 @@ checksumdir = "^1.2.0" importlib-metadata = "^4.13" [tool.poetry.extras] -parser = ["pydantic", "email-validator"] -validation = ["fastjsonschema"] +parser = ["pydantic", "email-validator", "jmespath"] +validation = ["fastjsonschema", "jmespath"] tracer = ["aws-xray-sdk"] all = ["pydantic", "email-validator", "aws-xray-sdk", "fastjsonschema"] From 0d19a80be375b273741ea68c95f38206a06261f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Mon, 3 Oct 2022 21:00:52 +0200 Subject: [PATCH 10/36] chore: use latest cdk layer construct --- .../reusable_deploy_v2_layer_stack.yml | 5 +- layer/poetry.lock | 159 +++++++----------- layer/pyproject.toml | 4 +- 3 files changed, 68 insertions(+), 100 deletions(-) diff --git a/.github/workflows/reusable_deploy_v2_layer_stack.yml b/.github/workflows/reusable_deploy_v2_layer_stack.yml index fe02b868e72..8c4d45c7708 100644 --- a/.github/workflows/reusable_deploy_v2_layer_stack.yml +++ b/.github/workflows/reusable_deploy_v2_layer_stack.yml @@ -4,6 +4,9 @@ permissions: id-token: write contents: read +env: + CDK_VERSION: 2.44.0 + on: workflow_call: inputs: @@ -82,7 +85,7 @@ jobs: pip install -r requirements.txt - name: install cdk and deps run: | - npm install -g aws-cdk@2.29.0 + npm install -g "aws-cdk@$CDK_VERSION" cdk --version - name: install deps run: poetry install diff --git a/layer/poetry.lock b/layer/poetry.lock index 182094a8b9d..6cb1f863714 100644 --- a/layer/poetry.lock +++ b/layer/poetry.lock @@ -1,28 +1,20 @@ -[[package]] -name = "atomicwrites" -version = "1.4.1" -description = "Atomic file writes." -category = "dev" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" - [[package]] name = "attrs" -version = "21.4.0" +version = "22.1.0" description = "Classes Without Boilerplate" category = "main" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +python-versions = ">=3.5" [package.extras] -dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"] +dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"] docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] -tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "cloudpickle"] -tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "cloudpickle"] +tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "cloudpickle"] +tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "cloudpickle"] [[package]] name = "aws-cdk-lib" -version = "2.35.0" +version = "2.44.0" description = "Version 2 of the AWS Cloud Development Kit library" category = "main" optional = false @@ -30,20 +22,20 @@ python-versions = "~=3.7" [package.dependencies] constructs = ">=10.0.0,<11.0.0" -jsii = ">=1.63.2,<2.0.0" +jsii = ">=1.68.0,<2.0.0" publication = ">=0.0.3" typeguard = ">=2.13.3,<2.14.0" [[package]] name = "boto3" -version = "1.24.46" +version = "1.24.84" description = "The AWS SDK for Python" category = "dev" optional = false python-versions = ">= 3.7" [package.dependencies] -botocore = ">=1.27.46,<1.28.0" +botocore = ">=1.27.84,<1.28.0" jmespath = ">=0.7.1,<2.0.0" s3transfer = ">=0.6.0,<0.7.0" @@ -52,7 +44,7 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.27.46" +version = "1.27.84" description = "Low-level, data-driven core of boto 3." category = "dev" optional = false @@ -64,7 +56,7 @@ python-dateutil = ">=2.1,<3.0.0" urllib3 = ">=1.25.4,<1.27" [package.extras] -crt = ["awscrt (==0.13.8)"] +crt = ["awscrt (==0.14.0)"] [[package]] name = "cattrs" @@ -79,18 +71,19 @@ attrs = ">=20" exceptiongroup = {version = "*", markers = "python_version <= \"3.10\""} [[package]] -name = "cdk-lambda-powertools-python-layer" -version = "2.0.49" -description = "A lambda layer for AWS Powertools for python" +name = "cdk-aws-lambda-powertools-layer" +version = "3.0.0" +description = "A lambda layer for AWS Powertools for python and typescript" category = "main" optional = false python-versions = "~=3.7" [package.dependencies] -aws-cdk-lib = ">=2.2.0,<3.0.0" +aws-cdk-lib = ">=2.44.0,<3.0.0" constructs = ">=10.0.5,<11.0.0" -jsii = ">=1.61.0,<2.0.0" +jsii = ">=1.69.0,<2.0.0" publication = ">=0.0.3" +typeguard = ">=2.13.3,<2.14.0" [[package]] name = "colorama" @@ -102,20 +95,20 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "constructs" -version = "10.1.67" +version = "10.1.120" description = "A programming model for software-defined state" category = "main" optional = false python-versions = "~=3.7" [package.dependencies] -jsii = ">=1.63.2,<2.0.0" +jsii = ">=1.69.0,<2.0.0" publication = ">=0.0.3" typeguard = ">=2.13.3,<2.14.0" [[package]] name = "exceptiongroup" -version = "1.0.0rc8" +version = "1.0.0rc9" description = "Backport of PEP 654 (exception groups)" category = "main" optional = false @@ -142,14 +135,14 @@ python-versions = ">=3.7" [[package]] name = "jsii" -version = "1.63.2" +version = "1.69.0" description = "Python client for jsii runtime" category = "main" optional = false python-versions = "~=3.7" [package.dependencies] -attrs = ">=21.2,<22.0" +attrs = ">=21.2,<23.0" cattrs = ">=1.8,<22.2" publication = ">=0.0.3" python-dateutil = "*" @@ -176,8 +169,8 @@ optional = false python-versions = ">=3.6" [package.extras] -dev = ["pre-commit", "tox"] -testing = ["pytest", "pytest-benchmark"] +testing = ["pytest-benchmark", "pytest"] +dev = ["tox", "pre-commit"] [[package]] name = "publication" @@ -208,14 +201,13 @@ diagrams = ["railroad-diagrams", "jinja2"] [[package]] name = "pytest" -version = "7.1.2" +version = "7.1.3" description = "pytest: simple powerful testing with Python" category = "dev" optional = false python-versions = ">=3.7" [package.dependencies] -atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} attrs = ">=19.2.0" colorama = {version = "*", markers = "sys_platform == \"win32\""} iniconfig = "*" @@ -277,8 +269,8 @@ optional = false python-versions = ">=3.5.3" [package.extras] -doc = ["sphinx-rtd-theme", "sphinx-autodoc-typehints (>=1.2.0)"] -test = ["pytest", "typing-extensions", "mypy"] +test = ["mypy", "typing-extensions", "pytest"] +doc = ["sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] [[package]] name = "typing-extensions" @@ -290,7 +282,7 @@ python-versions = ">=3.7" [[package]] name = "urllib3" -version = "1.26.11" +version = "1.26.12" description = "HTTP library with thread-safe connection pooling, file post, and more." category = "dev" optional = false @@ -298,94 +290,64 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, [package.extras] brotli = ["brotlicffi (>=0.8.0)", "brotli (>=1.0.9)", "brotlipy (>=0.6.0)"] -secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] +secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "urllib3-secure-extra", "ipaddress"] socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "a68a9649808efb49529ace7d990559e6569be096bf2d86234f3bd056bae0fdc3" +content-hash = "58c6dea4f27ff2c98dad77255fb56184d918596e188d3cc83e4227d2e4d4a15d" [metadata.files] -atomicwrites = [ - {file = "atomicwrites-1.4.1.tar.gz", hash = "sha256:81b2c9071a49367a7f770170e5eec8cb66567cfbbc8c73d20ce5ca4a8d71cf11"}, -] attrs = [ - {file = "attrs-21.4.0-py2.py3-none-any.whl", hash = "sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4"}, - {file = "attrs-21.4.0.tar.gz", hash = "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"}, + {file = "attrs-22.1.0-py2.py3-none-any.whl", hash = "sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c"}, + {file = "attrs-22.1.0.tar.gz", hash = "sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6"}, ] aws-cdk-lib = [ - {file = "aws-cdk-lib-2.35.0.tar.gz", hash = "sha256:fc9cba4df0b60a9ab7f17ceb3b1c447d27e96cec9eb9e8c5b7ecfd1275878930"}, - {file = "aws_cdk_lib-2.35.0-py3-none-any.whl", hash = "sha256:ee481dca9335c32b5871e58ba697e27e2f1e92d9b81cf9341cfc6cc36127a2b0"}, + {file = "aws-cdk-lib-2.44.0.tar.gz", hash = "sha256:92eb87d6576a8be20bf8c359e25dbfd8c8890b53be54be57b71fbcdd16886eea"}, + {file = "aws_cdk_lib-2.44.0-py3-none-any.whl", hash = "sha256:f0de47d4a6e84391d2ec9f551e514c0f4f9be822d17695a305307f2f31751387"}, ] boto3 = [ - {file = "boto3-1.24.46-py3-none-any.whl", hash = "sha256:44026e44549148dbc5b261ead5f6b339e785680c350ef621bf85f7e2fca05b49"}, - {file = "boto3-1.24.46.tar.gz", hash = "sha256:b2d9d55f123a9a91eea2fd8e379d90abf37634420fbb45c22d67e10b324ec71b"}, + {file = "boto3-1.24.84-py3-none-any.whl", hash = "sha256:be151711bbb4db53e85dd5bbe506002ce6f2f21fc4e45fcf6d2cf356d32cc4c6"}, + {file = "boto3-1.24.84.tar.gz", hash = "sha256:6194763348545bb1669ce8d03ba104be1ba822daa184613aa10b9303a6a79017"}, ] botocore = [ - {file = "botocore-1.27.46-py3-none-any.whl", hash = "sha256:747b7e94aef41498f063fc0be79c5af102d940beea713965179e1ead89c7e9ec"}, - {file = "botocore-1.27.46.tar.gz", hash = "sha256:f66d8305d1f59d83334df9b11b6512bb1e14698ec4d5d6d42f833f39f3304ca7"}, -] -cattrs = [ - {file = "cattrs-22.1.0-py3-none-any.whl", hash = "sha256:d55c477b4672f93606e992049f15d526dc7867e6c756cd6256d4af92e2b1e364"}, - {file = "cattrs-22.1.0.tar.gz", hash = "sha256:94b67b64cf92c994f8784c40c082177dc916e0489a73a9a36b24eb18a9db40c6"}, + {file = "botocore-1.27.84-py3-none-any.whl", hash = "sha256:da15026329706caf83323d84996f5ff5c527837347633fca9b3b1be0efa60841"}, + {file = "botocore-1.27.84.tar.gz", hash = "sha256:11f05d2acdf9a5f722856704b7b951b180647fb4340e1b5048b27273dc323909"}, ] -cdk-lambda-powertools-python-layer = [ - {file = "cdk-lambda-powertools-python-layer-2.0.49.tar.gz", hash = "sha256:8055fc691539f16e22a40e3d3df9c3f59fb28012437b08c47c639aefb001f1b2"}, - {file = "cdk_lambda_powertools_python_layer-2.0.49-py3-none-any.whl", hash = "sha256:9b0a7b7344f9ccb486564af728cefeac743687bfb131631e6d9171a55800dbac"}, -] -colorama = [ - {file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"}, - {file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"}, +cattrs = [] +cdk-aws-lambda-powertools-layer = [ + {file = "cdk-aws-lambda-powertools-layer-3.0.0.tar.gz", hash = "sha256:f877a4fa5a3530b0fbe59b53b635929f06a2ee6f2848cdbb83bbc0eda9549a46"}, + {file = "cdk_aws_lambda_powertools_layer-3.0.0-py3-none-any.whl", hash = "sha256:7574a149a1fd152404c9ee0114d4f24232336aa1b3ab7e8217b51fa0c14a1c9e"}, ] +colorama = [] constructs = [ - {file = "constructs-10.1.67-py3-none-any.whl", hash = "sha256:d597d8d5387328c1e95fa674d5d64969b1c1a479e63544e53a067a5d95b5c46b"}, - {file = "constructs-10.1.67.tar.gz", hash = "sha256:8b9fdf5040dde63545c08b8cc86fcd019512e0d16ee599c82b1201a5806f0066"}, + {file = "constructs-10.1.120-py3-none-any.whl", hash = "sha256:2dce2910f7012dadcc61faba92e9376a17b1052b6366b6ec666d889f2ac4a6b4"}, + {file = "constructs-10.1.120.tar.gz", hash = "sha256:39ed9156ab9508419a22a2d798c3b5c58e8e5c1c156d4c9f27e40fd7e87ea7c0"}, ] exceptiongroup = [ - {file = "exceptiongroup-1.0.0rc8-py3-none-any.whl", hash = "sha256:ab0a968e1ef769e55d9a596f4a89f7be9ffedbc9fdefdb77cc68cf5c33ce1035"}, - {file = "exceptiongroup-1.0.0rc8.tar.gz", hash = "sha256:6990c24f06b8d33c8065cfe43e5e8a4bfa384e0358be036af9cc60b6321bd11a"}, -] -iniconfig = [ - {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, - {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, + {file = "exceptiongroup-1.0.0rc9-py3-none-any.whl", hash = "sha256:2e3c3fc1538a094aab74fad52d6c33fc94de3dfee3ee01f187c0e0c72aec5337"}, + {file = "exceptiongroup-1.0.0rc9.tar.gz", hash = "sha256:9086a4a21ef9b31c72181c77c040a074ba0889ee56a7b289ff0afb0d97655f96"}, ] +iniconfig = [] jmespath = [ {file = "jmespath-1.0.1-py3-none-any.whl", hash = "sha256:02e2e4cc71b5bcab88332eebf907519190dd9e6e82107fa7f83b1003a6252980"}, {file = "jmespath-1.0.1.tar.gz", hash = "sha256:90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe"}, ] jsii = [ - {file = "jsii-1.63.2-py3-none-any.whl", hash = "sha256:ae8cbc84c633382c317dc367e1441bb2afd8b74ed82b3557b8df15e05316b14d"}, - {file = "jsii-1.63.2.tar.gz", hash = "sha256:6f68dcd82395ccd12606b31383f611adfefd246082750350891a2a277562f34b"}, -] -packaging = [ - {file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"}, - {file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"}, -] -pluggy = [ - {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, - {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, -] -publication = [ - {file = "publication-0.0.3-py2.py3-none-any.whl", hash = "sha256:0248885351febc11d8a1098d5c8e3ab2dabcf3e8c0c96db1e17ecd12b53afbe6"}, - {file = "publication-0.0.3.tar.gz", hash = "sha256:68416a0de76dddcdd2930d1c8ef853a743cc96c82416c4e4d3b5d901c6276dc4"}, -] -py = [ - {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, - {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, -] -pyparsing = [ - {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"}, - {file = "pyparsing-3.0.9.tar.gz", hash = "sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"}, + {file = "jsii-1.69.0-py3-none-any.whl", hash = "sha256:f3ae5cdf5e854b4d59256dc1f8818cd3fabb8eb43fbd3134a8e8aef962643005"}, + {file = "jsii-1.69.0.tar.gz", hash = "sha256:7c7ed2a913372add17d63322a640c6435324770eb78c6b89e4c701e07d9c84db"}, ] +packaging = [] +pluggy = [] +publication = [] +py = [] +pyparsing = [] pytest = [ - {file = "pytest-7.1.2-py3-none-any.whl", hash = "sha256:13d0e3ccfc2b6e26be000cb6568c832ba67ba32e719443bfe725814d3c42433c"}, - {file = "pytest-7.1.2.tar.gz", hash = "sha256:a06a0425453864a270bc45e71f783330a7428defb4230fb5e6a731fde06ecd45"}, -] -python-dateutil = [ - {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, - {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, + {file = "pytest-7.1.3-py3-none-any.whl", hash = "sha256:1377bda3466d70b55e3f5cecfa55bb7cfcf219c7964629b967c37cf0bda818b7"}, + {file = "pytest-7.1.3.tar.gz", hash = "sha256:4f365fec2dff9c1162f834d9f18af1ba13062db0c708bf7b946f8a5c76180c39"}, ] +python-dateutil = [] s3transfer = [ {file = "s3transfer-0.6.0-py3-none-any.whl", hash = "sha256:06176b74f3a15f61f1b4f25a1fc29a4429040b7647133a463da8fa5bd28d5ecd"}, {file = "s3transfer-0.6.0.tar.gz", hash = "sha256:2ed07d3866f523cc561bf4a00fc5535827981b117dd7876f036b0c1aca42c947"}, @@ -406,4 +368,7 @@ typing-extensions = [ {file = "typing_extensions-4.3.0-py3-none-any.whl", hash = "sha256:25642c956049920a5aa49edcdd6ab1e06d7e5d467fc00e0506c44ac86fbfca02"}, {file = "typing_extensions-4.3.0.tar.gz", hash = "sha256:e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6"}, ] -urllib3 = [] +urllib3 = [ + {file = "urllib3-1.26.12-py2.py3-none-any.whl", hash = "sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997"}, + {file = "urllib3-1.26.12.tar.gz", hash = "sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e"}, +] diff --git a/layer/pyproject.toml b/layer/pyproject.toml index 00ee6842f90..551cfcd7ebe 100644 --- a/layer/pyproject.toml +++ b/layer/pyproject.toml @@ -7,8 +7,8 @@ license = "MIT" [tool.poetry.dependencies] python = "^3.9" -cdk-lambda-powertools-python-layer = "^3.0.0" -aws-cdk-lib = "^2.42.0" +cdk-aws-lambda-powertools-layer = "^3.0.0" +aws-cdk-lib = "^2.44.0" [tool.poetry.dev-dependencies] pytest = "^7.1.2" From 04f44b9e13d0ab4d87e46b8d4168fe8aa133512b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Mon, 3 Oct 2022 21:01:33 +0200 Subject: [PATCH 11/36] chore: add jmespath and idempotency deps groups --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index f011b9d841d..32cd564a249 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,6 +80,8 @@ importlib-metadata = "^4.13" parser = ["pydantic", "email-validator", "jmespath"] validation = ["fastjsonschema", "jmespath"] tracer = ["aws-xray-sdk"] +idempotency = ["jmespath"] +jmespath = ["jmespath"] all = ["pydantic", "email-validator", "aws-xray-sdk", "fastjsonschema"] [tool.coverage.run] From bef044e23aaa12f017ce7f03683b84dbd6dcb1cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Mon, 3 Oct 2022 21:03:38 +0200 Subject: [PATCH 12/36] chore: lock deps --- poetry.lock | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index 85e20532dd4..59948ce30b3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1372,12 +1372,17 @@ docs = ["jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9) testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] [extras] -extras = ["pydantic", "email-validator", "aws-xray-sdk", "fastjsonschema"] +all = ["pydantic", "email-validator", "aws-xray-sdk", "fastjsonschema"] +idempotency = [] +jmespath = [] +parser = ["pydantic", "email-validator"] +tracer = ["aws-xray-sdk"] +validation = ["fastjsonschema"] [metadata] lock-version = "1.1" python-versions = "^3.7.4" -content-hash = "8fdc06d5f06e06cbfc1c96afa052e380878d0caa6b34174e3fc9584e074ca32b" +content-hash = "fe678a326f7cdf45b21348f113698e3686fffd493a2f74434cbcb6750e51def4" [metadata.files] attrs = [ From 273be4c77eba56a847bbf1074cdf7de69ad53def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Mon, 3 Oct 2022 21:03:45 +0200 Subject: [PATCH 13/36] chore: use new cdk construct name --- layer/layer/layer_stack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layer/layer/layer_stack.py b/layer/layer/layer_stack.py index 7856edb0eeb..4beca85d503 100644 --- a/layer/layer/layer_stack.py +++ b/layer/layer/layer_stack.py @@ -1,7 +1,7 @@ from aws_cdk import CfnOutput, RemovalPolicy, Stack from aws_cdk.aws_lambda import Architecture, CfnLayerVersionPermission from aws_cdk.aws_ssm import StringParameter -from cdk_lambda_powertools_python_layer import LambdaPowertoolsLayer +from cdk_aws_lambda_powertools_layer import LambdaPowertoolsLayer from constructs import Construct From c5d266924f398de86dd11b7baf954714b70f06cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Mon, 3 Oct 2022 21:12:21 +0200 Subject: [PATCH 14/36] chore: update call to CDK architecture --- layer/layer/canary_stack.py | 4 ++-- layer/layer/layer_stack.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/layer/layer/canary_stack.py b/layer/layer/canary_stack.py index e519517a2e5..40fdfffa38c 100644 --- a/layer/layer/canary_stack.py +++ b/layer/layer/canary_stack.py @@ -33,7 +33,7 @@ def __init__( "Canary-x86-64", layer_arn=layer_arn, powertools_version=powertools_version, - architecture=Architecture.X86_64(), + architecture=Architecture.X86_64, ) layer_arm64_arn = StringParameter.from_string_parameter_attributes( @@ -46,7 +46,7 @@ def __init__( "Canary-arm64", layer_arn=layer_arm64_arn, powertools_version=powertools_version, - architecture=Architecture.ARM_64(), + architecture=Architecture.ARM_64, ) diff --git a/layer/layer/layer_stack.py b/layer/layer/layer_stack.py index 4beca85d503..6a92e1fa408 100644 --- a/layer/layer/layer_stack.py +++ b/layer/layer/layer_stack.py @@ -23,7 +23,7 @@ def __init__( layer_version_name="AWSLambdaPowertoolsPythonV2", version=powertools_version, include_extras=True, - compatible_architectures=[Architecture.X86_64()], + compatible_architectures=[Architecture.X86_64], ) layer_arm64 = LambdaPowertoolsLayer( @@ -32,7 +32,7 @@ def __init__( layer_version_name="AWSLambdaPowertoolsPythonV2-Arm64", version=powertools_version, include_extras=True, - compatible_architectures=[Architecture.ARM_64()], + compatible_architectures=[Architecture.ARM_64], ) layer_permission = CfnLayerVersionPermission( From c5b1df8189f80e1aa4543006167244105f56126b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Tue, 4 Oct 2022 16:20:18 +0200 Subject: [PATCH 15/36] chore: fix canary deployment --- layer/layer/canary_stack.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/layer/layer/canary_stack.py b/layer/layer/canary_stack.py index 40fdfffa38c..fda9ebff3ad 100644 --- a/layer/layer/canary_stack.py +++ b/layer/layer/canary_stack.py @@ -25,6 +25,10 @@ def __init__( ) -> None: super().__init__(scope, construct_id, **kwargs) + deploy_stage = CfnParameter( + self, "DeployStage", description="Deployment stage for canary" + ).value_as_string + layer_arn = StringParameter.from_string_parameter_attributes( self, "LayerVersionArnParam", parameter_name=ssm_paramter_layer_arn ).string_value @@ -34,6 +38,7 @@ def __init__( layer_arn=layer_arn, powertools_version=powertools_version, architecture=Architecture.X86_64, + stage=deploy_stage, ) layer_arm64_arn = StringParameter.from_string_parameter_attributes( @@ -47,6 +52,7 @@ def __init__( layer_arn=layer_arm64_arn, powertools_version=powertools_version, architecture=Architecture.ARM_64, + stage=deploy_stage, ) @@ -58,15 +64,13 @@ def __init__( layer_arn: str, powertools_version: str, architecture: Architecture, + stage: str, ): super().__init__(scope, construct_id) layer = LayerVersion.from_layer_version_arn( self, "PowertoolsLayer", layer_version_arn=layer_arn ) - deploy_stage = CfnParameter( - self, "DeployStage", description="Deployment stage for canary" - ).value_as_string execution_role = Role( self, @@ -102,7 +106,7 @@ def __init__( "POWERTOOLS_VERSION": powertools_version, "POWERTOOLS_LAYER_ARN": layer_arn, "VERSION_TRACKING_EVENT_BUS_ARN": VERSION_TRACKING_EVENT_BUS_ARN, - "LAYER_PIPELINE_STAGE": deploy_stage, + "LAYER_PIPELINE_STAGE": stage, }, ) From 2c3b64c8ea7768d7401c045eec8cd3d4e9f0b3cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Wed, 5 Oct 2022 11:50:29 +0200 Subject: [PATCH 16/36] feat: use canary to test for presence of optional dependencies --- layer/layer/canary/app.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/layer/layer/canary/app.py b/layer/layer/canary/app.py index 24f8bf2662f..d24f10b2f87 100644 --- a/layer/layer/canary/app.py +++ b/layer/layer/canary/app.py @@ -5,11 +5,15 @@ from importlib.metadata import version import boto3 +from pydantic import EmailStr from aws_lambda_powertools import Logger, Metrics, Tracer +from aws_lambda_powertools.utilities.parser import BaseModel, envelopes, event_parser +from aws_lambda_powertools.utilities.typing import LambdaContext +from aws_lambda_powertools.utilities.validation import validator logger = Logger(service="version-track") -tracer = Tracer() +tracer = Tracer() # this checks for aws-xray-sdk presence metrics = Metrics(namespace="powertools-layer-canary", service="PowertoolsLayerCanary") layer_arn = os.getenv("POWERTOOLS_LAYER_ARN") @@ -18,6 +22,26 @@ event_bus_arn = os.getenv("VERSION_TRACKING_EVENT_BUS_ARN") +# Model to check parser imports correctly, tests for pydantic and email-validator +class OrderItem(BaseModel): + order_id: int + quantity: int + description: str + email: EmailStr + + +# Tests for jmespath presence +@event_parser(model=OrderItem, envelope=envelopes.EventBridgeEnvelope) +def envelope_handler(event: OrderItem, context: LambdaContext): + assert event.order_id != 1 + + +# Tests for fastjsonschema presence +@validator(inbound_schema={}, envelope="detail") +def validator_handler(event, context: LambdaContext): + pass + + def handler(event): logger.info("Running checks") check_envs() From 41f8d4e585ac75a996cf27bdcaf4bbb1f74ea5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Wed, 5 Oct 2022 11:50:53 +0200 Subject: [PATCH 17/36] chore: bump cdk to 2.44 so we can use direct mode --- package-lock.json | 18 +++++++++++------- package.json | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5a72aa1ad10..1764eda669e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,13 +8,14 @@ "name": "aws-lambda-powertools-python-e2e", "version": "1.0.0", "devDependencies": { - "aws-cdk": "2.40.0" + "aws-cdk": "2.44.0" } }, "node_modules/aws-cdk": { - "version": "2.40.0", - "resolved": "https://registry.npmjs.org/aws-cdk/-/aws-cdk-2.40.0.tgz", - "integrity": "sha512-oHacGkLFDELwhpJsZSAhFHWDxIeZW3DgKkwiXlNO81JxNfjcHgPR2rsbh/Gz+n4ErAEzOV6WfuWVMe68zv+iPg==", + "version": "2.44.0", + "resolved": "https://registry.npmjs.org/aws-cdk/-/aws-cdk-2.44.0.tgz", + "integrity": "sha512-9hbK4Yc1GQ28zSjZE2ajidt7sRrTLYpijkI7HT7JcDhXLe2ZGP9EOZrqKy5EEsOv0wDQ7cdXB3/oMiMGSmSQ5A==", + "dev": true, "bin": { "cdk": "bin/cdk" }, @@ -29,6 +30,7 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -41,9 +43,10 @@ }, "dependencies": { "aws-cdk": { - "version": "2.40.0", - "resolved": "https://registry.npmjs.org/aws-cdk/-/aws-cdk-2.40.0.tgz", - "integrity": "sha512-oHacGkLFDELwhpJsZSAhFHWDxIeZW3DgKkwiXlNO81JxNfjcHgPR2rsbh/Gz+n4ErAEzOV6WfuWVMe68zv+iPg==", + "version": "2.44.0", + "resolved": "https://registry.npmjs.org/aws-cdk/-/aws-cdk-2.44.0.tgz", + "integrity": "sha512-9hbK4Yc1GQ28zSjZE2ajidt7sRrTLYpijkI7HT7JcDhXLe2ZGP9EOZrqKy5EEsOv0wDQ7cdXB3/oMiMGSmSQ5A==", + "dev": true, "requires": { "fsevents": "2.3.2" } @@ -52,6 +55,7 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, "optional": true } } diff --git a/package.json b/package.json index 6e3a2c1b216..6d5eb3f5bee 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,6 @@ "name": "aws-lambda-powertools-python-e2e", "version": "1.0.0", "devDependencies": { - "aws-cdk": "2.40.0" + "aws-cdk": "2.44.0" } } From db227e2ef2b32b3d9be472cec18e9a862e516b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Wed, 5 Oct 2022 11:51:01 +0200 Subject: [PATCH 18/36] chore: typo --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 32cd564a249..4a98a99e154 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,8 +22,8 @@ license = "MIT-0" python = "^3.7.4" aws-xray-sdk = { version = "^2.8.0", optional = true } fastjsonschema = { version = "^2.14.5", optional = true } -pydantic = {version = "^1.8.2", optional = true } -email-validator = {version = "*", optional = true } +pydantic = { version = "^1.8.2", optional = true } +email-validator = { version = "*", optional = true } [tool.poetry.dev-dependencies] # Maintenance: 2022-04-21 jmespath was removed, to be re-added once we drop python 3.6. From 1c7b4fe51ea565e2d2a7b65097db35b02889482d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Wed, 5 Oct 2022 11:54:27 +0200 Subject: [PATCH 19/36] feat: use CDK direct mode on e2e and remove unecessary deps --- tests/e2e/utils/infrastructure.py | 3 ++- tests/e2e/utils/lambda_layer/powertools_layer.py | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/e2e/utils/infrastructure.py b/tests/e2e/utils/infrastructure.py index 82d0463b2aa..7cb964da87f 100644 --- a/tests/e2e/utils/infrastructure.py +++ b/tests/e2e/utils/infrastructure.py @@ -156,7 +156,8 @@ def deploy(self) -> Dict[str, str]: stack_file = self._create_temp_cdk_app() synth_command = f"npx cdk synth --app 'python {stack_file}' -o {self._cdk_out_dir}" deploy_command = ( - f"npx cdk deploy --app '{self._cdk_out_dir}' -O {self._stack_outputs_file} --require-approval=never" + f"npx cdk deploy --app '{self._cdk_out_dir}' -O {self._stack_outputs_file} " + "--require-approval=never --method=direct" ) # CDK launches a background task, so we must wait diff --git a/tests/e2e/utils/lambda_layer/powertools_layer.py b/tests/e2e/utils/lambda_layer/powertools_layer.py index 45a22547715..660ceeac293 100644 --- a/tests/e2e/utils/lambda_layer/powertools_layer.py +++ b/tests/e2e/utils/lambda_layer/powertools_layer.py @@ -16,9 +16,16 @@ class LocalLambdaPowertoolsLayer(BaseLocalLambdaLayer): def __init__(self, output_dir: Path = CDK_OUT_PATH): super().__init__(output_dir) - self.package = f"{SOURCE_CODE_ROOT_PATH}[pydantic]" + self.package = f"{SOURCE_CODE_ROOT_PATH}[all]" self.build_args = "--platform manylinux1_x86_64 --only-binary=:all: --upgrade" self.build_command = f"python -m pip install {self.package} {self.build_args} --target {self.target_dir}" + self.cleanup_command = ( + f"rm -rf {self.target_dir}/boto* {self.target_dir}/s3transfer* && " + f"rm -rf {self.target_dir}/*dateutil* {self.target_dir}/urllib3* {self.target_dir}/six* && " + f"find {self.target_dir} -name '*.so' -type f -exec strip '{{}}' \; && " # noqa: W605 + f"find {self.target_dir} -wholename '*/tests/*' -type f -delete && " # noqa: W605 + f"find {self.target_dir} -regex '^.*\(__pycache__\|\.py[co]\)$' -delete" # noqa: W605 + ) self.source_diff_file: Path = CDK_OUT_PATH / "layer_build.diff" def build(self) -> str: @@ -31,6 +38,11 @@ def build(self) -> str: return str(self.output_dir) + def after_build(self): + subprocess.run(self.cleanup_command, shell=True) + + super(LocalLambdaPowertoolsLayer, self).after_build() + def _has_source_changed(self) -> bool: """Hashes source code and From 84eb4b5d3722aa000a642076e41121689cdc23e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Wed, 5 Oct 2022 11:58:01 +0200 Subject: [PATCH 20/36] chore: remove badly escaped strings --- tests/e2e/utils/lambda_layer/powertools_layer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e2e/utils/lambda_layer/powertools_layer.py b/tests/e2e/utils/lambda_layer/powertools_layer.py index 660ceeac293..20c73dd9549 100644 --- a/tests/e2e/utils/lambda_layer/powertools_layer.py +++ b/tests/e2e/utils/lambda_layer/powertools_layer.py @@ -22,9 +22,9 @@ def __init__(self, output_dir: Path = CDK_OUT_PATH): self.cleanup_command = ( f"rm -rf {self.target_dir}/boto* {self.target_dir}/s3transfer* && " f"rm -rf {self.target_dir}/*dateutil* {self.target_dir}/urllib3* {self.target_dir}/six* && " - f"find {self.target_dir} -name '*.so' -type f -exec strip '{{}}' \; && " # noqa: W605 - f"find {self.target_dir} -wholename '*/tests/*' -type f -delete && " # noqa: W605 - f"find {self.target_dir} -regex '^.*\(__pycache__\|\.py[co]\)$' -delete" # noqa: W605 + f"find {self.target_dir} -name '*.so' -type f -exec strip '{{}}' \\; && " + f"find {self.target_dir} -wholename '*/tests/*' -type f -delete && " + f"find {self.target_dir} -regex '^.*\\(__pycache__\\|\\.py[co]\\)$' -delete" ) self.source_diff_file: Path = CDK_OUT_PATH / "layer_build.diff" From f0093a468f1f1405875f31281e1e320337cc9c52 Mon Sep 17 00:00:00 2001 From: Ruben Fonseca Date: Thu, 6 Oct 2022 11:38:19 +0200 Subject: [PATCH 21/36] chore: apply suggestions from code review Co-authored-by: Heitor Lessa --- .github/workflows/publish_v2_layer.yml | 1 + layer/layer/canary/app.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish_v2_layer.yml b/.github/workflows/publish_v2_layer.yml index da5db45a0dc..469a94ad876 100644 --- a/.github/workflows/publish_v2_layer.yml +++ b/.github/workflows/publish_v2_layer.yml @@ -53,6 +53,7 @@ jobs: echo RELEASE_TAG_VERSION="${RELEASE_TAG_VERSION:1}" >> "$GITHUB_ENV" - name: Set up QEMU uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 # v2.0.0 + # NOTE: we need QEMU to build Layer against a different architecture (e.g., ARM) - name: Set up Docker Buildx id: builder uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # v2.0.0 diff --git a/layer/layer/canary/app.py b/layer/layer/canary/app.py index d24f10b2f87..3682d36b373 100644 --- a/layer/layer/canary/app.py +++ b/layer/layer/canary/app.py @@ -106,7 +106,7 @@ def send_notification(): ) return - architecture = platform.uname()[4] + architecture = platform.uname()[4] # arm64, x86_64 event = { "Time": datetime.datetime.now(), "Source": "powertools.layer.canary", From 7a45c12445b7a4c8227355c989d4cf66984645c0 Mon Sep 17 00:00:00 2001 From: Ruben Fonseca Date: Thu, 6 Oct 2022 11:39:50 +0200 Subject: [PATCH 22/36] chore: apply suggestions from code review Co-authored-by: Heitor Lessa --- pyproject.toml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4a98a99e154..ee47fa598aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ python = "^3.7.4" aws-xray-sdk = { version = "^2.8.0", optional = true } fastjsonschema = { version = "^2.14.5", optional = true } pydantic = { version = "^1.8.2", optional = true } -email-validator = { version = "*", optional = true } +email-validator = { version = "^1.3.0", optional = true } [tool.poetry.dev-dependencies] # Maintenance: 2022-04-21 jmespath was removed, to be re-added once we drop python 3.6. @@ -77,11 +77,9 @@ checksumdir = "^1.2.0" importlib-metadata = "^4.13" [tool.poetry.extras] -parser = ["pydantic", "email-validator", "jmespath"] -validation = ["fastjsonschema", "jmespath"] +parser = ["pydantic", "email-validator"] +validation = ["fastjsonschema"] tracer = ["aws-xray-sdk"] -idempotency = ["jmespath"] -jmespath = ["jmespath"] all = ["pydantic", "email-validator", "aws-xray-sdk", "fastjsonschema"] [tool.coverage.run] From 5dd961a6b1b1626968499057585a076c74113a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Thu, 6 Oct 2022 11:40:21 +0200 Subject: [PATCH 23/36] chore: lock dependencies --- poetry.lock | 86 ++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/poetry.lock b/poetry.lock index 59948ce30b3..c40567298ac 100644 --- a/poetry.lock +++ b/poetry.lock @@ -7,10 +7,10 @@ optional = false python-versions = ">=3.5" [package.extras] -dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy (>=0.900,!=0.940)", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "sphinx", "sphinx-notfound-page", "zope.interface"] -docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"] -tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "zope.interface"] -tests_no_zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins"] +dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"] +docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] +tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "cloudpickle"] +tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "cloudpickle"] [[package]] name = "aws-cdk-lib" @@ -84,7 +84,7 @@ PyYAML = ">=5.3.1" stevedore = ">=1.20.0" [package.extras] -test = ["beautifulsoup4 (>=4.8.0)", "coverage (>=4.5.4)", "fixtures (>=3.0.0)", "flake8 (>=4.0.0)", "pylint (==1.9.4)", "stestr (>=2.5.0)", "testscenarios (>=0.5.0)", "testtools (>=2.3.0)", "toml"] +test = ["coverage (>=4.5.4)", "fixtures (>=3.0.0)", "flake8 (>=4.0.0)", "stestr (>=2.5.0)", "testscenarios (>=0.5.0)", "testtools (>=2.3.0)", "toml", "beautifulsoup4 (>=4.8.0)", "pylint (==1.9.4)"] toml = ["toml"] yaml = ["pyyaml"] @@ -113,14 +113,14 @@ uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "boto3" -version = "1.24.86" +version = "1.24.87" description = "The AWS SDK for Python" category = "dev" optional = false python-versions = ">= 3.7" [package.dependencies] -botocore = ">=1.27.86,<1.28.0" +botocore = ">=1.27.87,<1.28.0" jmespath = ">=0.7.1,<2.0.0" s3transfer = ">=0.6.0,<0.7.0" @@ -129,7 +129,7 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.27.86" +version = "1.27.87" description = "Low-level, data-driven core of boto 3." category = "main" optional = false @@ -205,7 +205,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "constructs" -version = "10.1.122" +version = "10.1.123" description = "A programming model for software-defined state" category = "dev" optional = false @@ -247,8 +247,8 @@ optional = true python-versions = ">=3.6,<4.0" [package.extras] -curio = ["curio (>=1.2,<2.0)", "sniffio (>=1.1,<2.0)"] dnssec = ["cryptography (>=2.6,<37.0)"] +curio = ["curio (>=1.2,<2.0)", "sniffio (>=1.1,<2.0)"] doh = ["h2 (>=4.1.0)", "httpx (>=0.21.1)", "requests (>=2.23.0,<3.0.0)", "requests-toolbelt (>=0.9.1,<0.10.0)"] idna = ["idna (>=2.1,<4.0)"] trio = ["trio (>=0.14,<0.20)"] @@ -305,7 +305,7 @@ optional = true python-versions = "*" [package.extras] -devel = ["colorama", "json-spec", "jsonschema", "pylint", "pytest", "pytest-benchmark", "pytest-cache", "validictory"] +devel = ["colorama", "jsonschema", "json-spec", "pylint", "pytest", "pytest-benchmark", "pytest-cache", "validictory"] [[package]] name = "filelock" @@ -464,7 +464,7 @@ python-versions = "*" python-dateutil = ">=2.8.1" [package.extras] -dev = ["flake8", "markdown", "twine", "wheel"] +dev = ["wheel", "flake8", "markdown", "twine"] [[package]] name = "gitdb" @@ -510,9 +510,9 @@ typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} zipp = ">=0.5" [package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)"] +docs = ["sphinx (>=3.5)", "jaraco.packaging (>=9)", "rst.linker (>=1.9)", "furo", "jaraco.tidelift (>=1.4)"] perf = ["ipython"] -testing = ["flake8 (<5)", "flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)"] +testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "flake8 (<5)", "pytest-cov", "pytest-enabler (>=1.3)", "packaging", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)", "importlib-resources (>=1.3)"] [[package]] name = "iniconfig" @@ -531,10 +531,10 @@ optional = false python-versions = ">=3.6.1,<4.0" [package.extras] -colors = ["colorama (>=0.4.3,<0.5.0)"] pipfile_deprecated_finder = ["pipreqs", "requirementslib"] +requirements_deprecated_finder = ["pipreqs", "pip-api"] +colors = ["colorama (>=0.4.3,<0.5.0)"] plugins = ["setuptools"] -requirements_deprecated_finder = ["pip-api", "pipreqs"] [[package]] name = "jinja2" @@ -617,7 +617,7 @@ python-versions = ">=3.6" importlib-metadata = {version = ">=4.4", markers = "python_version < \"3.10\""} [package.extras] -testing = ["coverage", "pyyaml"] +testing = ["pyyaml", "coverage"] [[package]] name = "markupsafe" @@ -658,8 +658,8 @@ pyyaml = ">=5.1" verspec = "*" [package.extras] -dev = ["coverage", "flake8 (>=3.0)", "shtab"] -test = ["coverage", "flake8 (>=3.0)", "shtab"] +test = ["shtab", "flake8 (>=3.0)", "coverage"] +dev = ["shtab", "flake8 (>=3.0)", "coverage"] [[package]] name = "mkdocs" @@ -908,8 +908,8 @@ optional = false python-versions = ">=3.7" [package.extras] -docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx (>=4)", "sphinx-autodoc-typehints (>=1.12)"] -test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)"] +docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx-autodoc-typehints (>=1.12)", "sphinx (>=4)"] +test = ["appdirs (==1.4.4)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)", "pytest (>=6)"] [[package]] name = "pluggy" @@ -923,8 +923,8 @@ python-versions = ">=3.6" importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} [package.extras] -dev = ["pre-commit", "tox"] -testing = ["pytest", "pytest-benchmark"] +testing = ["pytest-benchmark", "pytest"] +dev = ["tox", "pre-commit"] [[package]] name = "publication" @@ -1012,7 +1012,7 @@ optional = false python-versions = ">=3.6.8" [package.extras] -diagrams = ["jinja2", "railroad-diagrams"] +diagrams = ["railroad-diagrams", "jinja2"] [[package]] name = "pytest" @@ -1079,7 +1079,7 @@ coverage = {version = ">=5.2.1", extras = ["toml"]} pytest = ">=4.6" [package.extras] -testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] +testing = ["virtualenv", "pytest-xdist", "six", "process-tests", "hunter", "fields"] [[package]] name = "pytest-forked" @@ -1095,7 +1095,7 @@ pytest = ">=3.10" [[package]] name = "pytest-mock" -version = "3.9.0" +version = "3.10.0" description = "Thin-wrapper around the mock package for easier use with pytest" category = "dev" optional = false @@ -1105,7 +1105,7 @@ python-versions = ">=3.7" pytest = ">=5.0" [package.extras] -dev = ["pre-commit", "pytest-asyncio", "tox"] +dev = ["pre-commit", "tox", "pytest-asyncio"] [[package]] name = "pytest-xdist" @@ -1273,8 +1273,8 @@ optional = false python-versions = ">=3.5.3" [package.extras] +test = ["mypy", "typing-extensions", "pytest"] doc = ["sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] -test = ["mypy", "pytest", "typing-extensions"] [[package]] name = "types-requests" @@ -1312,8 +1312,8 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4" [package.extras] -brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] -secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] +brotli = ["brotlicffi (>=0.8.0)", "brotli (>=1.0.9)", "brotlipy (>=0.6.0)"] +secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "urllib3-secure-extra", "ipaddress"] socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [[package]] @@ -1325,7 +1325,7 @@ optional = false python-versions = "*" [package.extras] -test = ["coverage", "flake8 (>=3.7)", "mypy", "pretend", "pytest"] +test = ["pytest", "pretend", "mypy", "flake8 (>=3.7)", "coverage"] [[package]] name = "watchdog" @@ -1368,13 +1368,11 @@ optional = false python-versions = ">=3.7" [package.extras] -docs = ["jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx"] -testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] +docs = ["sphinx", "jaraco.packaging (>=9)", "rst.linker (>=1.9)", "jaraco.tidelift (>=1.4)"] +testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.3)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)"] [extras] all = ["pydantic", "email-validator", "aws-xray-sdk", "fastjsonschema"] -idempotency = [] -jmespath = [] parser = ["pydantic", "email-validator"] tracer = ["aws-xray-sdk"] validation = ["fastjsonschema"] @@ -1382,7 +1380,7 @@ validation = ["fastjsonschema"] [metadata] lock-version = "1.1" python-versions = "^3.7.4" -content-hash = "fe678a326f7cdf45b21348f113698e3686fffd493a2f74434cbcb6750e51def4" +content-hash = "5c9d50c6b28685bc519a664caea9ce01be1f49b338390dc81430290ec2d61656" [metadata.files] attrs = [ @@ -1432,12 +1430,12 @@ black = [ {file = "black-22.8.0.tar.gz", hash = "sha256:792f7eb540ba9a17e8656538701d3eb1afcb134e3b45b71f20b25c77a8db7e6e"}, ] boto3 = [ - {file = "boto3-1.24.86-py3-none-any.whl", hash = "sha256:c1d4e5d73d7720402c6538965efd6df5807492db8a71f30221dc11355d06db05"}, - {file = "boto3-1.24.86.tar.gz", hash = "sha256:59e9c39c867b5fd0575a50d8fafdf72c823c5510254a8615dff24f1584408121"}, + {file = "boto3-1.24.87-py3-none-any.whl", hash = "sha256:bcc579e801774cb2c7dda87ff985feda1ae7e10591d11ef37526363139138bd4"}, + {file = "boto3-1.24.87.tar.gz", hash = "sha256:3dd7ed74d1d29dd8094a078be86ed61c45de6638fe18856f7a1ff9282b4d929e"}, ] botocore = [ - {file = "botocore-1.27.86-py3-none-any.whl", hash = "sha256:830359c8bf22f2a386431825060ff9666519c032f2ccd4a69f1a702f7195f6c0"}, - {file = "botocore-1.27.86.tar.gz", hash = "sha256:dcfe1825b84d17cf11653f8bb4bc77c2f172dcec1dc68eee932d68e5e6ed89d5"}, + {file = "botocore-1.27.87-py3-none-any.whl", hash = "sha256:c4cbd22056ace4c7aa99e62e8ae629865ab80cc8bbf7c6d68ccf0f768f0034b6"}, + {file = "botocore-1.27.87.tar.gz", hash = "sha256:216de9751116d0d1cc3901e26d95a5c9a30ecb6973ae6147af1cf504858d845a"}, ] cattrs = [] certifi = [ @@ -1458,8 +1456,8 @@ click = [ ] colorama = [] constructs = [ - {file = "constructs-10.1.122-py3-none-any.whl", hash = "sha256:2c1c120d737c2c728c2960bc042d5a22da36b2ad38d42885f8f1e4b8cc573524"}, - {file = "constructs-10.1.122.tar.gz", hash = "sha256:220ce3b4dbc30401e54e22c0779cfab8d740ac176326609f5391101133432583"}, + {file = "constructs-10.1.123-py3-none-any.whl", hash = "sha256:a095dc34ac5d1ba582a6bd9364c2676d4c4de3d99466dc7cea0445ec4acdf226"}, + {file = "constructs-10.1.123.tar.gz", hash = "sha256:5f183f6c87ad755e96a0395aac043c0b4c1edd52e67e7c2b18affaf5f7eff284"}, ] coverage = [ {file = "coverage-6.5.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ef8674b0ee8cc11e2d574e3e2998aea5df5ab242e012286824ea3c6970580e53"}, @@ -1793,8 +1791,8 @@ pytest-benchmark = [] pytest-cov = [] pytest-forked = [] pytest-mock = [ - {file = "pytest-mock-3.9.0.tar.gz", hash = "sha256:c899a0dcc8a5f22930acd020b500abd5f956911f326864a3b979e4866e14da82"}, - {file = "pytest_mock-3.9.0-py3-none-any.whl", hash = "sha256:1a1b9264224d026932d6685a0f9cef3b61d91563c3e74af9fe5afb2767e13812"}, + {file = "pytest-mock-3.10.0.tar.gz", hash = "sha256:fbbdb085ef7c252a326fd8cdcac0aa3b1333d8811f131bdcc701002e1be7ed4f"}, + {file = "pytest_mock-3.10.0-py3-none-any.whl", hash = "sha256:f4c973eeae0282963eb293eb173ce91b091a79c1334455acfac9ddee8a1c784b"}, ] pytest-xdist = [] python-dateutil = [] From 4ad4b5e6cb5e10f1ed394f038356268dc35f61e9 Mon Sep 17 00:00:00 2001 From: Ruben Fonseca Date: Thu, 6 Oct 2022 11:45:08 +0200 Subject: [PATCH 24/36] chore: apply suggestions from code review Co-authored-by: Heitor Lessa --- tests/e2e/utils/lambda_layer/powertools_layer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/utils/lambda_layer/powertools_layer.py b/tests/e2e/utils/lambda_layer/powertools_layer.py index 20c73dd9549..bb952b767ea 100644 --- a/tests/e2e/utils/lambda_layer/powertools_layer.py +++ b/tests/e2e/utils/lambda_layer/powertools_layer.py @@ -22,6 +22,7 @@ def __init__(self, output_dir: Path = CDK_OUT_PATH): self.cleanup_command = ( f"rm -rf {self.target_dir}/boto* {self.target_dir}/s3transfer* && " f"rm -rf {self.target_dir}/*dateutil* {self.target_dir}/urllib3* {self.target_dir}/six* && " + f"rm -rf {self.target_dir}/jmespath* && " f"find {self.target_dir} -name '*.so' -type f -exec strip '{{}}' \\; && " f"find {self.target_dir} -wholename '*/tests/*' -type f -delete && " f"find {self.target_dir} -regex '^.*\\(__pycache__\\|\\.py[co]\\)$' -delete" From 2c057a4dad22b444e3f3b53b9c755160aa2a9c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Thu, 6 Oct 2022 11:44:23 +0200 Subject: [PATCH 25/36] chore: remove unecessary code --- tests/e2e/utils/lambda_layer/powertools_layer.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/e2e/utils/lambda_layer/powertools_layer.py b/tests/e2e/utils/lambda_layer/powertools_layer.py index bb952b767ea..ba2601b8abf 100644 --- a/tests/e2e/utils/lambda_layer/powertools_layer.py +++ b/tests/e2e/utils/lambda_layer/powertools_layer.py @@ -42,8 +42,6 @@ def build(self) -> str: def after_build(self): subprocess.run(self.cleanup_command, shell=True) - super(LocalLambdaPowertoolsLayer, self).after_build() - def _has_source_changed(self) -> bool: """Hashes source code and From 36fff2f107ec0b496cf09d3675c99ed8c518344b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Thu, 6 Oct 2022 12:21:04 +0200 Subject: [PATCH 26/36] feat: allow e2e tests to run on arm64 --- layer/layer/canary/app.py | 18 +++++++-------- tests/e2e/utils/infrastructure.py | 13 ++++++++--- .../utils/lambda_layer/powertools_layer.py | 22 +++++++++++++++++-- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/layer/layer/canary/app.py b/layer/layer/canary/app.py index 3682d36b373..b577eff7fa5 100644 --- a/layer/layer/canary/app.py +++ b/layer/layer/canary/app.py @@ -67,9 +67,7 @@ def on_create(event): def check_envs(): - logger.info( - 'Checking required envs ["POWERTOOLS_LAYER_ARN", "AWS_REGION", "STAGE"]' - ) + logger.info('Checking required envs ["POWERTOOLS_LAYER_ARN", "AWS_REGION", "STAGE"]') if not layer_arn: raise ValueError("POWERTOOLS_LAYER_ARN is not set. Aborting...") if not powertools_version: @@ -93,7 +91,7 @@ def verify_powertools_version() -> None: raise ValueError( f'Expected Powertools version is "{powertools_version}", but layer contains version "{current_version}"' ) - logger.info(f"Current Powertools version is: {current_version}") + logger.info(f"Current Powertools version is: {current_version} [{_get_architecture()}]") def send_notification(): @@ -101,12 +99,9 @@ def send_notification(): sends an event to version tracking event bridge """ if stage != "PROD": - logger.info( - "Not sending notification to event bus, because this is not the PROD stage" - ) + logger.info("Not sending notification to event bus, because this is not the PROD stage") return - architecture = platform.uname()[4] # arm64, x86_64 event = { "Time": datetime.datetime.now(), "Source": "powertools.layer.canary", @@ -117,7 +112,7 @@ def send_notification(): "version": powertools_version, "region": os.environ["AWS_REGION"], "layerArn": layer_arn, - "architecture": architecture, + "architecture": _get_architecture(), } ), } @@ -130,3 +125,8 @@ def send_notification(): if resp["FailedEntryCount"] != 0: logger.error(resp) raise ValueError("Failed to send deployment notification to version tracking") + + +def _get_architecture() -> str: + """Returns aarch64, x86_64""" + return platform.uname()[4] diff --git a/tests/e2e/utils/infrastructure.py b/tests/e2e/utils/infrastructure.py index 7cb964da87f..eb96240b6a7 100644 --- a/tests/e2e/utils/infrastructure.py +++ b/tests/e2e/utils/infrastructure.py @@ -11,7 +11,7 @@ import boto3 import pytest from aws_cdk import App, CfnOutput, Environment, RemovalPolicy, Stack, aws_logs -from aws_cdk.aws_lambda import Code, Function, LayerVersion, Runtime, Tracing +from aws_cdk.aws_lambda import Architecture, Code, Function, LayerVersion, Runtime, Tracing from filelock import FileLock from mypy_boto3_cloudformation import CloudFormationClient @@ -53,7 +53,9 @@ def __init__(self) -> None: "You must have your infrastructure defined in 'tests/e2e//infrastructure.py'." ) - def create_lambda_functions(self, function_props: Optional[Dict] = None) -> Dict[str, Function]: + def create_lambda_functions( + self, function_props: Optional[Dict] = None, architecture: Optional[Architecture] = Architecture.X86_64 + ) -> Dict[str, Function]: """Create Lambda functions available under handlers_dir It creates CloudFormation Outputs for every function found in PascalCase. For example, @@ -65,6 +67,9 @@ def create_lambda_functions(self, function_props: Optional[Dict] = None) -> Dict function_props: Optional[Dict] Dictionary representing CDK Lambda FunctionProps to override defaults + architecture: Optional[Architecture] + Used to create Lambda Layer and functions in a different architecture. Defaults to x86_64. + Returns ------- output: Dict[str, Function] @@ -90,7 +95,7 @@ def create_lambda_functions(self, function_props: Optional[Dict] = None) -> Dict if not self._handlers_dir.exists(): raise RuntimeError(f"Handlers dir '{self._handlers_dir}' must exist for functions to be created.") - layer_build = LocalLambdaPowertoolsLayer().build() + layer_build = LocalLambdaPowertoolsLayer(architecture=architecture).build() layer = LayerVersion( self.stack, "aws-lambda-powertools-e2e-test", @@ -100,6 +105,7 @@ def create_lambda_functions(self, function_props: Optional[Dict] = None) -> Dict Runtime.PYTHON_3_8, Runtime.PYTHON_3_9, ], + compatible_architectures=[architecture], code=Code.from_asset(path=layer_build), ) @@ -123,6 +129,7 @@ def create_lambda_functions(self, function_props: Optional[Dict] = None) -> Dict "tracing": Tracing.ACTIVE, "runtime": Runtime.PYTHON_3_9, "layers": [layer], + "architecture": architecture, **function_settings_override, } diff --git a/tests/e2e/utils/lambda_layer/powertools_layer.py b/tests/e2e/utils/lambda_layer/powertools_layer.py index ba2601b8abf..9fba25e00fe 100644 --- a/tests/e2e/utils/lambda_layer/powertools_layer.py +++ b/tests/e2e/utils/lambda_layer/powertools_layer.py @@ -2,6 +2,7 @@ import subprocess from pathlib import Path +from aws_cdk.aws_lambda import Architecture from checksumdir import dirhash from aws_lambda_powertools import PACKAGE_PATH @@ -14,10 +15,12 @@ class LocalLambdaPowertoolsLayer(BaseLocalLambdaLayer): IGNORE_EXTENSIONS = ["pyc"] - def __init__(self, output_dir: Path = CDK_OUT_PATH): + def __init__(self, output_dir: Path = CDK_OUT_PATH, architecture: Architecture = Architecture.X86_64): super().__init__(output_dir) self.package = f"{SOURCE_CODE_ROOT_PATH}[all]" - self.build_args = "--platform manylinux1_x86_64 --only-binary=:all: --upgrade" + + platform_name = self._platform_name(architecture) + self.build_args = f"--platform {platform_name} --only-binary=:all: --upgrade" self.build_command = f"python -m pip install {self.package} {self.build_args} --target {self.target_dir}" self.cleanup_command = ( f"rm -rf {self.target_dir}/boto* {self.target_dir}/s3transfer* && " @@ -57,3 +60,18 @@ def _has_source_changed(self) -> bool: return True return False + + def _platform_name(self, architecture: Architecture) -> str: + """Returns the correct plaform name for the manylinux project (see PEP 599) + + Returns + ------- + platform_name : str + The platform tag + """ + if architecture.name == Architecture.X86_64.name: + return "manylinux1_x86_64" + elif architecture.name == Architecture.ARM_64.name: + return "manylinux2014_aarch64" + else: + raise ValueError(f"unknown architecture {architecture.name}") From 4eef6bdc296c6100466db5126f3610f4f2aed2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Thu, 6 Oct 2022 13:41:38 +0200 Subject: [PATCH 27/36] chore: add jmespath as an optional dependency --- poetry.lock | 26 +++++++++++++------------- pyproject.toml | 3 +-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/poetry.lock b/poetry.lock index c40567298ac..ef69fd378b1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -14,7 +14,7 @@ tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (> [[package]] name = "aws-cdk-lib" -version = "2.44.0" +version = "2.45.0" description = "Version 2 of the AWS Cloud Development Kit library" category = "dev" optional = false @@ -28,14 +28,14 @@ typeguard = ">=2.13.3,<2.14.0" [[package]] name = "aws-cdk.aws-apigatewayv2-alpha" -version = "2.44.0a0" +version = "2.45.0a0" description = "The CDK Construct Library for AWS::APIGatewayv2" category = "dev" optional = false python-versions = "~=3.7" [package.dependencies] -aws-cdk-lib = ">=2.44.0,<3.0.0" +aws-cdk-lib = ">=2.45.0,<3.0.0" constructs = ">=10.0.0,<11.0.0" jsii = ">=1.68.0,<2.0.0" publication = ">=0.0.3" @@ -43,15 +43,15 @@ typeguard = ">=2.13.3,<2.14.0" [[package]] name = "aws-cdk.aws-apigatewayv2-integrations-alpha" -version = "2.44.0a0" +version = "2.45.0a0" description = "Integrations for AWS APIGateway V2" category = "dev" optional = false python-versions = "~=3.7" [package.dependencies] -aws-cdk-lib = ">=2.44.0,<3.0.0" -"aws-cdk.aws-apigatewayv2-alpha" = "2.44.0.a0" +aws-cdk-lib = ">=2.45.0,<3.0.0" +"aws-cdk.aws-apigatewayv2-alpha" = "2.45.0.a0" constructs = ">=10.0.0,<11.0.0" jsii = ">=1.68.0,<2.0.0" publication = ">=0.0.3" @@ -1380,7 +1380,7 @@ validation = ["fastjsonschema"] [metadata] lock-version = "1.1" python-versions = "^3.7.4" -content-hash = "5c9d50c6b28685bc519a664caea9ce01be1f49b338390dc81430290ec2d61656" +content-hash = "81bfd6a037da187ac628b5880dd3b351959e74b418ced37041d7cc3d4c45fb58" [metadata.files] attrs = [ @@ -1388,16 +1388,16 @@ attrs = [ {file = "attrs-22.1.0.tar.gz", hash = "sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6"}, ] aws-cdk-lib = [ - {file = "aws-cdk-lib-2.44.0.tar.gz", hash = "sha256:92eb87d6576a8be20bf8c359e25dbfd8c8890b53be54be57b71fbcdd16886eea"}, - {file = "aws_cdk_lib-2.44.0-py3-none-any.whl", hash = "sha256:f0de47d4a6e84391d2ec9f551e514c0f4f9be822d17695a305307f2f31751387"}, + {file = "aws-cdk-lib-2.45.0.tar.gz", hash = "sha256:ed4166498205a6507666a9fdb69f5dbeffa11cd69bf7e98b279ec305e4970374"}, + {file = "aws_cdk_lib-2.45.0-py3-none-any.whl", hash = "sha256:9463fe6d84563c4c23ae96810be0ea0ff0a260eebb85a4a7afe0c3747eca18a8"}, ] "aws-cdk.aws-apigatewayv2-alpha" = [ - {file = "aws-cdk.aws-apigatewayv2-alpha-2.44.0a0.tar.gz", hash = "sha256:df570880ef6089d40ae7e61c5377d6516a54ac28ee96e26810bc034dce45871e"}, - {file = "aws_cdk.aws_apigatewayv2_alpha-2.44.0a0-py3-none-any.whl", hash = "sha256:9cc0eb04c2589616b31b1f9eaf878287adfe6a2d9786b672078c8f658381f6e4"}, + {file = "aws-cdk.aws-apigatewayv2-alpha-2.45.0a0.tar.gz", hash = "sha256:1539f66d4c4ca18c83e7cbc929595f583a006c62afa74e901b091bdb3ede30d6"}, + {file = "aws_cdk.aws_apigatewayv2_alpha-2.45.0a0-py3-none-any.whl", hash = "sha256:7f92c3fc6146b8bb7ae9ef353c42485b8ca40ce6c8001827c233de3833e03a6e"}, ] "aws-cdk.aws-apigatewayv2-integrations-alpha" = [ - {file = "aws-cdk.aws-apigatewayv2-integrations-alpha-2.44.0a0.tar.gz", hash = "sha256:8ef1897ae1872cc27f8f8c35c47f67bdc61cb60e9cdc5e75c045eec20923f5f3"}, - {file = "aws_cdk.aws_apigatewayv2_integrations_alpha-2.44.0a0-py3-none-any.whl", hash = "sha256:3b89793b3b9ffb1136c4f063dc5cf7bf76cfd5305212a24ce662efa82993dd06"}, + {file = "aws-cdk.aws-apigatewayv2-integrations-alpha-2.45.0a0.tar.gz", hash = "sha256:a3a3413c34e444d752d44d7bbe8891d5c1af6d64e10185eaa21885710c12b33a"}, + {file = "aws_cdk.aws_apigatewayv2_integrations_alpha-2.45.0a0-py3-none-any.whl", hash = "sha256:d8ed1c1f0b1ea29255c561f528f494e3e8a85ebc7373234a58872c558408acbc"}, ] aws-xray-sdk = [] bandit = [ diff --git a/pyproject.toml b/pyproject.toml index ee47fa598aa..beabd0f8736 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,10 +24,9 @@ aws-xray-sdk = { version = "^2.8.0", optional = true } fastjsonschema = { version = "^2.14.5", optional = true } pydantic = { version = "^1.8.2", optional = true } email-validator = { version = "^1.3.0", optional = true } +jmespath = { version = "^1.0.1", optional = true } [tool.poetry.dev-dependencies] -# Maintenance: 2022-04-21 jmespath was removed, to be re-added once we drop python 3.6. -# issue #1148 coverage = {extras = ["toml"], version = "^6.2"} pytest = "^7.0.1" black = "^22.8" From c8ecdb45e566a08e7b9680bf8e2971c7b578dd87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Thu, 6 Oct 2022 13:41:49 +0200 Subject: [PATCH 28/36] chore: bumped layer construct version --- layer/poetry.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/layer/poetry.lock b/layer/poetry.lock index 6cb1f863714..1d439cb7ad8 100644 --- a/layer/poetry.lock +++ b/layer/poetry.lock @@ -14,7 +14,7 @@ tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (> [[package]] name = "aws-cdk-lib" -version = "2.44.0" +version = "2.45.0" description = "Version 2 of the AWS Cloud Development Kit library" category = "main" optional = false @@ -28,14 +28,14 @@ typeguard = ">=2.13.3,<2.14.0" [[package]] name = "boto3" -version = "1.24.84" +version = "1.24.87" description = "The AWS SDK for Python" category = "dev" optional = false python-versions = ">= 3.7" [package.dependencies] -botocore = ">=1.27.84,<1.28.0" +botocore = ">=1.27.87,<1.28.0" jmespath = ">=0.7.1,<2.0.0" s3transfer = ">=0.6.0,<0.7.0" @@ -44,7 +44,7 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.27.84" +version = "1.27.87" description = "Low-level, data-driven core of boto 3." category = "dev" optional = false @@ -72,7 +72,7 @@ exceptiongroup = {version = "*", markers = "python_version <= \"3.10\""} [[package]] name = "cdk-aws-lambda-powertools-layer" -version = "3.0.0" +version = "3.0.1" description = "A lambda layer for AWS Powertools for python and typescript" category = "main" optional = false @@ -95,7 +95,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "constructs" -version = "10.1.120" +version = "10.1.123" description = "A programming model for software-defined state" category = "main" optional = false @@ -304,26 +304,26 @@ attrs = [ {file = "attrs-22.1.0.tar.gz", hash = "sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6"}, ] aws-cdk-lib = [ - {file = "aws-cdk-lib-2.44.0.tar.gz", hash = "sha256:92eb87d6576a8be20bf8c359e25dbfd8c8890b53be54be57b71fbcdd16886eea"}, - {file = "aws_cdk_lib-2.44.0-py3-none-any.whl", hash = "sha256:f0de47d4a6e84391d2ec9f551e514c0f4f9be822d17695a305307f2f31751387"}, + {file = "aws-cdk-lib-2.45.0.tar.gz", hash = "sha256:ed4166498205a6507666a9fdb69f5dbeffa11cd69bf7e98b279ec305e4970374"}, + {file = "aws_cdk_lib-2.45.0-py3-none-any.whl", hash = "sha256:9463fe6d84563c4c23ae96810be0ea0ff0a260eebb85a4a7afe0c3747eca18a8"}, ] boto3 = [ - {file = "boto3-1.24.84-py3-none-any.whl", hash = "sha256:be151711bbb4db53e85dd5bbe506002ce6f2f21fc4e45fcf6d2cf356d32cc4c6"}, - {file = "boto3-1.24.84.tar.gz", hash = "sha256:6194763348545bb1669ce8d03ba104be1ba822daa184613aa10b9303a6a79017"}, + {file = "boto3-1.24.87-py3-none-any.whl", hash = "sha256:bcc579e801774cb2c7dda87ff985feda1ae7e10591d11ef37526363139138bd4"}, + {file = "boto3-1.24.87.tar.gz", hash = "sha256:3dd7ed74d1d29dd8094a078be86ed61c45de6638fe18856f7a1ff9282b4d929e"}, ] botocore = [ - {file = "botocore-1.27.84-py3-none-any.whl", hash = "sha256:da15026329706caf83323d84996f5ff5c527837347633fca9b3b1be0efa60841"}, - {file = "botocore-1.27.84.tar.gz", hash = "sha256:11f05d2acdf9a5f722856704b7b951b180647fb4340e1b5048b27273dc323909"}, + {file = "botocore-1.27.87-py3-none-any.whl", hash = "sha256:c4cbd22056ace4c7aa99e62e8ae629865ab80cc8bbf7c6d68ccf0f768f0034b6"}, + {file = "botocore-1.27.87.tar.gz", hash = "sha256:216de9751116d0d1cc3901e26d95a5c9a30ecb6973ae6147af1cf504858d845a"}, ] cattrs = [] cdk-aws-lambda-powertools-layer = [ - {file = "cdk-aws-lambda-powertools-layer-3.0.0.tar.gz", hash = "sha256:f877a4fa5a3530b0fbe59b53b635929f06a2ee6f2848cdbb83bbc0eda9549a46"}, - {file = "cdk_aws_lambda_powertools_layer-3.0.0-py3-none-any.whl", hash = "sha256:7574a149a1fd152404c9ee0114d4f24232336aa1b3ab7e8217b51fa0c14a1c9e"}, + {file = "cdk-aws-lambda-powertools-layer-3.0.1.tar.gz", hash = "sha256:fc6e3f8aa43ee82cd9131916dd06edeed98dc5880fdf71fef20bcd8295be7097"}, + {file = "cdk_aws_lambda_powertools_layer-3.0.1-py3-none-any.whl", hash = "sha256:4d5689cddfd16adf9f71a4d81bdea9483c49f09b76d9f2361ad1976575d151c4"}, ] colorama = [] constructs = [ - {file = "constructs-10.1.120-py3-none-any.whl", hash = "sha256:2dce2910f7012dadcc61faba92e9376a17b1052b6366b6ec666d889f2ac4a6b4"}, - {file = "constructs-10.1.120.tar.gz", hash = "sha256:39ed9156ab9508419a22a2d798c3b5c58e8e5c1c156d4c9f27e40fd7e87ea7c0"}, + {file = "constructs-10.1.123-py3-none-any.whl", hash = "sha256:a095dc34ac5d1ba582a6bd9364c2676d4c4de3d99466dc7cea0445ec4acdf226"}, + {file = "constructs-10.1.123.tar.gz", hash = "sha256:5f183f6c87ad755e96a0395aac043c0b4c1edd52e67e7c2b18affaf5f7eff284"}, ] exceptiongroup = [ {file = "exceptiongroup-1.0.0rc9-py3-none-any.whl", hash = "sha256:2e3c3fc1538a094aab74fad52d6c33fc94de3dfee3ee01f187c0e0c72aec5337"}, From 683784ff65f6950f3e7ed963c8da512f35e8d57e Mon Sep 17 00:00:00 2001 From: Heitor Lessa Date: Fri, 7 Oct 2022 13:54:54 +0200 Subject: [PATCH 29/36] chore(dep): add boto as optional dep This will help customers prototyping locally without SAM CLI --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index beabd0f8736..be0a83705a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ aws-xray-sdk = { version = "^2.8.0", optional = true } fastjsonschema = { version = "^2.14.5", optional = true } pydantic = { version = "^1.8.2", optional = true } email-validator = { version = "^1.3.0", optional = true } -jmespath = { version = "^1.0.1", optional = true } +boto3 = { version = "^1.20.32", optional = true } [tool.poetry.dev-dependencies] coverage = {extras = ["toml"], version = "^6.2"} From b7c07807f7f83e275c454199851c8b5788ed052b Mon Sep 17 00:00:00 2001 From: Heitor Lessa Date: Fri, 7 Oct 2022 13:55:52 +0200 Subject: [PATCH 30/36] chore(dep): add aws-sdk extras to ease local dev This is due to jmespath and boto in general not being available locally, if a customer doesn't depend on boto3 as a dep (uses runtime) --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index be0a83705a3..9a0f5a3ff38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,7 +80,8 @@ parser = ["pydantic", "email-validator"] validation = ["fastjsonschema"] tracer = ["aws-xray-sdk"] all = ["pydantic", "email-validator", "aws-xray-sdk", "fastjsonschema"] - +# allow customers to run code locally without emulators (SAM CLI, etc.) +aws-sdk = ["boto3"] [tool.coverage.run] source = ["aws_lambda_powertools"] omit = ["tests/*", "aws_lambda_powertools/exceptions/*", "aws_lambda_powertools/utilities/parser/types.py", "aws_lambda_powertools/utilities/jmespath_utils/envelopes.py"] From f61f03a399c1f1bb06f8954d9ac15cc286f6a636 Mon Sep 17 00:00:00 2001 From: Heitor Lessa Date: Fri, 7 Oct 2022 13:56:29 +0200 Subject: [PATCH 31/36] chore(typing): remove unnecessary optional type --- tests/e2e/utils/infrastructure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/utils/infrastructure.py b/tests/e2e/utils/infrastructure.py index eb96240b6a7..a73f2bb67d8 100644 --- a/tests/e2e/utils/infrastructure.py +++ b/tests/e2e/utils/infrastructure.py @@ -54,7 +54,7 @@ def __init__(self) -> None: ) def create_lambda_functions( - self, function_props: Optional[Dict] = None, architecture: Optional[Architecture] = Architecture.X86_64 + self, function_props: Optional[Dict] = None, architecture: Architecture = Architecture.X86_64 ) -> Dict[str, Function]: """Create Lambda functions available under handlers_dir From 8b4447c88c842404a2625ce4789b40226aefcbe7 Mon Sep 17 00:00:00 2001 From: Heitor Lessa Date: Fri, 7 Oct 2022 13:56:38 +0200 Subject: [PATCH 32/36] chore(typing): remove unnecessary optional type --- tests/e2e/utils/infrastructure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/utils/infrastructure.py b/tests/e2e/utils/infrastructure.py index a73f2bb67d8..67f2af623f8 100644 --- a/tests/e2e/utils/infrastructure.py +++ b/tests/e2e/utils/infrastructure.py @@ -67,7 +67,7 @@ def create_lambda_functions( function_props: Optional[Dict] Dictionary representing CDK Lambda FunctionProps to override defaults - architecture: Optional[Architecture] + architecture: Architecture Used to create Lambda Layer and functions in a different architecture. Defaults to x86_64. Returns From 978cba4c6b6b392e71c03b5e05d9216c5bd6473a Mon Sep 17 00:00:00 2001 From: Heitor Lessa Date: Fri, 7 Oct 2022 13:57:14 +0200 Subject: [PATCH 33/36] refactor: use more explicit name for intent --- tests/e2e/utils/lambda_layer/powertools_layer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/utils/lambda_layer/powertools_layer.py b/tests/e2e/utils/lambda_layer/powertools_layer.py index 9fba25e00fe..4aa934a97c2 100644 --- a/tests/e2e/utils/lambda_layer/powertools_layer.py +++ b/tests/e2e/utils/lambda_layer/powertools_layer.py @@ -61,7 +61,7 @@ def _has_source_changed(self) -> bool: return False - def _platform_name(self, architecture: Architecture) -> str: + def _resolve_platform(self, architecture: Architecture) -> str: """Returns the correct plaform name for the manylinux project (see PEP 599) Returns From 3286573468821a18e2d67827b4b761ba8894c0c9 Mon Sep 17 00:00:00 2001 From: Heitor Lessa Date: Fri, 7 Oct 2022 13:57:31 +0200 Subject: [PATCH 34/36] chore: use more explicit name --- tests/e2e/utils/lambda_layer/powertools_layer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/utils/lambda_layer/powertools_layer.py b/tests/e2e/utils/lambda_layer/powertools_layer.py index 4aa934a97c2..23eae521696 100644 --- a/tests/e2e/utils/lambda_layer/powertools_layer.py +++ b/tests/e2e/utils/lambda_layer/powertools_layer.py @@ -19,7 +19,7 @@ def __init__(self, output_dir: Path = CDK_OUT_PATH, architecture: Architecture = super().__init__(output_dir) self.package = f"{SOURCE_CODE_ROOT_PATH}[all]" - platform_name = self._platform_name(architecture) + platform_name = self._resolve_platform(architecture) self.build_args = f"--platform {platform_name} --only-binary=:all: --upgrade" self.build_command = f"python -m pip install {self.package} {self.build_args} --target {self.target_dir}" self.cleanup_command = ( From 9be0000c4882a0f46b39b9288da06ca0fa8f6e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Fri, 7 Oct 2022 13:58:08 +0200 Subject: [PATCH 35/36] chore: lock dependencies --- poetry.lock | 84 +++++++++++++++++++++++------------------------------ 1 file changed, 37 insertions(+), 47 deletions(-) diff --git a/poetry.lock b/poetry.lock index ef69fd378b1..696df3610b7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -90,11 +90,11 @@ yaml = ["pyyaml"] [[package]] name = "black" -version = "22.8.0" +version = "22.10.0" description = "The uncompromising code formatter." category = "dev" optional = false -python-versions = ">=3.6.2" +python-versions = ">=3.7" [package.dependencies] click = ">=8.0.0" @@ -113,14 +113,14 @@ uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "boto3" -version = "1.24.87" +version = "1.24.88" description = "The AWS SDK for Python" -category = "dev" +category = "main" optional = false python-versions = ">= 3.7" [package.dependencies] -botocore = ">=1.27.87,<1.28.0" +botocore = ">=1.27.88,<1.28.0" jmespath = ">=0.7.1,<2.0.0" s3transfer = ">=0.6.0,<0.7.0" @@ -129,7 +129,7 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.27.87" +version = "1.27.88" description = "Low-level, data-driven core of boto 3." category = "main" optional = false @@ -205,7 +205,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "constructs" -version = "10.1.123" +version = "10.1.124" description = "A programming model for software-defined state" category = "dev" optional = false @@ -479,7 +479,7 @@ smmap = ">=3.0.1,<6" [[package]] name = "gitpython" -version = "3.1.27" +version = "3.1.28" description = "GitPython is a python library used to interact with Git repositories" category = "dev" optional = false @@ -1210,7 +1210,7 @@ py = ">=1.4.26,<2.0.0" name = "s3transfer" version = "0.6.0" description = "An Amazon S3 Transfer Manager" -category = "dev" +category = "main" optional = false python-versions = ">= 3.7" @@ -1278,7 +1278,7 @@ doc = ["sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] [[package]] name = "types-requests" -version = "2.28.11.1" +version = "2.28.11.2" description = "Typing stubs for requests" category = "dev" optional = false @@ -1297,7 +1297,7 @@ python-versions = "*" [[package]] name = "typing-extensions" -version = "4.3.0" +version = "4.4.0" description = "Backported and Experimental Type Hints for Python 3.7+" category = "main" optional = false @@ -1373,6 +1373,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [extras] all = ["pydantic", "email-validator", "aws-xray-sdk", "fastjsonschema"] +aws-sdk = ["boto3"] parser = ["pydantic", "email-validator"] tracer = ["aws-xray-sdk"] validation = ["fastjsonschema"] @@ -1380,7 +1381,7 @@ validation = ["fastjsonschema"] [metadata] lock-version = "1.1" python-versions = "^3.7.4" -content-hash = "81bfd6a037da187ac628b5880dd3b351959e74b418ced37041d7cc3d4c45fb58" +content-hash = "4de2ae11dc9d1b41c4a8518ce4067703a2fe32bffd1c8729e37e9a03f3c20b67" [metadata.files] attrs = [ @@ -1405,37 +1406,26 @@ bandit = [ {file = "bandit-1.7.4.tar.gz", hash = "sha256:2d63a8c573417bae338962d4b9b06fbc6080f74ecd955a092849e1e65c717bd2"}, ] black = [ - {file = "black-22.8.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ce957f1d6b78a8a231b18e0dd2d94a33d2ba738cd88a7fe64f53f659eea49fdd"}, - {file = "black-22.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5107ea36b2b61917956d018bd25129baf9ad1125e39324a9b18248d362156a27"}, - {file = "black-22.8.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e8166b7bfe5dcb56d325385bd1d1e0f635f24aae14b3ae437102dedc0c186747"}, - {file = "black-22.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd82842bb272297503cbec1a2600b6bfb338dae017186f8f215c8958f8acf869"}, - {file = "black-22.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:d839150f61d09e7217f52917259831fe2b689f5c8e5e32611736351b89bb2a90"}, - {file = "black-22.8.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:a05da0430bd5ced89176db098567973be52ce175a55677436a271102d7eaa3fe"}, - {file = "black-22.8.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a098a69a02596e1f2a58a2a1c8d5a05d5a74461af552b371e82f9fa4ada8342"}, - {file = "black-22.8.0-cp36-cp36m-win_amd64.whl", hash = "sha256:5594efbdc35426e35a7defa1ea1a1cb97c7dbd34c0e49af7fb593a36bd45edab"}, - {file = "black-22.8.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a983526af1bea1e4cf6768e649990f28ee4f4137266921c2c3cee8116ae42ec3"}, - {file = "black-22.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3b2c25f8dea5e8444bdc6788a2f543e1fb01494e144480bc17f806178378005e"}, - {file = "black-22.8.0-cp37-cp37m-win_amd64.whl", hash = "sha256:78dd85caaab7c3153054756b9fe8c611efa63d9e7aecfa33e533060cb14b6d16"}, - {file = "black-22.8.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:cea1b2542d4e2c02c332e83150e41e3ca80dc0fb8de20df3c5e98e242156222c"}, - {file = "black-22.8.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5b879eb439094751185d1cfdca43023bc6786bd3c60372462b6f051efa6281a5"}, - {file = "black-22.8.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:0a12e4e1353819af41df998b02c6742643cfef58282915f781d0e4dd7a200411"}, - {file = "black-22.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c3a73f66b6d5ba7288cd5d6dad9b4c9b43f4e8a4b789a94bf5abfb878c663eb3"}, - {file = "black-22.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:e981e20ec152dfb3e77418fb616077937378b322d7b26aa1ff87717fb18b4875"}, - {file = "black-22.8.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8ce13ffed7e66dda0da3e0b2eb1bdfc83f5812f66e09aca2b0978593ed636b6c"}, - {file = "black-22.8.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:32a4b17f644fc288c6ee2bafdf5e3b045f4eff84693ac069d87b1a347d861497"}, - {file = "black-22.8.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0ad827325a3a634bae88ae7747db1a395d5ee02cf05d9aa7a9bd77dfb10e940c"}, - {file = "black-22.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53198e28a1fb865e9fe97f88220da2e44df6da82b18833b588b1883b16bb5d41"}, - {file = "black-22.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:bc4d4123830a2d190e9cc42a2e43570f82ace35c3aeb26a512a2102bce5af7ec"}, - {file = "black-22.8.0-py3-none-any.whl", hash = "sha256:d2c21d439b2baf7aa80d6dd4e3659259be64c6f49dfd0f32091063db0e006db4"}, - {file = "black-22.8.0.tar.gz", hash = "sha256:792f7eb540ba9a17e8656538701d3eb1afcb134e3b45b71f20b25c77a8db7e6e"}, + {file = "black-22.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14ff67aec0a47c424bc99b71005202045dc09270da44a27848d534600ac64fc7"}, + {file = "black-22.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:819dc789f4498ecc91438a7de64427c73b45035e2e3680c92e18795a839ebb66"}, + {file = "black-22.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8b49776299fece66bffaafe357d929ca9451450f5466e997a7285ab0fe28e3b"}, + {file = "black-22.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:21199526696b8f09c3997e2b4db8d0b108d801a348414264d2eb8eb2532e540d"}, + {file = "black-22.10.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1e464456d24e23d11fced2bc8c47ef66d471f845c7b7a42f3bd77bf3d1789650"}, + {file = "black-22.10.0-cp37-cp37m-win_amd64.whl", hash = "sha256:9311e99228ae10023300ecac05be5a296f60d2fd10fff31cf5c1fa4ca4b1988d"}, + {file = "black-22.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:915ace4ff03fdfff953962fa672d44be269deb2eaf88499a0f8805221bc68c87"}, + {file = "black-22.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:444ebfb4e441254e87bad00c661fe32df9969b2bf224373a448d8aca2132b395"}, + {file = "black-22.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:72ef3925f30e12a184889aac03d77d031056860ccae8a1e519f6cbb742736383"}, + {file = "black-22.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:432247333090c8c5366e69627ccb363bc58514ae3e63f7fc75c54b1ea80fa7de"}, + {file = "black-22.10.0-py3-none-any.whl", hash = "sha256:c957b2b4ea88587b46cf49d1dc17681c1e672864fd7af32fc1e9664d572b3458"}, + {file = "black-22.10.0.tar.gz", hash = "sha256:f513588da599943e0cde4e32cc9879e825d58720d6557062d1098c5ad80080e1"}, ] boto3 = [ - {file = "boto3-1.24.87-py3-none-any.whl", hash = "sha256:bcc579e801774cb2c7dda87ff985feda1ae7e10591d11ef37526363139138bd4"}, - {file = "boto3-1.24.87.tar.gz", hash = "sha256:3dd7ed74d1d29dd8094a078be86ed61c45de6638fe18856f7a1ff9282b4d929e"}, + {file = "boto3-1.24.88-py3-none-any.whl", hash = "sha256:6b4cf1cd0be65202c4cf0e4c69099bac3620bcd4049ca25a5e223c668401dd69"}, + {file = "boto3-1.24.88.tar.gz", hash = "sha256:93934343cac76084600a520e5be70c52152364d0c410681c2e25c2290f0e151c"}, ] botocore = [ - {file = "botocore-1.27.87-py3-none-any.whl", hash = "sha256:c4cbd22056ace4c7aa99e62e8ae629865ab80cc8bbf7c6d68ccf0f768f0034b6"}, - {file = "botocore-1.27.87.tar.gz", hash = "sha256:216de9751116d0d1cc3901e26d95a5c9a30ecb6973ae6147af1cf504858d845a"}, + {file = "botocore-1.27.88-py3-none-any.whl", hash = "sha256:de4e087b24cd3bc369eb2e27f8fe94a6499f7dea08c919fba13cefb2496bd2bb"}, + {file = "botocore-1.27.88.tar.gz", hash = "sha256:ded0a4035baf91eb358ef501c92a8512543f5ab7658f459df3077a70a555b5cd"}, ] cattrs = [] certifi = [ @@ -1456,8 +1446,8 @@ click = [ ] colorama = [] constructs = [ - {file = "constructs-10.1.123-py3-none-any.whl", hash = "sha256:a095dc34ac5d1ba582a6bd9364c2676d4c4de3d99466dc7cea0445ec4acdf226"}, - {file = "constructs-10.1.123.tar.gz", hash = "sha256:5f183f6c87ad755e96a0395aac043c0b4c1edd52e67e7c2b18affaf5f7eff284"}, + {file = "constructs-10.1.124-py3-none-any.whl", hash = "sha256:76ef2e6776cfdd1c4131a18b0e83c1b154d462b3ebb37ddbeaf3043b3b0de301"}, + {file = "constructs-10.1.124.tar.gz", hash = "sha256:5e4bfcca275867e5cfb4636ef65ed334c861a816f287ce1136f082ad0e0c1c2c"}, ] coverage = [ {file = "coverage-6.5.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ef8674b0ee8cc11e2d574e3e2998aea5df5ab242e012286824ea3c6970580e53"}, @@ -1575,8 +1565,8 @@ ghp-import = [ ] gitdb = [] gitpython = [ - {file = "GitPython-3.1.27-py3-none-any.whl", hash = "sha256:5b68b000463593e05ff2b261acff0ff0972df8ab1b70d3cdbd41b546c8b8fc3d"}, - {file = "GitPython-3.1.27.tar.gz", hash = "sha256:1c885ce809e8ba2d88a29befeb385fcea06338d3640712b59ca623c220bb5704"}, + {file = "GitPython-3.1.28-py3-none-any.whl", hash = "sha256:77bfbd299d8709f6af7e0c70840ef26e7aff7cf0c1ed53b42dd7fc3a310fcb02"}, + {file = "GitPython-3.1.28.tar.gz", hash = "sha256:6bd3451b8271132f099ceeaf581392eaf6c274af74bb06144307870479d0697c"}, ] idna = [ {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, @@ -1930,16 +1920,16 @@ typeguard = [ {file = "typeguard-2.13.3.tar.gz", hash = "sha256:00edaa8da3a133674796cf5ea87d9f4b4c367d77476e185e80251cc13dfbb8c4"}, ] types-requests = [ - {file = "types-requests-2.28.11.1.tar.gz", hash = "sha256:02b1806c5b9904edcd87fa29236164aea0e6cdc4d93ea020cd615ef65cb43d65"}, - {file = "types_requests-2.28.11.1-py3-none-any.whl", hash = "sha256:1ff2c1301f6fe58b5d1c66cdf631ca19734cb3b1a4bbadc878d75557d183291a"}, + {file = "types-requests-2.28.11.2.tar.gz", hash = "sha256:fdcd7bd148139fb8eef72cf4a41ac7273872cad9e6ada14b11ff5dfdeee60ed3"}, + {file = "types_requests-2.28.11.2-py3-none-any.whl", hash = "sha256:14941f8023a80b16441b3b46caffcbfce5265fd14555844d6029697824b5a2ef"}, ] types-urllib3 = [ {file = "types-urllib3-1.26.25.tar.gz", hash = "sha256:5aef0e663724eef924afa8b320b62ffef2c1736c1fa6caecfc9bc6c8ae2c3def"}, {file = "types_urllib3-1.26.25-py3-none-any.whl", hash = "sha256:c1d78cef7bd581e162e46c20a57b2e1aa6ebecdcf01fd0713bb90978ff3e3427"}, ] typing-extensions = [ - {file = "typing_extensions-4.3.0-py3-none-any.whl", hash = "sha256:25642c956049920a5aa49edcdd6ab1e06d7e5d467fc00e0506c44ac86fbfca02"}, - {file = "typing_extensions-4.3.0.tar.gz", hash = "sha256:e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6"}, + {file = "typing_extensions-4.4.0-py3-none-any.whl", hash = "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e"}, + {file = "typing_extensions-4.4.0.tar.gz", hash = "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa"}, ] urllib3 = [ {file = "urllib3-1.26.12-py2.py3-none-any.whl", hash = "sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997"}, From 2c563446524707aa37f4578b25ca052ccfa19cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Fonseca?= Date: Fri, 7 Oct 2022 14:43:25 +0200 Subject: [PATCH 36/36] chore: update cdk construct dependency --- layer/poetry.lock | 34 +++++++++++++++++----------------- layer/pyproject.toml | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/layer/poetry.lock b/layer/poetry.lock index 1d439cb7ad8..6720fc5b96a 100644 --- a/layer/poetry.lock +++ b/layer/poetry.lock @@ -28,14 +28,14 @@ typeguard = ">=2.13.3,<2.14.0" [[package]] name = "boto3" -version = "1.24.87" +version = "1.24.88" description = "The AWS SDK for Python" category = "dev" optional = false python-versions = ">= 3.7" [package.dependencies] -botocore = ">=1.27.87,<1.28.0" +botocore = ">=1.27.88,<1.28.0" jmespath = ">=0.7.1,<2.0.0" s3transfer = ">=0.6.0,<0.7.0" @@ -44,7 +44,7 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.27.87" +version = "1.27.88" description = "Low-level, data-driven core of boto 3." category = "dev" optional = false @@ -72,7 +72,7 @@ exceptiongroup = {version = "*", markers = "python_version <= \"3.10\""} [[package]] name = "cdk-aws-lambda-powertools-layer" -version = "3.0.1" +version = "3.1.0" description = "A lambda layer for AWS Powertools for python and typescript" category = "main" optional = false @@ -95,7 +95,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "constructs" -version = "10.1.123" +version = "10.1.124" description = "A programming model for software-defined state" category = "main" optional = false @@ -274,7 +274,7 @@ doc = ["sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] [[package]] name = "typing-extensions" -version = "4.3.0" +version = "4.4.0" description = "Backported and Experimental Type Hints for Python 3.7+" category = "main" optional = false @@ -296,7 +296,7 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "58c6dea4f27ff2c98dad77255fb56184d918596e188d3cc83e4227d2e4d4a15d" +content-hash = "cceb24edf99719274b946c811ad41ebbbdc0181593d4f07555c0977767cdd19a" [metadata.files] attrs = [ @@ -308,22 +308,22 @@ aws-cdk-lib = [ {file = "aws_cdk_lib-2.45.0-py3-none-any.whl", hash = "sha256:9463fe6d84563c4c23ae96810be0ea0ff0a260eebb85a4a7afe0c3747eca18a8"}, ] boto3 = [ - {file = "boto3-1.24.87-py3-none-any.whl", hash = "sha256:bcc579e801774cb2c7dda87ff985feda1ae7e10591d11ef37526363139138bd4"}, - {file = "boto3-1.24.87.tar.gz", hash = "sha256:3dd7ed74d1d29dd8094a078be86ed61c45de6638fe18856f7a1ff9282b4d929e"}, + {file = "boto3-1.24.88-py3-none-any.whl", hash = "sha256:6b4cf1cd0be65202c4cf0e4c69099bac3620bcd4049ca25a5e223c668401dd69"}, + {file = "boto3-1.24.88.tar.gz", hash = "sha256:93934343cac76084600a520e5be70c52152364d0c410681c2e25c2290f0e151c"}, ] botocore = [ - {file = "botocore-1.27.87-py3-none-any.whl", hash = "sha256:c4cbd22056ace4c7aa99e62e8ae629865ab80cc8bbf7c6d68ccf0f768f0034b6"}, - {file = "botocore-1.27.87.tar.gz", hash = "sha256:216de9751116d0d1cc3901e26d95a5c9a30ecb6973ae6147af1cf504858d845a"}, + {file = "botocore-1.27.88-py3-none-any.whl", hash = "sha256:de4e087b24cd3bc369eb2e27f8fe94a6499f7dea08c919fba13cefb2496bd2bb"}, + {file = "botocore-1.27.88.tar.gz", hash = "sha256:ded0a4035baf91eb358ef501c92a8512543f5ab7658f459df3077a70a555b5cd"}, ] cattrs = [] cdk-aws-lambda-powertools-layer = [ - {file = "cdk-aws-lambda-powertools-layer-3.0.1.tar.gz", hash = "sha256:fc6e3f8aa43ee82cd9131916dd06edeed98dc5880fdf71fef20bcd8295be7097"}, - {file = "cdk_aws_lambda_powertools_layer-3.0.1-py3-none-any.whl", hash = "sha256:4d5689cddfd16adf9f71a4d81bdea9483c49f09b76d9f2361ad1976575d151c4"}, + {file = "cdk-aws-lambda-powertools-layer-3.1.0.tar.gz", hash = "sha256:1e1457edbebfbb62ab2d21ae0f9b991db1b6c8508730fab8c99c3a7d3dfd99cb"}, + {file = "cdk_aws_lambda_powertools_layer-3.1.0-py3-none-any.whl", hash = "sha256:c66cc722c924a50458418600df4060a1396e134df25b3cc85de59d5914541b31"}, ] colorama = [] constructs = [ - {file = "constructs-10.1.123-py3-none-any.whl", hash = "sha256:a095dc34ac5d1ba582a6bd9364c2676d4c4de3d99466dc7cea0445ec4acdf226"}, - {file = "constructs-10.1.123.tar.gz", hash = "sha256:5f183f6c87ad755e96a0395aac043c0b4c1edd52e67e7c2b18affaf5f7eff284"}, + {file = "constructs-10.1.124-py3-none-any.whl", hash = "sha256:76ef2e6776cfdd1c4131a18b0e83c1b154d462b3ebb37ddbeaf3043b3b0de301"}, + {file = "constructs-10.1.124.tar.gz", hash = "sha256:5e4bfcca275867e5cfb4636ef65ed334c861a816f287ce1136f082ad0e0c1c2c"}, ] exceptiongroup = [ {file = "exceptiongroup-1.0.0rc9-py3-none-any.whl", hash = "sha256:2e3c3fc1538a094aab74fad52d6c33fc94de3dfee3ee01f187c0e0c72aec5337"}, @@ -365,8 +365,8 @@ typeguard = [ {file = "typeguard-2.13.3.tar.gz", hash = "sha256:00edaa8da3a133674796cf5ea87d9f4b4c367d77476e185e80251cc13dfbb8c4"}, ] typing-extensions = [ - {file = "typing_extensions-4.3.0-py3-none-any.whl", hash = "sha256:25642c956049920a5aa49edcdd6ab1e06d7e5d467fc00e0506c44ac86fbfca02"}, - {file = "typing_extensions-4.3.0.tar.gz", hash = "sha256:e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6"}, + {file = "typing_extensions-4.4.0-py3-none-any.whl", hash = "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e"}, + {file = "typing_extensions-4.4.0.tar.gz", hash = "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa"}, ] urllib3 = [ {file = "urllib3-1.26.12-py2.py3-none-any.whl", hash = "sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997"}, diff --git a/layer/pyproject.toml b/layer/pyproject.toml index 551cfcd7ebe..4b0cada589f 100644 --- a/layer/pyproject.toml +++ b/layer/pyproject.toml @@ -7,7 +7,7 @@ license = "MIT" [tool.poetry.dependencies] python = "^3.9" -cdk-aws-lambda-powertools-layer = "^3.0.0" +cdk-aws-lambda-powertools-layer = "^3.1.0" aws-cdk-lib = "^2.44.0" [tool.poetry.dev-dependencies]