Skip to content

Commit be8c0bf

Browse files
authored
Merge branch 'master' into feature/lambda_qualifier
2 parents a6a04f8 + e7d5bc9 commit be8c0bf

20 files changed

+1034
-513
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,37 @@
11
<!--- Provide a general summary of the issue in the Title above -->
2+
23
## Context
4+
35
<!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug -->
4-
<!--- Also, please make sure that you are running Zappa _from a virtual environment_ and are using Python 3.8/3.9/3.10/3.11/3.12 -->
6+
<!--- Also, please make sure that you are running Zappa _from a virtual environment_ and are using Python 3.8/3.9/3.10/3.11/3.12/3.13 -->
57

68
## Expected Behavior
9+
710
<!--- Tell us what should happen -->
811

912
## Actual Behavior
13+
1014
<!--- Tell us what happens instead -->
1115

1216
## Possible Fix
17+
1318
<!--- Not obligatory, but suggest a fix or reason for the bug -->
1419

1520
## Steps to Reproduce
21+
1622
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
1723
<!--- reproduce this bug include code to reproduce, if relevant -->
24+
1825
1.
1926
2.
2027
3.
2128

2229
## Your Environment
30+
2331
<!--- Include as many relevant details about the environment you experienced the bug in -->
24-
* Zappa version used:
25-
* Operating System and Python version:
26-
* The output of `pip freeze`:
27-
* Link to your project (optional):
28-
* Your `zappa_settings.json`:
32+
33+
- Zappa version used:
34+
- Operating System and Python version:
35+
- The output of `pip freeze`:
36+
- Link to your project (optional):
37+
- Your `zappa_settings.json`:

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Before you submit this PR, please make sure that you meet these criteria:
2020
2121
* Did you **make sure this code actually works on Lambda**, as well as locally?
2222
23-
* Did you test this code with all of: **Python 3.8**, **Python 3.9**, **Python 3.10**, **Python 3.11**, and **Python 3.12**?
23+
* Did you test this code with all of: **Python 3.8**, **Python 3.9**, **Python 3.10**, **Python 3.11**, **Python 3.12**, and **Python 3.13**?
2424
2525
* Does this commit ONLY relate to the issue at hand and have your linter shit all over the code?
2626
@@ -31,9 +31,10 @@ Thank you for your contribution!
3131
-->
3232

3333
## Description
34-
<!-- Please describe the changes included in this PR -->
34+
35+
<!-- Please describe the changes included in this PR -->
3536

3637
## GitHub Issues
38+
3739
<!-- Proposed changes should be discussed in an issue before submitting a PR. -->
3840
<!-- Link to relevant tickets here. -->
39-

.github/workflows/ci.yml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: CI
22

3-
on: # yamllint disable-line rule:truthy
3+
on: # yamllint disable-line rule:truthy
44
pull_request:
55
branches: ["master"]
66
push:
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
14+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1515
steps:
1616
- name: Checkout Code Repository
1717
uses: actions/checkout@v4
@@ -26,29 +26,34 @@ jobs:
2626
restore-keys: ${{ runner.os }}-pip${{ matrix.python }}-
2727
- name: make sure we have version tags
2828
run: git fetch --unshallow --tags
29-
- name: Setup Virtualenv
30-
run: python -m venv .venv
31-
- name: Install
32-
run: source .venv/bin/activate && make requirements && python setup.py install
33-
- name: Lint
34-
run: source .venv/bin/activate && make flake black-check isort-check
29+
- name: Install pipenv
30+
run: python -m pip install --upgrade pip pipenv
31+
- name: Setup/install dependencies (pipenv)
32+
run: python -m pipenv install --dev
33+
- name: Lint (flake/black/isort)
34+
run: pipenv run make flake black-check isort-check
3535
- name: Test
36-
run: source .venv/bin/activate && make tests
37-
- name: Upload Coverage
38-
run: .venv/bin/coveralls --service=github
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
COVERALLS_FLAG_NAME: py${{ matrix.python }}
42-
COVERALLS_PARALLEL: true
43-
COVERALLS_SERVICE_JOB_ID: ${{ github.run_id }}
36+
run: pipenv run make tests
37+
- name: Coveralls Parallel
38+
uses: coverallsapp/github-action@v2
39+
with:
40+
github-token: ${{ secrets.GITHUB_TOKEN }}
41+
flag-name: py${{ matrix.python }}
42+
parallel: true
43+
format: cobertura
44+
debug: true
4445

