lampip


Namelampip JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/hayashiya18/lampip
SummarySimple CLI tool for creating custom python lambda layers
upload_time2023-01-15 07:55:51
maintainer
docs_urlNone
authorhayashiya18
requires_python>=3.6,<4.0
licenseMIT
keywords aws lambda layer
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # lampip: Simple CLI tool for creating python custom lambda layers

[![image](https://img.shields.io/pypi/l/lampip)](https://python.org/pypi/lampip)
[![image](https://img.shields.io/pypi/v/lampip)](https://python.org/pypi/lampip)
[![image](https://img.shields.io/pypi/pyversions/lampip)](https://python.org/pypi/lampip)
[![image](https://github.com/hayashiya18/lampip/actions/workflows/pytest.yml/badge.svg)](https://github.com/hayashiya18/lampip/actions/workflows/pytest.yml)

---

## 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](https://docs.python.org/3.8/library/compileall.html) (that remove source comments and docstrings).
  - Remove `*.dist-info`.

## Requirements

- Python3
- Docker
- AWS Account

## Installation

You can obtain this packages using pip.

```console
$ pip3 install lampip
```

Then you can use `lampip` command.

```console
$ 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

```console
$ lampip new science
```

Go to the generated directory

```console
$ cd science
$ ls
lampip-config.toml  other_resources  requirements.txt
```

Edit `requirements.txt`

```text
numpy
scipy
pandas
```

Edit `lampip-config.toml`

```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.

```console
(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.

```console
(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

```console
$ 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.

![image](./assets/lambda_console.webp)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hayashiya18/lampip",
    "name": "lampip",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6,<4.0",
    "maintainer_email": "",
    "keywords": "aws,lambda,layer",
    "author": "hayashiya18",
    "author_email": "sei8haya@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/53/20/77120c073c38fceeb86d3cc6641112ffa6e8c5480c21c2c5c06c1b2445a6/lampip-0.3.0.tar.gz",
    "platform": null,
    "description": "# lampip: Simple CLI tool for creating python custom lambda layers\n\n[![image](https://img.shields.io/pypi/l/lampip)](https://python.org/pypi/lampip)\n[![image](https://img.shields.io/pypi/v/lampip)](https://python.org/pypi/lampip)\n[![image](https://img.shields.io/pypi/pyversions/lampip)](https://python.org/pypi/lampip)\n[![image](https://github.com/hayashiya18/lampip/actions/workflows/pytest.yml/badge.svg)](https://github.com/hayashiya18/lampip/actions/workflows/pytest.yml)\n\n---\n\n## Features\n\n- Build Python(3.7, 3.8, 3.9)-compatible custom lambda layers using Docker and pip, and push it to AWS.\n\n- Reduce the package size using some approachs.\n  - [Byte-Compile](https://docs.python.org/3.8/library/compileall.html) (that remove source comments and docstrings).\n  - Remove `*.dist-info`.\n\n## Requirements\n\n- Python3\n- Docker\n- AWS Account\n\n## Installation\n\nYou can obtain this packages using pip.\n\n```console\n$ pip3 install lampip\n```\n\nThen you can use `lampip` command.\n\n```console\n$ lampip --help\nUsage: lampip [OPTIONS] COMMAND [ARGS]...\n\n  Simple CLI tool for creating python custom lambda layers\n\nOptions:\n  --version  Show the version and exit.\n  --help     Show this message and exit.\n\nCommands:\n  deploy  Build and push lambda layer\n  new     Create the scaffold\n\n```\n\n## Usage\n\nAt the first create the scaffold\n\n```console\n$ lampip new science\n```\n\nGo to the generated directory\n\n```console\n$ cd science\n$ ls\nlampip-config.toml  other_resources  requirements.txt\n```\n\nEdit `requirements.txt`\n\n```text\nnumpy\nscipy\npandas\n```\n\nEdit `lampip-config.toml`\n\n```toml\n[lampip]\nlayername = \"science\"\ndescription = \"numpy, scipy, and pandas\"\npyversions = [\"3.7\", \"3.8\", \"3.9\"]\n\n[lampip.shrink]\ncompile = true\ncompile_optimize_level = 2\nremove_dist_info = true\n\n# [lampip.shrink.plotly]\n# remove_jupyterlab_plotly = true\n# remove_data_docs = true\n```\n\nBefore you deploy the lambda layer, be sure you have AWS credentials configured.\n\n```console\n(If you do not configure AWS credentials yet, ...)\n$ aws configure\nAWS Access Key ID: ?????\nAWS Secret Acess Key: ?????\nDefault region name: ?????\n```\n\n(Option) You can switch the aws credentials using environments variables.\n\n```console\n(Case1: Using AWS CLI profile)\n$ export AWS_PROFILE=\"subaccount\"\n\n(Case2: Using AWS access key directly)\n$ export AWS_ACCESS_KEY_ID=????\n$ export AWS_SECRET_ACCESS_KEY=?????\n$ export AWS_DEFAULT_REGION=?????\n```\n\nDeploy\n\n```console\n$ lampip deploy\nStart to make dist/science_1631253196_3.7.zip\n...\nPublish the custom layer: arn:aws:lambda:ap-northeast-1:XXXXXXXXXXXX:layer:science-py38:1\nDONE: dist/science_1631253312_3.8.zip created\n\n$ ls -lh dist\n-rw-r--r-- 1 root root 73M  9\u6708 10 23:54 science_1631253254_3.7.zip\n-rw-r--r-- 1 root root 73M  9\u6708 10 23:55 science_1631253312_3.8.zip\n...\n\n\n(The --no-upload option suppress uploading zip files)\n$ lampip deploy --no-upload\n```\n\nThen you can check deployed layers on AWS Console.\n\n![image](./assets/lambda_console.webp)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Simple CLI tool for creating custom python lambda layers",
    "version": "0.3.0",
    "split_keywords": [
        "aws",
        "lambda",
        "layer"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ef17daa793e2a75a8a9a725706f391526f3a7f1248d19ea91f5511cb2d76593",
                "md5": "fe08f23abffe0c0d3a574ecdc2bd042b",
                "sha256": "25da01d70e18b98b16f8566aa2c455a900ba78e1067b7aa4d57e987d32ead95a"
            },
            "downloads": -1,
            "filename": "lampip-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fe08f23abffe0c0d3a574ecdc2bd042b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<4.0",
            "size": 8994,
            "upload_time": "2023-01-15T07:55:49",
            "upload_time_iso_8601": "2023-01-15T07:55:49.757466Z",
            "url": "https://files.pythonhosted.org/packages/5e/f1/7daa793e2a75a8a9a725706f391526f3a7f1248d19ea91f5511cb2d76593/lampip-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "532077120c073c38fceeb86d3cc6641112ffa6e8c5480c21c2c5c06c1b2445a6",
                "md5": "e2d239af0c1a636dd20285318be27f63",
                "sha256": "0ba167f01f423f1ee4df71246a243fe4b5912da7eb3b52a8e3b3d66b5b953d4f"
            },
            "downloads": -1,
            "filename": "lampip-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e2d239af0c1a636dd20285318be27f63",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6,<4.0",
            "size": 7844,
            "upload_time": "2023-01-15T07:55:51",
            "upload_time_iso_8601": "2023-01-15T07:55:51.112465Z",
            "url": "https://files.pythonhosted.org/packages/53/20/77120c073c38fceeb86d3cc6641112ffa6e8c5480c21c2c5c06c1b2445a6/lampip-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-15 07:55:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "hayashiya18",
    "github_project": "lampip",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "lampip"
}
        
Elapsed time: 0.02955s