viburnum


Nameviburnum JSON
Version 0.1.6 PyPI version JSON
download
home_pagehttps://github.com/yarik2215/Viburnum
SummaryIt's abstraction on top of AWS CDK, that helps in building serverless web applications.
upload_time2022-11-16 18:13:49
maintainer
docs_urlNone
authorYaroslav Martynenko
requires_python>=3.8,<4.0
licenseMIT
keywords aws serverless
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Viburnum

**Viburum** - it's a small framework built on top of AWS CDK to simplify development and deploying AWS Serverless web applications.

## Installing

Package consist of two pats `primitives` that help to describe your handlers and resources and `deployer` that will convert primitives into CloudFormation using CDK.

### Installing only primitives

```bash
pip install viburnum
```

### Installing with deployer

```bash
pip install "viburnum[deployer]"
```

Lambda function will require only primitives to work correctly. That's why it's recommended to add `viburnum` into `requirements.txt` and `viburnum[deployer]` into `requirements-dev.txt`

## Project structure

Each Lambda function handler is represented as folder with `handler.py` inside and other files if required.

**Example** `handler.py`:

```python
from viburnum.application import Request, Response, route

@route("/tests/{id}", methods=["GET"])
def get_test(request: Request, test_queue):
    print(f"Get test: {request.path_params.get('id')}")
    return Response(200, {})
```

In the root folder you need to have `app.py` file with `Application`, this file used by deployer and CDK to determine all related resources.

**Example** `app.py`

```python
import aws_cdk as cdk
from viburnum.deployer.builders import AppConstruct
from viburnum.application import Application, Sqs

from functions.api.get_test.handler import get_test

app = Application("TestApp")
# Handlers
app.add_handler(get_test)

context = cdk.App()
AppConstruct(context, app)
context.synth()
```

All logic that shared across all lambdas, must be placed inside `shared` folder, and it will plugged into Lambda as a Layer.

### Recommended structure

```project
├── functions
│   ├── __init__.py
│   ├── api
│   │   ├── __init__.py
│   │   ├── some_api
│   │   │    ├── __init__.py
│   │   │    ├── handler.py
│   │   │    └── ...
│   │   │
│   │   └── ...
│   │   
│   ├── jobs
│   │   ├── __init__.py
│   │   ├── some_job
│   │   │    ├── __init__.py
│   │   │    ├── handler.py
│   │   │    └── ...
│   │   │
│   │   └── ...
│   │   
│   └── workers
│       ├── __init__.py
│       ├── some_job
│       │    ├── __init__.py
│       │    ├── handler.py
│       │    └── ...
│       │
│       └── ...
│      
├── shared
│   ├── __init__.py
│   └── ...
│
├── app.py
├── requirements-dev.txt
└── requirements.txt
```

### CLI tool

Viburnum deployer include CLI tool that helps initializing project and creating a new handlers.
After initializing project folder with `cdk init app --language python` you can call `virburnum init`, that command will change some files so Virburnum can work correctly.
There is command for creating new handlers `virburnum add [HANDLER_TYPE]` that will create a handler.

Supported `HANDLER_TYPE`:

- `api`
- `worker`
- `job`

## Example app