4546
coverage:
4647
needs: test
4748
runs-on: ubuntu-latest
4849
steps:
4950
- name: Set up Python
5051
uses: actions/setup-python@v5
51-
- name: Finalise Coverage
52-
run: pip3 install --upgrade coveralls && coveralls --service=github --finish
53-
env:
54-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
- name: Coveralls Finished
53+
uses: coverallsapp/github-action@v2
54+
with:
55+
github-token: ${{ secrets.GITHUB_TOKEN }}
56+
parallel-finished: true
57+
format: cobertura
58+
carryforward: "run-3.9,run-3.10,run-3.11,run-3.12,run-3.13"
59+
debug: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,5 +262,6 @@ Temporary Items
262262
##########################
263263

264264
*.zip
265+
*-slim-handler-*.tar.gz
265266
README.test.md
266267
zappa_settings.json

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
- id: isort
1313
args: [--profile=black, --gitignore]
1414
- repo: https://github.com/psf/black
15-
rev: 24.1.1
15+
rev: 24.8.0
1616
hooks:
1717
- id: black
1818
args: [--line-length=127]

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ tests:
9191
tests/tests_async.py \
9292
tests/tests.py \
9393
tests/tests_utilities.py \
94-
--cov=zappa
94+
--cov=zappa \
95+
--cov-report=xml \
9596
--durations=0
9697

Pipfile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7-
black = "==24.1.1"
7+
black = "==24.8.0"
88
boto3-stubs = "*"
99
coveralls = "*"
10-
Django = "<4"
10+
django = ">=4.2,<6"
1111
django-stubs = "*"
1212
flake8 = "==7.0.0"
1313
Flask = "*"
@@ -18,6 +18,7 @@ packaging = "*"
1818
pre-commit = "*"
1919
pytest = "*"
2020
pytest-cov = "*"
21+
legacy-cgi = "*"
2122

2223
[packages]
2324
argcomplete = "*"
@@ -26,20 +27,18 @@ durationpy = "*"
2627
hjson = "*"
2728
jmespath = "*"
2829
kappa = "==0.6.0"
29-
pip = ">=9.0.1"
30-
# Workaround until tests are updated to work with 'placebo' 0.10
31-
# Move to 'dev-packages' when unpinned
30+
pip = ">=24.0.0"
3231
placebo = "<0.10"
3332
python-dateutil = "*"
3433
python-slugify = "*"
3534
PyYAML = "*"
36-
# previous versions don't work with urllib3 1.24
37-
requests = ">=2.20.0"
35+
requests = ">=2.32.0"
3836
toml = "*"
39-
tqdm = "*"
37+
tqdm = ">=4.66.3"
4038
troposphere = ">=3.0"
4139
Werkzeug = "*"
4240
wheel = "*"
41+
setuptools = "<80.0.0"
4342

