Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/zappagh-879-add-url-decoding-for-qu…
Browse files Browse the repository at this point in the history
…ery-string
  • Loading branch information
choich authored Aug 17, 2021
2 parents 4c159fc + bb5834f commit 73d8fd4
Show file tree
Hide file tree
Showing 55 changed files with 6,493 additions and 4,187 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Before you submit this PR, please make sure that you meet these criteria:
* Did you read the [contributing guide](https://github.com/Miserlou/Zappa/#contributing)?
* Did you read the [contributing guide](https://github.com/zappa/Zappa/#contributing)?
* If this is a non-trivial commit, did you **open a ticket** for discussion?
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ parts/
sdist/
var/
*.egg-info/
venv/
.installed.cfg
*.egg

Expand Down
32 changes: 16 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ python:
- "3.7"
- "3.8"
dist: xenial
addons:
apt:
packages:
- cmake
# command to install dependencies
cache:
- pip
install:
- "pip install --upgrade pip; pip install --upgrade setuptools; pip install -r test_requirements.txt; pip install -e git+https://github.com/django/django-contrib-comments.git#egg=django-contrib-comments; python setup.py install"
# command to run tests
env:
- TESTCASE=tests/tests_docs.py
- TESTCASE=tests/test_handler.py
- TESTCASE=tests/tests_middleware.py
- TESTCASE=tests/tests_placebo.py
- TESTCASE=tests/tests_async.py
- TESTCASE=tests/tests.py
before_script:
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- make requirements
- python setup.py install

script:
- nosetests $TESTCASE --with-coverage --cover-package=zappa --with-timer
# - coverage combine --append
- make flake
- make black-check
- make test-docs
- make test-handler
- make test-middleware
- make test-placebo
- make test-async
- make test-general

after_success:
coveralls
notifications:
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Zappa Changelog

## 0.53.0

* Deprecated ACME v1 for Lets Encrypt
* Global black formatting
* Update & deploy using a docker container
* See [blog post](https://ianwhitestone.work/zappa-serverless-docker/) for more details on the current functionality and how it works
* See [PR](https://github.com/zappa/Zappa/pull/967) or [original issue](https://github.com/Miserlou/Zappa/issues/2188) for discussion around what is currently supported & next steps


## 0.52.0
* Remove dateutil version restriction
* Fix failed downloads of wheel packages with non-alphanumeric characters
Expand Down
73 changes: 73 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

help:
@echo 'Zappa Make Targets'
@echo '-----------------------'
@echo 'These targets are aimed at making development, testing, and building easier'
@echo ''
@echo 'Setup'
@echo 'make clean: Remove the built files, local caches, mypy and coverage information'
@echo 'make requirements: Generate requirements from requirements.in and install them to the current environment'
@echo 'make build: Build the source and wheel'
@echo ''
@echo 'Linting'
@echo 'make flake: Flake8 checking'
@echo 'make mypy: Run static type checking for zappa and tests directories'
@echo 'make isort: Sort imports'
@echo 'make black: Format project code according to Black convention'
@echo ''
@echo 'Testing'
@echo 'make tests: Run all project tests. Additional make targets exist for subsets of the tests. Inspect the Makefile for details'

.PHONY: clean requirements build flake mypy isort black tests

clean:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
rm -rf .mypy_cache dist build *.egg-info
rm -f .coverage

requirements:
./requirements.sh
pip install -r requirements.txt
pip install -r test_requirements.txt

build: clean requirements-install
python setup.py sdist
python setup.py bdist_wheel

mypy:
mypy --show-error-codes --pretty --ignore-missing-imports --strict zappa tests

black:
black zappa tests

black-check:
black zappa tests --check
@echo "If this fails, simply run: make black"

isort:
isort --recursive .

flake:
flake8 zappa --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 zappa --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

test-docs:
nosetests tests/tests_docs.py --with-coverage --cover-package=zappa --with-timer

test-handler:
nosetests tests/test_handler.py --with-coverage --cover-package=zappa --with-timer

test-middleware:
nosetests tests/tests_middleware.py --with-coverage --cover-package=zappa --with-timer

test-placebo:
nosetests tests/tests_placebo.py --with-coverage --cover-package=zappa --with-timer

test-async:
nosetests tests/tests_async.py --with-coverage --cover-package=zappa --with-timer

test-general:
nosetests tests/tests.py --with-coverage --cover-package=zappa --with-timer

tests: clean test-docs test-handler test-middleware test-placebo test-async test-general
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

## Zappa - Serverless Python

[![Build Status](https://travis-ci.org/Miserlou/Zappa.svg)](https://travis-ci.org/Miserlou/Zappa)
[![Coverage](https://img.shields.io/coveralls/Miserlou/Zappa.svg)](https://coveralls.io/github/Miserlou/Zappa)
[![Build Status](https://travis-ci.org/zappa/Zappa.svg)](https://travis-ci.org/zappa/Zappa)
[![Coverage](https://img.shields.io/coveralls/zappa/Zappa.svg)](https://coveralls.io/github/zappa/Zappa)
[![PyPI](https://img.shields.io/pypi/v/Zappa.svg)](https://pypi.python.org/pypi/zappa)
[![Slack](https://img.shields.io/badge/chat-slack-ff69b4.svg)](https://zappateam.slack.com/)
[![Gun.io](https://img.shields.io/badge/made%20by-gun.io-blue.svg)](https://gun.io/)
Expand All @@ -21,6 +21,7 @@
- [Basic Usage](#basic-usage)
- [Initial Deployments](#initial-deployments)
- [Updates](#updates)
- [Docker Workflows](#docker-workflows)
- [Rollback](#rollback)
- [Scheduling](#scheduling)
- [Advanced Scheduling](#advanced-scheduling)
Expand Down Expand Up @@ -200,7 +201,7 @@ Once your settings are configured, you can package and deploy your application t

And now your app is **live!** How cool is that?!

To explain what's going on, when you call `deploy`, Zappa will automatically package up your application and local virtual environment into a Lambda-compatible archive, replace any dependencies with versions [precompiled for Lambda](https://github.com/Miserlou/lambda-packages), set up the function handler and necessary WSGI Middleware, upload the archive to S3, create and manage the necessary Amazon IAM policies and roles, register it as a new Lambda function, create a new API Gateway resource, create WSGI-compatible routes for it, link it to the new Lambda function, and finally delete the archive from your S3 bucket. Handy!
To explain what's going on, when you call `deploy`, Zappa will automatically package up your application and local virtual environment into a Lambda-compatible archive, replace any dependencies with versions with wheels compatible with lambda, set up the function handler and necessary WSGI Middleware, upload the archive to S3, create and manage the necessary Amazon IAM policies and roles, register it as a new Lambda function, create a new API Gateway resource, create WSGI-compatible routes for it, link it to the new Lambda function, and finally delete the archive from your S3 bucket. Handy!

Be aware that the default IAM role and policy created for executing Lambda applies a liberal set of permissions.
These are most likely not appropriate for production deployment of important applications. See the section
Expand All @@ -216,6 +217,10 @@ If your application has already been deployed and you only need to upload new Py

This creates a new archive, uploads it to S3 and updates the Lambda function to use the new code, but doesn't touch the API Gateway routes.

#### Docker Workflows

In [version 0.53.0](https://github.com/zappa/Zappa/blob/master/CHANGELOG.md), support was added to deploy & update Lambda functions using Docker. Refer to [the blog post](https://ianwhitestone.work/zappa-serverless-docker/) for more details about how to leverage this functionality, and when you may want to.

### Rollback

You can also `rollback` the deployed code to a previous version by supplying the number of revisions to return to. For instance, to rollback to the version deployed 3 versions ago:
Expand Down Expand Up @@ -319,7 +324,6 @@ During this process, it will replace any local dependencies with AWS Lambda comp

* Lambda-compatible `manylinux` wheels from a local cache
* Lambda-compatible `manylinux` wheels from PyPI
* Lambda-specific versions from [lambda-package](https://github.com/Miserlou/lambda-packages)
* Packages from the active virtual environment
* Packages from the local project directory

Expand Down Expand Up @@ -446,11 +450,11 @@ Amazon provides their own free alternative to Let's Encrypt called [AWS Certific

#### Deploying to a Domain With a Let's Encrypt Certificate (DNS Auth)

If you want to use Zappa on a domain with a free Let's Encrypt certificate using automatic Route 53 based DNS Authentication, you can follow [this handy guide](https://github.com/Miserlou/Zappa/blob/master/docs/domain_with_free_ssl_dns.md).
If you want to use Zappa on a domain with a free Let's Encrypt certificate using automatic Route 53 based DNS Authentication, you can follow [this handy guide](https://github.com/zappa/Zappa/blob/master/docs/domain_with_free_ssl_dns.md).

#### Deploying to a Domain With a Let's Encrypt Certificate (HTTP Auth)

If you want to use Zappa on a domain with a free Let's Encrypt certificate using HTTP Authentication, you can follow [this guide](https://github.com/Miserlou/Zappa/blob/master/docs/domain_with_free_ssl_http.md).
If you want to use Zappa on a domain with a free Let's Encrypt certificate using HTTP Authentication, you can follow [this guide](https://github.com/zappa/Zappa/blob/master/docs/domain_with_free_ssl_http.md).

However, it's now far easier to use Route 53-based DNS authentication, which will allow you to use a Let's Encrypt certificate with a single `$ zappa certify` command.

Expand Down Expand Up @@ -645,7 +649,7 @@ And that's it! Your API response will return immediately, while the `make_pie` f

When calls to @task decorated functions or the zappa.asynchronous.run command occur outside of Lambda, such as your local dev environment,
the functions will execute immediately and locally. The zappa asynchronous functionality only works
when in the Lambda environment or when specifying [Remote Invocations](https://github.com/Miserlou/zappa#remote-invocations).
when in the Lambda environment or when specifying [Remote Invocations](https://github.com/zappa/zappa#remote-invocations).

### Catching Exceptions
Putting a try..except block on an asynchronous task like this:
Expand Down Expand Up @@ -1486,7 +1490,6 @@ Are you using Zappa? Let us know and we'll list your site here!

## Related Projects

* [lambda-packages](http://github.com/Miserlou/lambda-packages) - Precompiled C-extension packages for AWS Lambda. Used automatically by Zappa.
* [Mackenzie](http://github.com/Miserlou/Mackenzie) - AWS Lambda Infection Toolkit
* [NoDB](https://github.com/Miserlou/NoDB) - A simple, server-less, Pythonic object store based on S3.
* [zappa-cms](http://github.com/Miserlou/zappa-cms) - A tiny server-less CMS for busy hackers. Work in progress.
Expand Down Expand Up @@ -1527,9 +1530,9 @@ This project is still young, so there is still plenty to be done. Contributions

Please file tickets for discussion before submitting patches. Pull requests should target `master` and should leave Zappa in a "shippable" state if merged.

If you are adding a non-trivial amount of new code, please include a functioning test in your PR. For AWS calls, we use the `placebo` library, which you can learn to use [in their README](https://github.com/garnaat/placebo#usage-as-a-decorator). The test suite will be run by [Travis CI](https://travis-ci.org/Miserlou/Zappa) once you open a pull request.
If you are adding a non-trivial amount of new code, please include a functioning test in your PR. For AWS calls, we use the `placebo` library, which you can learn to use [in their README](https://github.com/garnaat/placebo#usage-as-a-decorator). The test suite will be run by [Travis CI](https://travis-ci.org/zappa/Zappa) once you open a pull request.

Please include the GitHub issue or pull request URL that has discussion related to your changes as a comment in the code ([example](https://github.com/Miserlou/Zappa/blob/fae2925431b820eaedf088a632022e4120a29f89/zappa/zappa.py#L241-L243)). This greatly helps for project maintainability, as it allows us to trace back use cases and explain decision making. Similarly, please make sure that you meet all of the requirements listed in the [pull request template](https://raw.githubusercontent.com/Miserlou/Zappa/master/.github/PULL_REQUEST_TEMPLATE.md).
Please include the GitHub issue or pull request URL that has discussion related to your changes as a comment in the code ([example](https://github.com/zappa/Zappa/blob/fae2925431b820eaedf088a632022e4120a29f89/zappa/zappa.py#L241-L243)). This greatly helps for project maintainability, as it allows us to trace back use cases and explain decision making. Similarly, please make sure that you meet all of the requirements listed in the [pull request template](https://raw.githubusercontent.com/zappa/Zappa/master/.github/PULL_REQUEST_TEMPLATE.md).

Please feel free to work on any open ticket, especially any ticket marked with the "help-wanted" label. If you get stuck or want to discuss an issue further, please join [our Slack channel](https://zappateam.slack.com/), where you'll find a community of smart and interesting people working dilligently on hard problems.

Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
argcomplete
boto3
boto3>=1.17.28
durationpy
hjson
jmespath
Expand Down
1 change: 1 addition & 0 deletions requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if [ "$1" == "--upgrade" ]; then
ARGS="-U"
fi

pip install -U pip-tools
pip-compile ${ARGS} -o test_requirements.txt requirements.in test_requirements.in
cp test_requirements.txt requirements.txt
pip-compile -o requirements.txt requirements.in
112 changes: 82 additions & 30 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,88 @@
#
# pip-compile --output-file=requirements.txt requirements.in
#
argcomplete==1.11.1 # via -r requirements.in
boto3==1.14.2 # via -r requirements.in, kappa
botocore==1.17.2 # via boto3, s3transfer
certifi==2020.4.5.2 # via requests
cfn-flip==1.2.3 # via troposphere
chardet==3.0.4 # via requests
click==7.1.2 # via cfn-flip, kappa, pip-tools
docutils==0.15.2 # via botocore
durationpy==0.5 # via -r requirements.in
future==0.18.2 # via -r requirements.in
hjson==3.0.1 # via -r requirements.in
idna==2.9 # via requests
jmespath==0.10.0 # via -r requirements.in, boto3, botocore
kappa==0.6.0 # via -r requirements.in
pip-tools==5.2.1 # via -r requirements.in
placebo==0.9.0 # via kappa
python-dateutil==2.8.1 # via -r requirements.in, botocore
python-slugify==4.0.0 # via -r requirements.in
pyyaml==5.3.1 # via -r requirements.in, cfn-flip, kappa
requests==2.23.0 # via -r requirements.in
s3transfer==0.3.3 # via boto3
six==1.15.0 # via -r requirements.in, cfn-flip, pip-tools, python-dateutil
text-unidecode==1.3 # via python-slugify
toml==0.10.1 # via -r requirements.in
tqdm==4.46.1 # via -r requirements.in
troposphere==2.6.1 # via -r requirements.in
urllib3==1.25.9 # via botocore, requests
werkzeug==0.16.1 # via -r requirements.in
wheel==0.34.2 # via -r requirements.in
wsgi-request-logger==0.4.6 # via -r requirements.in
argcomplete==1.12.2
# via -r requirements.in
boto3==1.17.44
# via
# -r requirements.in
# kappa
botocore==1.20.44
# via
# boto3
# s3transfer
certifi==2020.12.5
# via requests
cfn-flip==1.2.3
# via troposphere
chardet==4.0.0
# via requests
click==7.1.2
# via
# cfn-flip
# kappa
# pip-tools
durationpy==0.5
# via -r requirements.in
future==0.18.2
# via -r requirements.in
hjson==3.0.2
# via -r requirements.in
idna==2.10
# via requests
jmespath==0.10.0
# via
# -r requirements.in
# boto3
# botocore
kappa==0.6.0
# via -r requirements.in
pep517==0.10.0
# via pip-tools
pip-tools==6.0.1
# via -r requirements.in
placebo==0.9.0
# via kappa
python-dateutil==2.8.1
# via
# -r requirements.in
# botocore
python-slugify==4.0.1
# via -r requirements.in
pyyaml==5.4.1
# via
# -r requirements.in
# cfn-flip
# kappa
requests==2.25.1
# via -r requirements.in
s3transfer==0.3.6
# via boto3
six==1.15.0
# via
# -r requirements.in
# cfn-flip
# python-dateutil
text-unidecode==1.3
# via python-slugify
toml==0.10.2
# via
# -r requirements.in
# pep517
tqdm==4.59.0
# via -r requirements.in
troposphere==2.7.0
# via -r requirements.in
urllib3==1.26.4
# via
# botocore
# requests
werkzeug==0.16.1
# via -r requirements.in
wheel==0.36.2
# via -r requirements.in
wsgi-request-logger==0.4.6
# via -r requirements.in

# The following packages are considered to be unsafe in a requirements file:
# pip
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
description='Server-less Python Web Services for AWS Lambda and API Gateway',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/Miserlou/Zappa',
url='https://github.com/zappa/Zappa',
author='Rich Jones',
author_email='rich@openwatch.net',
entry_points={
Expand Down
5 changes: 4 additions & 1 deletion test_requirements.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
black
boto3-stubs
coveralls
Django
django-stubs
flake8
Flask
mock
mypy
nose
nose-timer
placebo
isort

Loading

0 comments on commit 73d8fd4

Please sign in to comment.