From b25f5f00f957f46ef4da5b9e80de002ac487af9c Mon Sep 17 00:00:00 2001 From: erm Date: Sun, 3 May 2020 21:58:11 +1000 Subject: [PATCH 01/11] Testing requirements --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 3e1234bb..f27d564e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,6 +14,7 @@ psycopg2 redis testing.postgresql testing.redis +sqlalchemy # Docs mkdocs From e553b15a6c22538d71123110bf032d51dfc03cc2 Mon Sep 17 00:00:00 2001 From: erm Date: Sun, 3 May 2020 22:11:58 +1000 Subject: [PATCH 02/11] 0.9.0b1 pre-release --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index eb0be8a5..31e52885 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ def get_long_description(): setup( name="mangum", - version="0.8.0", + version="0.9.0b1", packages=find_packages(), license="MIT", url="https://github.com/erm/mangum", From 2376246bb5e1b8092da2e14a532ab0d381ccaa3f Mon Sep 17 00:00:00 2001 From: erm Date: Sun, 3 May 2020 22:19:31 +1000 Subject: [PATCH 03/11] Mkdocs --- mkdocs.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index 7d009f20..11439a91 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,21 +1,20 @@ site_name: Mangum -site_description: Serverless ASGI +site_description: AWS Lambda & API Gateway support for ASGI theme: name: 'material' palette: primary: 'brown' accent: 'orange' - logo: - icon: 'cloud' - repo_name: erm/mangum repo_url: https://github.com/erm/mangum edit_uri: "" nav: - - Introduction: 'index.md' + - Introduction: 'introduction.md' + - HTTP: 'http.md' + - WebSockets: 'websockets.md' markdown_extensions: - markdown.extensions.codehilite: From 57840b2c175cfd05658f1c2a57b0928dfce55e57 Mon Sep 17 00:00:00 2001 From: erm Date: Sun, 3 May 2020 22:26:23 +1000 Subject: [PATCH 04/11] Link docs in README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f65818e4..15f4ff4d 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ Mangum is an adapter for using [ASGI](https://asgi.readthedocs.io/en/latest/) applications with AWS Lambda & API Gateway. It is intended to provide an easy-to-use, configurable wrapper for any ASGI application deployed in an AWS Lambda function to handle API Gateway requests and responses. +***Documentation***: https://erm.github.io/mangum + ## Features - API Gateway support for [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api.html), [REST](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.html), and [WebSocket](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html) APIs. From 2b208418b0a6517490dae401efa5f3bfa1a6216b Mon Sep 17 00:00:00 2001 From: erm Date: Sun, 3 May 2020 22:36:18 +1000 Subject: [PATCH 05/11] Fix docs link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 15f4ff4d..9a4e3f28 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Mangum is an adapter for using [ASGI](https://asgi.readthedocs.io/en/latest/) applications with AWS Lambda & API Gateway. It is intended to provide an easy-to-use, configurable wrapper for any ASGI application deployed in an AWS Lambda function to handle API Gateway requests and responses. -***Documentation***: https://erm.github.io/mangum +***Documentation***: https://erm.github.io/mangum/introduction/ ## Features From 77ce2485d55eee2218204df673c8d53cccd4def5 Mon Sep 17 00:00:00 2001 From: erm Date: Sun, 3 May 2020 22:38:07 +1000 Subject: [PATCH 06/11] Docs fix --- docs/websockets.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/websockets.md b/docs/websockets.md index df1a2ee1..7deef33b 100644 --- a/docs/websockets.md +++ b/docs/websockets.md @@ -196,7 +196,7 @@ If a `uri` is not supplied, then the following parameters are required: ### Redis -The `RedisBackend` requires (redis-py)[https://github.com/andymccurdy/redis-py] and access to a Redis server. +The `RedisBackend` requires [redis-py](https://github.com/andymccurdy/redis-py) and access to a Redis server. #### Configuration From b6f836542cd400d2606c71ed1289338196e73ed4 Mon Sep 17 00:00:00 2001 From: erm Date: Sun, 3 May 2020 22:49:01 +1000 Subject: [PATCH 07/11] Docs --- docs/introduction.md | 6 ++++-- docs/websockets.md | 13 +++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/introduction.md b/docs/introduction.md index f65818e4..8f11f305 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -1,12 +1,14 @@ # Mangum - Package version + Package version Build Status -PyPI - Python Version + + PyPI - Python Version + Mangum is an adapter for using [ASGI](https://asgi.readthedocs.io/en/latest/) applications with AWS Lambda & API Gateway. It is intended to provide an easy-to-use, configurable wrapper for any ASGI application deployed in an AWS Lambda function to handle API Gateway requests and responses. diff --git a/docs/websockets.md b/docs/websockets.md index 7deef33b..1e359e85 100644 --- a/docs/websockets.md +++ b/docs/websockets.md @@ -38,7 +38,7 @@ handler = Mangum( ##### Required -- `ws_config` : ***dict*** (default=None) +- `ws_config` : **dict** Configuration mapping for a supported WebSocket backend. @@ -48,6 +48,11 @@ The following required values need to be defined inside the `ws_config`: Name of data source backend to use. + +- `params` : **str** *(required)* + + The required and optional arguments provided to a specific backend. + The following backends are currently supported: - `dynamodb` @@ -56,10 +61,6 @@ The following backends are currently supported: - `redis` - `sqlite3` (for local debugging) -- `params` : **str** *(required)* - - The required and optional arguments provided to a specific backend. - ##### Optional The following optional values may be defined inside the `ws_config`: @@ -159,7 +160,7 @@ handler = Mangum( ##### Required -- `uri`: ***str*** *(required)* +- `uri`: **str** *(required)* The connection string for the remote database. If a `uri` is not supplied, then the following parameters are required: From 43bd8b641bac6d4be9853757f88d71b95244d4d3 Mon Sep 17 00:00:00 2001 From: erm Date: Sun, 3 May 2020 22:51:08 +1000 Subject: [PATCH 08/11] More docs --- docs/websockets.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/websockets.md b/docs/websockets.md index 1e359e85..290a8d79 100644 --- a/docs/websockets.md +++ b/docs/websockets.md @@ -49,9 +49,9 @@ The following required values need to be defined inside the `ws_config`: Name of data source backend to use. -- `params` : **str** *(required)* +- `params` : **dict** *(required)* - The required and optional arguments provided to a specific backend. + Parameter mapping of required and optional arguments for the specified backend. The following backends are currently supported: @@ -183,15 +183,15 @@ If a `uri` is not supplied, then the following parameters are required: ##### Optional -- `port` : **str** (default="5432") +- `port` : **str** (default=`5432`) Port number for Postgres database connection. -- `connect_timeout` **int** (default=5) +- `connect_timeout` **int** (default=`5`) Timeout for database connection. -- `table_name` **str (default="connection") +- `table_name` **str (default=`"connection"`) Table name to use to store WebSocket connections. @@ -223,7 +223,7 @@ handler = Mangum( ##### Optional -- `port` : **str** (default="6379") +- `port` : **str** (default=`6379`) Port number for Redis server. From 4bafeb338bc92c01b47c89d8f0a65c81cca6dc50 Mon Sep 17 00:00:00 2001 From: erm Date: Sun, 3 May 2020 23:41:03 +1000 Subject: [PATCH 09/11] Clarify release for WS --- README.md | 8 +++++--- docs/introduction.md | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9a4e3f28..2e029641 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,13 @@ pip install mangum You can install the required dependencies for the WebSocket backends with one the following: ```shell -pip install mangum[aws] -pip install mangum[postgresql] -pip install mangum[redis] +pip install mangum[aws]==0.9.0b1 +pip install mangum[postgresql]==0.9.0b1 +pip install mangum[redis]==0.9.0b1 ``` +**Note**: WebSocket support is currently available only in the pre-release version `0.9.0b1`. + ## Usage The `Mangum` adapter class is designed to wrap any ASGI application, accepting various configuration options, returning a callable. It can wrap an application and be assigned to the handler: diff --git a/docs/introduction.md b/docs/introduction.md index 8f11f305..eb64856b 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -39,11 +39,13 @@ pip install mangum You can install the required dependencies for the WebSocket backends with one the following: ```shell -pip install mangum[aws] -pip install mangum[postgresql] -pip install mangum[redis] +pip install mangum[aws]==0.9.0b1 +pip install mangum[postgresql]==0.9.0b1 +pip install mangum[redis]==0.9.0b1 ``` +**Note**: WebSocket support is currently available only in the pre-release version `0.9.0b1`. + ## Usage The `Mangum` adapter class is designed to wrap any ASGI application, accepting various configuration options, returning a callable. It can wrap an application and be assigned to the handler: From 403a9556fdbba6ed9358415b4b6ede4e78d05806 Mon Sep 17 00:00:00 2001 From: erm Date: Mon, 4 May 2020 00:12:42 +1000 Subject: [PATCH 10/11] Docs --- docs/http.md | 2 +- docs/websockets.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/http.md b/docs/http.md index 4a364ca1..18905438 100644 --- a/docs/http.md +++ b/docs/http.md @@ -20,7 +20,7 @@ The adapter class accepts the following optional arguments: Specify whether or not to enable lifespan support. The adapter will automatically determine if lifespan is supported by the framework unless explicitly disabled. -- `log_level` : **str** (default="info") +- `log_level` : **str** (default=`"info"`) Level parameter for the logger. diff --git a/docs/websockets.md b/docs/websockets.md index 290a8d79..cba7cb27 100644 --- a/docs/websockets.md +++ b/docs/websockets.md @@ -38,7 +38,7 @@ handler = Mangum( ##### Required -- `ws_config` : **dict** +- `ws_config` : **dict** *(required)* Configuration mapping for a supported WebSocket backend. @@ -67,7 +67,7 @@ The following optional values may be defined inside the `ws_config`: - `api_gateway_endpoint_url` : **str** - The endpoint url to use in API Gateway Management API calls.. This is useful if you are debugging locally with a package such as [serverless-dynamodb-local](https://github.com/99xt/serverless-dynamodb-local). + The endpoint url to use in API Gateway Management API calls. This is useful if you are debugging locally with a package such as [serverless-offline](https://github.com/dherault/serverless-offline). - `api_gateway_region_name` : **str** @@ -75,7 +75,7 @@ The following optional values may be defined inside the `ws_config`: ### DynamoDB -The `DynamoDBStorageBackend` uses a [DynamoDB](https://aws.amazon.com/dynamodb/) table to store the connection details. +The `DynamoDBackend` uses a [DynamoDB](https://aws.amazon.com/dynamodb/) table to store the connection details. #### Configuration @@ -109,7 +109,7 @@ handler = Mangum( ### S3 -The `S3Backend` uses an (S3)[https://aws.amazon.com/s3/](https://aws.amazon.com/s3/)] bucket as a key-value store to store the connection details. +The `S3Backend` uses an [Amazon S3](https://aws.amazon.com/s3/](https://aws.amazon.com/s3/) bucket as a key-value store to store the connection details. #### Configuration From 29c14d6b76bda4143bec59eb268da2e341904fa9 Mon Sep 17 00:00:00 2001 From: erm Date: Mon, 4 May 2020 00:28:11 +1000 Subject: [PATCH 11/11] Docs --- docs/websockets.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/websockets.md b/docs/websockets.md index cba7cb27..891da677 100644 --- a/docs/websockets.md +++ b/docs/websockets.md @@ -139,7 +139,7 @@ handler = Mangum( ### PostgreSQL -The `PostgreSQLBackend` requires (psycopg2)[https://github.com/psycopg/psycopg2] and access to a remote PostgreSQL database. +The `PostgreSQLBackend` requires [psycopg2](https://github.com/psycopg/psycopg2) and access to a remote PostgreSQL database. #### Configuration @@ -231,7 +231,7 @@ handler = Mangum( Password for Redis server. -### SQlite3 +### SQLite The `sqlite3` backend uses a local [sqlite3](https://docs.python.org/3/library/sqlite3.html) database to store connection. It is intended for ***local*** debugging (with a package such as [Serverless Offline](https://github.com/dherault/serverless-offline)) and will ***not*** work in an AWS Lambda deployment.