Skip to content

Commit

Permalink
words
Browse files Browse the repository at this point in the history
  • Loading branch information
dschep committed Dec 23, 2017
1 parent 139d1b1 commit 589a905
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 4 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017-present, Daniel Schep

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 12 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ Install
pip install git+https://github.com/dschep/lambda-decorators


Why
===

Initially, I was inspired by middy which I’ve tried out in JavaScript
and was happy with it. So naturally, I thought I’d like to have
something similar in Python too. But then as I thought about it more,
it seemed that when thinking of functions as the compute unit, when
using python, decorators pretty much are middleware! So instead of
building a middleware engine and a few middlewares, I just built a few
useful decorators.


Included Decorators:
====================

Expand Down
30 changes: 26 additions & 4 deletions lambda_decorators.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# -*- coding: utf-8 -*-
"""
lambda_decorators
=================
🐍λ✨ - lambda_decorators
=========================
🐍λ✨ - A collection of useful decorators for making AWS Lambda handlers
A collection of useful decorators for making AWS Lambda handlers
NOTE: this is in very early stages of development.
*NOTE: this is in very early stages of development.*
``lambda_decorators`` is a collection of useful decorators for writing Python
handlers for `AWS Lambda <https://aws.amazon.com/lambda/>`_. They allow you to
avoid boiler plate for common things such as CORS headers, JSON serialization,
etc.
These can be used as a library or simply copied and adapted to your needs.
If you want to write your own "middlewares" it's as easy as writing a
decorator. The documentation has links to the source of each decorator.
They also serve as handy examples for implemenenting your own
boilerplate-reducing decorators.
Quick example
-------------
Expand All @@ -27,6 +38,17 @@ def handler(event, context):
pip install git+https://github.com/dschep/lambda-decorators
Why
---
Initially, I was inspired by `middy <https://github.com/middyjs/middy>`_ which
I've tried out in JavaScript and was happy with it. So naturally, I thought I'd
like to have something similar in Python too. But then as I thought about it
more, it seemed that when thinking of functions as the compute unit,
when using python, `decorators <https://wiki.python.org/moin/PythonDecorators>`_
pretty much are middleware! So instead of
building a middleware engine and a few middlewares, I just built a few
useful decorators.
Included Decorators:
--------------------
* :meth:`async_handler` - support for async handlers
Expand Down

0 comments on commit 589a905

Please sign in to comment.