Giter Site home page Giter Site logo

vincentsarago / lambda-pyskel Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 32 KB

Create skeleton of a python AWS Lambda function

License: BSD 3-Clause "New" or "Revised" License

Python 57.60% Dockerfile 30.49% Makefile 11.91%
python serverless rasterio gdal aws-lambda

lambda-pyskel's Introduction

lambda-pyskel

Create python AWS Lambda skeleton from templates.

Packaging status CircleCI codecov

Shameless inspiration from @sgillies https://github.com/mapbox/pyskel

Install

You can install lambda-pyskel using pip

$ pip install -U pip
$ pip install lambda-pyskel

or install from source:

$ git clone https://github.com/vincentsarago/lambda-pyskel.git
$ cd lambda-pyskel
$ pip install -U pip
$ pip install -e .

Templates

Three different templates are available:

  • simple: simple python lambda function
  • rasterio: include rasterio wheels
  • gdal: include custom gdal (2.4.1) installation from remotepixel docker image

Each templates has the following structure::

pyskel/                : main module
    __init__.py
    handler.py         : handler function
tests/                 : python tests
    test_handler.py
    test_mod.py
Dockerfile             : Dockerfile to create the package.zip
LICENSE                : BSD-2 license file
Makefile               : make commands to create/tests the packages
README.md             : Readme
setup.py               : Python setup
tox.ini                : tox template

Deployement Toolkit

In addition to python module templates, lambda-pyskel can also add configuration files for serverless or kes toolkit.

kes: http://devseed.com/kes/

serverless: https://serverless.com

Usage

$ lps --help
Usage: lps [OPTIONS] NAME

  Create new python AWS Lambda skeleton.

Options:
  --version                             Show the version and exit.
  --template [simple|rasterio|gdal]     Use specific template (default: 'simple')
  --serverless-toolkit [kes|serverless] Add deployement toolkit
  --help                                Show this message and exit.

Create a python lambda function with rasterio

$ lps yo --template rasterio
$ ls -1 yo
  Dockerfile
  LICENSE
  Makefile
  README.rst
  setup.py
  tests/
  tox.ini
  yo/

# edit yo/handler.py and setup.py
$ make build

Contribution & Devellopement

Issues and pull requests are more than welcome.

Dev install & Pull-Request

$ git clone https://github.com/vincentsarago/lambda-pyskel.git
$ cd lambda-pyskel
$ pip install -e .[dev]

Python3.6 only

This repo is set to use pre-commit to run flake8, pydocstring and black ("uncompromising Python code formatter") when committing new code.

$ pre-commit install
$ git add .
$ git commit -m'my change'
black....................................................................Passed
Flake8...................................................................Passed
Verifying PEP257 Compliance..............................................Passed
$ git push origin

lambda-pyskel's People

Contributors

vincentsarago avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lambda-pyskel's Issues

UnicodeDecodeError: 'gbk' codec can't decode byte 0x8a in position 8: illegal multibyte sequence

Hi @vincentsarago ,
thank you for providing this script for zip package
I met this following issue, and it still occured after I had added encoding='utf-8' in line 32 in cli.py
(python36) C:\Users\Makeone>lps Bob --template gdal
Traceback (most recent call last):
File "c:\users\makeone\anaconda3\envs\python36\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\users\makeone\anaconda3\envs\python36\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\Makeone\Anaconda3\envs\python36\Scripts\lps.exe_main
.py", line 9, in
File "c:\users\makeone\anaconda3\envs\python36\lib\site-packages\click\core.py", line 764, in call
return self.main(*args, **kwargs)
File "c:\users\makeone\anaconda3\envs\python36\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\users\makeone\anaconda3\envs\python36\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\makeone\anaconda3\envs\python36\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\users\makeone\anaconda3\envs\python36\lib\site-packages\lambda_pyskel\scripts\cli.py", line 32, in create
s = f.read().replace("pyskel", name)
UnicodeDecodeError: 'gbk' codec can't decode byte 0xdb in position 8: illegal multibyte sequence

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.