Vaul
Vaul is a nano-framework for deploying Python functions as APIs on AWS Lambda using Function URLs. It provides seamless integration with OpenAPI Schema and allows for monitoring and managing microservices with ease.
Table of Contents
Introduction
Vaul is designed to help developers quickly deploy Python functions as serverless APIs on AWS Lambda. With a focus on simplicity and efficiency, Vaul leverages AWS Lambda's Function URLs to provide scalable and cost-effective API endpoints.
Features
- Nano-framework: Lightweight and easy to use.
- OpenAPI Integration: Automatically generate OpenAPI schema for your APIs.
- AWS Lambda Support: Seamlessly deploy functions to AWS Lambda using Function URLs.
- Request Validation: Built-in request validation using Pydantic.
- CORS Support: Pre-configured Cross-Origin Resource Sharing (CORS) support.
- Custom Actions: Define and manage custom actions with ease.
Installation
To install Vaul, you can use pip:
pip install vaul
Usage
Defining Actions
Vaul allows you to define actions (API endpoints) using simple decorators. Here is an example of how to define a GET and POST endpoint:
from vaul import Vaul
app = Vaul()
@app.action(path='/hello', method="GET")
def hello(name: str) -> str:
return f"Hello, {name}!"
@app.action(path='/echo', method="POST")
def echo(data: dict) -> dict:
return data
def handler(event, context):
return app.handler(event)
Deploying to AWS Lambda
To deploy your Vaul application to AWS Lambda, use the AWS CLI or AWS Management Console. Ensure that your Lambda function's handler is set to the appropriate entry point (e.g., handler).
Using OpenAPI Schema
Vaul automatically generates an OpenAPI schema for your API based on the defined actions. You can access the schema by visiting the /openapi endpoint.
curl -X GET https://your-function-url/openapi.json
Accessing Request Data
You can access the request data (e.g., query parameters, headers, body) using the get_request function:
from vaul import Vaul, get_request
app = Vaul()
@app.action(path='/hello', method="GET")
def hello() -> str:
request = get_request()
user_agent = request.headers.get('User-Agent')
return f"Hello, {user_agent}!"
def handler(event, context):
return app.handler(event)
Handling Requests
Vaul's middleware automatically handles incoming requests, validates them, and routes them to the appropriate action based on the request path and method.
Contributing
We welcome contributions from the community! If you would like to contribute to Vaul, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them to your branch.
- Push your changes to your fork.
- Create a pull request to the main repository.
- We will review your changes and merge them if they meet our guidelines.
- Thank you for contributing to Vaul!
License
Vaul is licensed under the GNU General Public License v3.0. See the LICENSE file for more information.
Metadata
Release files for oveya 0.1.281
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 | |
|---|---|---|---|---|
| oveya-0.1.281.tar.gz | 22.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| oveya-0.1.281-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.1 kB
Release files / oveya-0.1.281.tar.gz
| Download URL | oveya-0.1.281.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30bc133f2674329e0af8e4d5e6b7ccd87cafdee77402f96e72765a82cb22313b
|
|
BLAKE2b-256 checksum How to use checksums |
368b8136f3a9318b74b93e524aa61f773644898cc16e6b973a84d2f4275e3ec1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.3
|
Release files / oveya-0.1.281-py3-none-any.whl
| Download URL | oveya-0.1.281-py3-none-any.whl |
|---|---|
| Size | 22.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
178052e1e8ca4def514e82bb921e728b6aac2ba49e71a515e30560b07aa9321d
|
|
BLAKE2b-256 checksum How to use checksums |
b5d92fe9ae04021f7ab85d9fddbff55152636249aef2cb8c644813d903880ff2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.3
|
Security for oveya 0.1.281
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.