lampip: Simple CLI tool for creating python custom lambda layers
Features
-
Build Python(3.7, 3.8, 3.9)-compatible custom lambda layers using Docker and pip, and push it to AWS.
-
Reduce the package size using some approachs.
- Byte-Compile (that remove source comments and docstrings).
- Remove
*.dist-info.
Requirements
- Python3
- Docker
- AWS Account
Installation
You can obtain this packages using pip.
$ pip3 install lampip
Then you can use lampip command.
$ lampip --help
Usage: lampip [OPTIONS] COMMAND [ARGS]...
Simple CLI tool for creating python custom lambda layers
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
deploy Build and push lambda layer
new Create the scaffold
Usage
At the first create the scaffold
$ lampip new science
Go to the generated directory
$ cd science
$ ls
lampip-config.toml other_resources requirements.txt
Edit requirements.txt
numpy
scipy
pandas
Edit lampip-config.toml
[lampip]
layername = "science"
description = "numpy, scipy, and pandas"
pyversions = ["3.7", "3.8", "3.9"]
[lampip.shrink]
compile = true
compile_optimize_level = 2
remove_dist_info = true
# [lampip.shrink.plotly]
# remove_jupyterlab_plotly = true
# remove_data_docs = true
Before you deploy the lambda layer, be sure you have AWS credentials configured.
(If you do not configure AWS credentials yet, ...)
$ aws configure
AWS Access Key ID: ?????
AWS Secret Acess Key: ?????
Default region name: ?????
(Option) You can switch the aws credentials using environments variables.
(Case1: Using AWS CLI profile)
$ export AWS_PROFILE="subaccount"
(Case2: Using AWS access key directly)
$ export AWS_ACCESS_KEY_ID=????
$ export AWS_SECRET_ACCESS_KEY=?????
$ export AWS_DEFAULT_REGION=?????
Deploy
$ lampip deploy
Start to make dist/science_1631253196_3.7.zip
...
Publish the custom layer: arn:aws:lambda:ap-northeast-1:XXXXXXXXXXXX:layer:science-py38:1
DONE: dist/science_1631253312_3.8.zip created
$ ls -lh dist
-rw-r--r-- 1 root root 73M 9月 10 23:54 science_1631253254_3.7.zip
-rw-r--r-- 1 root root 73M 9月 10 23:55 science_1631253312_3.8.zip
...
(The --no-upload option suppress uploading zip files)
$ lampip deploy --no-upload
Then you can check deployed layers on AWS Console.
Metadata
Release files for lampip 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lampip-0.3.0.tar.gz | 7.8 kB | Without provenance | Details for lampip-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lampip-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for lampip-0.3.0-py3-none-any.whl |
Total release size: 16.8 kB
Release files / lampip-0.3.0.tar.gz
| Download URL | lampip-0.3.0.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ba167f01f423f1ee4df71246a243fe4b5912da7eb3b52a8e3b3d66b5b953d4f
|
|
BLAKE2b-256 checksum How to use checksums |
532077120c073c38fceeb86d3cc6641112ffa6e8c5480c21c2c5c06c1b2445a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.8.2 Linux/5.15.0-1030-azure
|
Release files / lampip-0.3.0-py3-none-any.whl
| Download URL | lampip-0.3.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25da01d70e18b98b16f8566aa2c455a900ba78e1067b7aa4d57e987d32ead95a
|
|
BLAKE2b-256 checksum How to use checksums |
5ef17daa793e2a75a8a9a725706f391526f3a7f1248d19ea91f5511cb2d76593
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.8.2 Linux/5.15.0-1030-azure
|
Security for lampip 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.