This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A Command extension to setuptools that allows building an AWS Lamba dist and uploading to S3

Project Description

Simply add setup_requires=['lambda_setuptools'] as an attribute to your setup.py file

This extension adds two new commands to setuptools:

  1. ldist
    • Usage: ldist
      • Effect: This will build (using bdist_wheel) and install your package, along with all of the dependencies in install_requires
        • It is highly recommended that you DO NOT include boto3 or botocore in your install_requires dependencies as these are provided by the AWS Lambda environment. Include them at your own peril!
        • The result will be in dist/[your-package-name]-[version].zip (along with your wheel)
  2. lupload
    • Usage: lupload --access-key=<my_access_key> --secret-access-key=<my_secret> --s3-bucket=<my_S3_bucket> --kms-key-id=<my_KMS_key> --s3-prefix=<my_S3_key_prefix>
      • Effect: This will build (using ldist) and upload the resulting ZIP file to the specified S3 bucket
        • kms-key-id is optional. If it is not provided, standard AES256 encryption will be used
        • s3-prefix is optional. If it is not provided, the ZIP file will be uploaded to the root of the S3 bucket

This extension also adds three new attributes to the setup() function:

  1. lambda_function
    • Usage: lambda_function=<my_package>.<some_module>:<some_function>
    • Effect: ldist will create a root-level python module named *_function.py* where package_name is derived from the name attribute. This created module will simply redefine your lambda handler function at the root-level
  2. lambda_module
    • Usage: lambda_module=<some_module>
    • Effect: ldist adds the named module to the list of py_modules to install, normally at the root level
  3. lambda_package
    • Usage: lambda_package=<some_dir>
    • Effect: ldist will copy the contents of the provided directory into the root level of the resulting lambda distribution. The provided directory MUST NOT have an *__init__.py* in it (e.g. - it can’t be a real package)

All ldist attributes can be used in the same setup() call. It is up to the user to ensure that you don’t step all over yourself…

Note that all other commands and attributes in setup.py will still work the way you expect them to.

Enjoy!

Release History

Release History

This version
History Node

0.1.6

History Node

0.1.5

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
lambda_setuptools-0.1.6-py2.py3-none-any.whl (8.3 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Jul 18, 2017
lambda-setuptools-0.1.6.tar.gz (5.3 kB) Copy SHA256 Checksum SHA256 Source Jul 18, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting