FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

firejdl/serverless-python-requirements: Serverless plugin to bundle Python packages · GitHub

 
 

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless Python Requirements

A Serverless v1.0 plugin to automatically bundle dependencies from requirements.txt.

Install

npm install --save serverless-python-requirements

Add the plugin to your serverless.yml:

plugins:
  - serverless-python-requirements

Adding the dependencies to sys.path

serverless-python-requirements adds a module called requirements to your puck. To easily make the bundled dependencies available, simply import it. Eg. add this to the top of any file using dependencies specified in your requirements.txt:

import requirements
# Now you can use deps you specified in requirements.txt!
import requests

Cross compiling!

Compiling non-pure-Python modules is supported on MacOS via the use of Docker and the docker-lambda image. To enable docker usage, add the following to your serverless.yml:

custom:
  dockerizePip: true

Limitations

  • if using the package directive in serverless.yml ensure that .requirements and requirements.py are included.

Manual invocations

The .requirements and requirements.py files are left behind to simplify development. To clean them up, run sls requirements clean. You can also install them manually for local development with sls requirements install.

Credit

This plugin is influenced by serverless-wsgi from @logandk. I however wanted a simpler pip install process. It now also supports bundling packages without the wsgi handler.

About

Serverless plugin to bundle Python packages

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages


Back | FazBrowse Home | New Git URL