Skip to content

Commit

Permalink
feature: sync to Cookbook v6.0.0 python 3.13 (#28)
Browse files Browse the repository at this point in the history
Co-authored-by: Ran Isenberg <ran.isenberg@ranthebuilder.cloud>
  • Loading branch information
ran-isenberg and Ran Isenberg authored Nov 14, 2024
1 parent ee5736c commit 21fc5f0
Show file tree
Hide file tree
Showing 10 changed files with 727 additions and 725 deletions.
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# AWS Serverless service cookiecutter (Python)

[![license](https://img.shields.io/github/license/ran-isenberg/cookiecutter-serverless-python)](https://github.com/ran-isenberg/cookiecutter-serverless-python/blob/master/LICENSE)
![PythonSupport](https://img.shields.io/static/v1?label=python&message=3.12&color=blue?style=flat-square&logo=python)
![PythonSupport](https://img.shields.io/static/v1?label=python&message=3.13&color=blue?style=flat-square&logo=python)
![version](https://img.shields.io/github/v/release/ran-isenberg/cookiecutter-serverless-python)
![github-star-badge](https://img.shields.io/github/stars/ran-isenberg/cookiecutter-serverless-python.svg?style=social)
![issues](https://img.shields.io/github/issues/ran-isenberg/cookiecutter-serverless-python)
Expand All @@ -11,24 +11,14 @@

This project can serve as a cookiecutter template for new Serverless services - CDK deployment code, pipeline and handler are covered with best practices built in.
<br></br>
The project is based on my [AWS Lambda Cookbook template project](https://github.com/ran-isenberg/aws-lambda-handler-cookbook) and synced to version 4.5.1:
The project is based on my [AWS Lambda Cookbook template project](https://github.com/ran-isenberg/aws-lambda-handler-cookbook):

[![license](https://img.shields.io/github/license/ran-isenberg/aws-lambda-handler-cookbook)](https://github.com/ran-isenberg/aws-lambda-handler-cookbook/blob/master/LICENSE)
![PythonSupport](https://img.shields.io/static/v1?label=python&message=3.11&color=blue?style=flat-square&logo=python)
[![codecov](https://codecov.io/gh/ran-isenberg/aws-lambda-handler-cookbook/branch/main/graph/badge.svg?token=P2K7K4KICF)](https://codecov.io/gh/ran-isenberg/aws-lambda-handler-cookbook)
![version](https://img.shields.io/github/v/release/ran-isenberg/aws-lambda-handler-cookbook)
![github-star-badge](https://img.shields.io/github/stars/ran-isenberg/aws-lambda-handler-cookbook.svg?style=social)
![issues](https://img.shields.io/github/issues/ran-isenberg/aws-lambda-handler-cookbook)


**[📜Documentation](https://ran-isenberg.github.io/aws-lambda-handler-cookbook/)** | **[Blogs website](https://www.ranthebuilder.cloud)**
> **Contact details | ran.isenberg@ranthebuilder.cloud**
<br></br>
## **Prerequisites**

* **Docker** - install [Docker](https://www.docker.com/). Required for the Lambda layer packaging process.
* **[AWS CDK](cdk.md)** - Required for synth & deploying the AWS Cloudformation stack.
* Python 3.12
* Python 3.13
* [poetry](https://pypi.org/project/poetry/) - Make sure to run ``poetry config --local virtualenvs.in-project true`` so all dependencies are installed in the project '.venv' folder.
* For Windows based machines, use the Makefile_windows version (rename to Makefile). Default Makefile is for Mac/Linux.
* Cookiecutter - install with pip/brew ``brew install cookiecutter`` or ``pip install cookiecutter``
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ permissions:

env:
NODE_VERSION: "20"
PYTHON_VERSION: "3.12"
PYTHON_VERSION: "3.13"
AWS_REGION: "us-east-1"

on:
Expand All @@ -34,16 +34,16 @@ jobs:
BRANCH_NAME: ${{ github.ref }}
REPO_NAME: ${{ github.repository }}
- name: Check out repository code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "poetry" # NOTE: poetry must be installed before this step, or else cache doesn't work
- name: Set up Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
env:
ENVIRONMENT: staging # Custom environment variable
- name: Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
Expand Down Expand Up @@ -100,16 +100,16 @@ jobs:
BRANCH_NAME: ${{ github.ref }}
REPO_NAME: ${{ github.repository }}
- name: Check out repository code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "poetry" # NOTE: poetry must be installed before this step, or else cache doesn't work
- name: Set up Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
Expand Down Expand Up @@ -139,13 +139,13 @@ jobs:
if: contains('refs/heads/main', github.ref)
steps:
- name: Check out repository code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ permissions:

env:
NODE_VERSION: "20"
PYTHON_VERSION: "3.12"
PYTHON_VERSION: "3.13"
AWS_REGION: "us-east-1"

on:
Expand All @@ -31,11 +31,11 @@ jobs:
BRANCH_NAME: ${{ github.ref }}
REPO_NAME: ${{ github.repository }}
- name: Check out repository code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "poetry" # NOTE: poetry must be installed before this step, or else cache doesn't work
Expand All @@ -55,16 +55,16 @@ jobs:
id-token: write # required for requesting the JWT (GitHub OIDC)
steps:
- name: Check out repository code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "poetry" # NOTE: poetry must be installed before this step, or else cache doesn't work
- name: Set up Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
Expand All @@ -87,7 +87,7 @@ jobs:
# NOTE: these run unit and integration tests
# we can look into coverage collection only later to make it faster and less brittle (--collect-only)
- name: Check OpenAPI Spec breaking action
uses: oasdiff/oasdiff-action/breaking@a2ff6682b27d175162a74c09ace8771bd3d512f8 # v0.0.16
uses: oasdiff/oasdiff-action/breaking@1c611ffb1253a72924624aa4fb662e302b3565d3 # v0.0.16
with:
base: https://raw.githubusercontent.com/ran-isenberg/aws-lambda-handler-cookbook/main/docs/swagger/openapi.json
revision: ./docs/swagger/openapi.json
Expand All @@ -96,7 +96,7 @@ jobs:
- name: Code coverage tests
run: make coverage-tests
- name: Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
exclude: "^(?!helpers/)"
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.8
rev: v0.7.3
hooks:
# Run the Ruff linter.
- id: ruff
Expand Down
24 changes: 12 additions & 12 deletions {{cookiecutter.repo_name}}/cdk/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
here = path.abspath(path.dirname(__file__))

setup(
name='{{cookiecutter.service_name}}-cdk',
version='3.1',
description='CDK code for deploying the serverless service',
name="{{cookiecutter.service_name}}-cdk",
version="3.1",
description="CDK code for deploying the serverless service",
classifiers=[
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'Programming Language :: Python :: 3.12',
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"Programming Language :: Python :: 3.13",
],
url='https://github.com/ran-isenberg/aws-lambda-handler-cookbook',
author='{{cookiecutter.author}}',
author_email='{{cookiecutter.email}}',
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
package_data={'': ['*.json']},
url="https://github.com/ran-isenberg/aws-lambda-handler-cookbook",
author="{{cookiecutter.author}}",
author_email="{{cookiecutter.email}}",
packages=find_packages(exclude=["contrib", "docs", "tests"]),
package_data={"": ["*.json"]},
include_package_data=True,
python_requires='>=3.12',
python_requires=">=3.13",
install_requires=[],
)
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _build_common_layer(self) -> PythonLayerVersion:
self,
f'{self.id_}{constants.LAMBDA_LAYER_NAME}',
entry=constants.COMMON_LAYER_BUILD_FOLDER,
compatible_runtimes=[_lambda.Runtime.PYTHON_3_12],
compatible_runtimes=[_lambda.Runtime.PYTHON_3_13],
removal_policy=RemovalPolicy.DESTROY,
)

Expand All @@ -117,7 +117,7 @@ def _add_post_lambda_integration(
lambda_function = _lambda.Function(
self,
constants.CREATE_LAMBDA,
runtime=_lambda.Runtime.PYTHON_3_12,
runtime=_lambda.Runtime.PYTHON_3_13,
code=_lambda.Code.from_asset(constants.BUILD_FOLDER),
handler='{{cookiecutter.service_name}}.handlers.handle_create_order.lambda_handler',
environment={
Expand Down
10 changes: 6 additions & 4 deletions {{cookiecutter.repo_name}}/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dependencies": {
"aws-cdk": "2.160.0"
"aws-cdk": "2.167.0"
}
}
Loading

0 comments on commit 21fc5f0

Please sign in to comment.