Simple [example app](https://github.com/yarik2215/Viburnum-example)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yarik2215/Viburnum",
    "name": "viburnum",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "aws,serverless",
    "author": "Yaroslav Martynenko",
    "author_email": "stikblacklabel@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5c/fe/7464b8c15b756f23f79d333ff37158906b0decc54ec488d00a95ccc5fa3f/viburnum-0.1.6.tar.gz",
    "platform": null,
    "description": "# Viburnum\n\n**Viburum** - it's a small framework built on top of AWS CDK to simplify development and deploying AWS Serverless web applications.\n\n## Installing\n\nPackage consist of two pats `primitives` that help to describe your handlers and resources and `deployer` that will convert primitives into CloudFormation using CDK.\n\n### Installing only primitives\n\n```bash\npip install viburnum\n```\n\n### Installing with deployer\n\n```bash\npip install \"viburnum[deployer]\"\n```\n\nLambda function will require only primitives to work correctly. That's why it's recommended to add `viburnum` into `requirements.txt` and `viburnum[deployer]` into `requirements-dev.txt`\n\n## Project structure\n\nEach Lambda function handler is represented as folder with `handler.py` inside and other files if required.\n\n**Example** `handler.py`:\n\n```python\nfrom viburnum.application import Request, Response, route\n\n@route(\"/tests/{id}\", methods=[\"GET\"])\ndef get_test(request: Request, test_queue):\n    print(f\"Get test: {request.path_params.get('id')}\")\n    return Response(200, {})\n```\n\nIn the root folder you need to have `app.py` file with `Application`, this file used by deployer and CDK to determine all related resources.\n\n**Example** `app.py`\n\n```python\nimport aws_cdk as cdk\nfrom viburnum.deployer.builders import AppConstruct\nfrom viburnum.application import Application, Sqs\n\nfrom functions.api.get_test.handler import get_test\n\napp = Application(\"TestApp\")\n# Handlers\napp.add_handler(get_test)\n\ncontext = cdk.App()\nAppConstruct(context, app)\ncontext.synth()\n```\n\nAll logic that shared across all lambdas, must be placed inside `shared` folder, and it will plugged into Lambda as a Layer.\n\n### Recommended structure\n\n```project\n\u251c\u2500\u2500 functions\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u251c\u2500\u2500 api\n\u2502   \u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u2502   \u251c\u2500\u2500 some_api\n\u2502   \u2502   \u2502    \u251c\u2500\u2500 __init__.py\n\u2502   \u2502   \u2502    \u251c\u2500\u2500 handler.py\n\u2502   \u2502   \u2502    \u2514\u2500\u2500 ...\n\u2502   \u2502   \u2502\n\u2502   \u2502   \u2514\u2500\u2500 ...\n\u2502   \u2502   \n\u2502   \u251c\u2500\u2500 jobs\n\u2502   \u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u2502   \u251c\u2500\u2500 some_job\n\u2502   \u2502   \u2502    \u251c\u2500\u2500 __init__.py\n\u2502   \u2502   \u2502    \u251c\u2500\u2500 handler.py\n\u2502   \u2502   \u2502    \u2514\u2500\u2500 ...\n\u2502   \u2502   \u2502\n\u2502   \u2502   \u2514\u2500\u2500 ...\n\u2502   \u2502   \n\u2502   \u2514\u2500\u2500 workers\n\u2502       \u251c\u2500\u2500 __init__.py\n\u2502       \u251c\u2500\u2500 some_job\n\u2502       \u2502    \u251c\u2500\u2500 __init__.py\n\u2502       \u2502    \u251c\u2500\u2500 handler.py\n\u2502       \u2502    \u2514\u2500\u2500 ...\n\u2502       \u2502\n\u2502       \u2514\u2500\u2500 ...\n\u2502      \n\u251c\u2500\u2500 shared\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u2514\u2500\u2500 ...\n\u2502\n\u251c\u2500\u2500 app.py\n\u251c\u2500\u2500 requirements-dev.txt\n\u2514\u2500\u2500 requirements.txt\n```\n\n### CLI tool\n\nViburnum deployer include CLI tool that helps initializing project and creating a new handlers.\nAfter initializing project folder with `cdk init app --language python` you can call `virburnum init`, that command will change some files so Virburnum can work correctly.\nThere is command for creating new handlers `virburnum add [HANDLER_TYPE]` that will create a handler.\n\nSupported `HANDLER_TYPE`:\n\n- `api`\n- `worker`\n- `job`\n\n## Example app\n\nSimple [example app](https://github.com/yarik2215/Viburnum-example)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "It's abstraction on top of AWS CDK, that helps in building serverless web applications.",
    "version": "0.1.6",
    "split_keywords": [
        "aws",
        "serverless"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e1b76bfae88165e8b502b65a340de6ab8f6dae753c38c5822193a37e4fe4abdf",
                "md5": "922ff6bc98f25b9eeb3251a2f3dcacb6",
                "sha256": "4e28edec6370de9f9b8a992388c323f3edadc4ab320a81d81865b0aede6e4965"
            },
            "downloads": -1,
            "filename": "viburnum-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "922ff6bc98f25b9eeb3251a2f3dcacb6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 14935,
            "upload_time": "2022-11-16T18:13:48",
            "upload_time_iso_8601": "2022-11-16T18:13:48.033095Z",
            "url": "https://files.pythonhosted.org/packages/e1/b7/6bfae88165e8b502b65a340de6ab8f6dae753c38c5822193a37e4fe4abdf/viburnum-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5cfe7464b8c15b756f23f79d333ff37158906b0decc54ec488d00a95ccc5fa3f",
                "md5": "56a71d79679d232e9f4a9578e228b262",
                "sha256": "f5d7890c0c5880e540750f7a80eb8f4742a6bee1773b47ab31d7a1b9eb01beb4"
            },
            "downloads": -1,
            "filename": "viburnum-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "56a71d79679d232e9f4a9578e228b262",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 12914,
            "upload_time": "2022-11-16T18:13:49",
            "upload_time_iso_8601": "2022-11-16T18:13:49.615626Z",
            "url": "https://files.pythonhosted.org/packages/5c/fe/7464b8c15b756f23f79d333ff37158906b0decc54ec488d00a95ccc5fa3f/viburnum-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-11-16 18:13:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "yarik2215",
    "github_project": "Viburnum",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "viburnum"
}
        
Elapsed time: 0.03383s