4443
[pipenv]
4544
allow_prereleases = false

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
8080
- [Endpoint Configuration](#endpoint-configuration)
8181
- [Example Private API Gateway configuration](#example-private-api-gateway-configuration)
8282
- [Cold Starts (Experimental)](#cold-starts-experimental)
83+
- [Lambda Test Console Usage](#lambda-test-console-usage)
84+
- [`raw_command`](#raw_command)
85+
- [`manage`](#manage)
8386
- [Zappa Guides](#zappa-guides)
8487
- [Zappa in the Press](#zappa-in-the-press)
8588
- [Sites Using Zappa](#sites-using-zappa)
@@ -133,7 +136,7 @@ And finally, Zappa is **super easy to use**. You can deploy your application wit
133136

134137
## Installation and Configuration
135138

136-
_Before you begin, make sure you are running Python 3.8/3.9/3.10/3.11/3.12 and you have a valid AWS account and your [AWS credentials file](https://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs) is properly installed._
139+
_Before you begin, make sure you are running Python 3.8/3.9/3.10/3.11/3.12/3.13 and you have a valid AWS account and your [AWS credentials file](https://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs) is properly installed._
137140

138141
**Zappa** can easily be installed through pip, like so:
139142

@@ -444,7 +447,7 @@ For instance, suppose you have a basic application in a file called "my_app.py",
444447

445448
Any remote print statements made and the value the function returned will then be printed to your local console. **Nifty!**
446449

447-
You can also invoke interpretable Python 3.8/3.9/3.10/3.11/3.12 strings directly by using `--raw`, like so:
450+
You can also invoke interpretable Python 3.8/3.9/3.10/3.11/3.12/3.13 strings directly by using `--raw`, like so:
448451

449452
$ zappa invoke production "print(1 + 2 + 3)" --raw
450453

@@ -848,7 +851,7 @@ Example:
848851

849852
```python
850853
from zappa.asynchronous import task, get_async_response
851-
from flask import Flask, make_response, abort, url_for, redirect, request, jsonify
854+
from flask import Flask, abort, url_for, redirect, request, jsonify
852855
from time import sleep
853856

854857
app = Flask(__name__)
@@ -905,6 +908,7 @@ to change Zappa's behavior. Use these at your own risk!
905908
"assume_policy": "my_assume_policy.json", // optional, IAM assume policy JSON file
906909
"attach_policy": "my_attach_policy.json", // optional, IAM attach policy JSON file
907910
"apigateway_policy": "my_apigateway_policy.json", // optional, API Gateway resource policy JSON file
911+
"architecture": "x86_64", // optional, Set Lambda Architecture, defaults to x86_64. For Graviton 2 use: arm64
908912
"async_source": "sns", // Source of async tasks. Defaults to "lambda"
909913
"async_resources": true, // Create the SNS topic and DynamoDB table to use. Defaults to true.
910914
"async_response_table": "your_dynamodb_table_name", // the DynamoDB table name to use for captured async responses; defaults to None (can't capture)
@@ -1003,7 +1007,7 @@ to change Zappa's behavior. Use these at your own risk!
10031007
"role_name": "MyLambdaRole", // Name of Zappa execution role. Default <project_name>-<env>-ZappaExecutionRole. To use a different, pre-existing policy, you must also set manage_roles to false.
10041008
"role_arn": "arn:aws:iam::12345:role/app-ZappaLambdaExecutionRole", // ARN of Zappa execution role. Default to None. To use a different, pre-existing policy, you must also set manage_roles to false. This overrides role_name. Use with temporary credentials via GetFederationToken.
10051009
"route53_enabled": true, // Have Zappa update your Route53 Hosted Zones when certifying with a custom domain. Default true.
1006-
"runtime": "python3.12", // Python runtime to use on Lambda. Can be one of: "python3.8", "python3.9", "python3.10", "python3.11", or "python3.12". Defaults to whatever the current Python being used is.
1010+
"runtime": "python3.13", // Python runtime to use on Lambda. Can be one of: "python3.8", "python3.9", "python3.10", "python3.11", "python3.12", or "python3.13". Defaults to whatever the current Python being used is.
10071011
"s3_bucket": "dev-bucket", // Zappa zip bucket,
10081012
"slim_handler": false, // Useful if project >50M. Set true to just upload a small handler to Lambda and load actual project from S3 at runtime. Default false.
10091013
"snap_start": "PublishedVersions", // Enable Lambda SnapStart for faster cold starts. Can be "PublishedVersions" or "None". Default "None".
@@ -1531,6 +1535,37 @@ apigateway_resource_policy.json:
15311535

15321536
Lambda may provide additional resources than provisioned during cold start initialization. Set `INSTANTIATE_LAMBDA_HANDLER_ON_IMPORT=True` to instantiate the lambda handler on import. This is an experimental feature - if startup time is critical, look into using Provisioned Concurrency.
15331537

1538+
### Lambda Test Console Usage
1539+
1540+
The zappa lambda handler allows zappa commands can be initiated from the Lambda Test Console by providing the associated JSON payload.
1541+
1542+
#### `raw_command`
1543+
1544+
`raw_command` allows you to execute arbitrary python code in the context of your Zappa application.
1545+
This is useful for testing or debugging purposes.
1546+
1547+
> **Warning**: This is a powerful feature and should be used with caution.
1548+
> It can execute any code in your application context, including potentially harmful commands.
1549+
1550+
Example:
1551+
```json
1552+
{
1553+
"raw_command": "from myapp import my_function;x = my_function();print(x)"
1554+
}
1555+
```
1556+
1557+
#### `manage`
1558+
1559+
Django `manage` commands are also supported.
1560+
You can run any Django management command using the `manage` key in the payload.
1561+
1562+
Example:
1563+
```json
1564+
{
1565+
"manage": "migrate"
1566+
}
1567+
```
1568+
15341569
## Zappa Guides
15351570

15361571
- [Django-Zappa tutorial (screencast)](https://www.youtube.com/watch?v=plUrbPN0xc8&feature=youtu.be).

setup.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,47 +14,40 @@
1414
required = [
1515
"{}{}".format(name, version.strip('"')) if version != '"*"' else name for name, version in pipfile["packages"].items()
1616
]
17-
test_required = [
18-
"{}{}".format(name, version.strip('"')) if version != '"*"' else name for name, version in pipfile["dev-packages"].items()
19-
]
2017

2118
setup(
2219
name="zappa",
2320
version=__version__,
2421
packages=["zappa"],
2522
install_requires=required,
26-
python_requires=">=3.8",
27-
tests_require=test_required,
23+
python_requires=">=3.9",
2824
include_package_data=True,
2925
license="MIT License",
3026
description="Server-less Python Web Services for AWS Lambda and API Gateway",
3127
long_description=long_description,
3228
long_description_content_type="text/markdown",
33-
url="https://zappa.ws/zappa",
29+
url="https://github.com/zappa/Zappa",
3430
author="Rich Jones",
3531
author_email="[email protected]",
36-
maintainer="Alex DelVecchio",
37-
maintainer_email="[email protected]",
3832
entry_points={
3933
"console_scripts": [
4034
"zappa=zappa.cli:handle",
4135
"z=zappa.cli:handle",
42-
]
36+
],
4337
},
4438
classifiers=[
4539
"Environment :: Console",
4640
"License :: OSI Approved :: Apache Software License",
4741
"Operating System :: OS Independent",
4842
"Programming Language :: Python",
49-
"Programming Language :: Python :: 3.8",
5043
"Programming Language :: Python :: 3.9",
5144
"Programming Language :: Python :: 3.10",
5245
"Programming Language :: Python :: 3.11",
5346
"Programming Language :: Python :: 3.12",
47+
"Programming Language :: Python :: 3.13",
5448
"Framework :: Django",
55-
"Framework :: Django :: 3.2",
5649
"Framework :: Django :: 4.2",
57-
"Framework :: Django :: 5.0",
50+
"Framework :: Django :: 5.2",
5851
"Topic :: Internet :: WWW/HTTP",
5952
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
6053
],

test_settings.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,19 @@
142142
"delete_local_zip": true,
143143
"binary_support": true,
144144
"additional_text_mimetypes": ["application/custommimetype"]
145-
}
145+
},
146+
"arch_arm64": {
147+
"s3_bucket": "lmbda",
148+
"app_function": "tests.test_app.hello_world",
149+
"delete_local_zip": true,
150+
"debug": true,
151+
"architecture": "arm64"
152+
},
153+
"archfail": {
154+
"s3_bucket": "lmbda",
155+
"app_function": "tests.test_app.hello_world",
156+
"delete_local_zip": true,
157+
"debug": true,
158+
"architecture": "invalid_architecture"
159+
}
146160
}

0 commit comments

Comments
 (0)