A simple web framework for aws lambda
Project description
WellAPI
WellAPI is a lightweight web framework for building APIs on AWS Lambda and API Gateway.
Documentation
- Practical usage guide:
docs/framework-usage.md
Features
- Lambda-first route definitions (
GET,POST,PUT,PATCH,DELETE) - Type-based request parsing and validation with Pydantic
- Dependency injection via
Depends - Middleware and custom exception handlers
- OpenAPI generation compatible with API Gateway integrations
- SQS handlers and scheduled job handlers
- Packaging helpers for Lambda app code and dependency layers
Installation
Install the base package:
pip install wellapi
Install with optional extras:
pip install "wellapi[local,deploy,telemetry]"
local: local server/test toolingdeploy: AWS CDK integrationtelemetry: OpenTelemetry support
Quick Start
main.py:
from wellapi import WellApi
app = WellApi(title="My API", version="1.0.0")
@app.get("/hello")
def hello():
return {"message": "Hello, World!"}
Create a handlers/ directory for additional endpoints if needed:
handlers/
__init__.py
users.py
Local Development
Run with Uvicorn:
uvicorn main:app --reload
If your handlers are not in the default handlers/ directory, configure it in pyproject.toml:
[wellapi]
handlers_dir = "your_handlers_dir"
CLI
Generate OpenAPI:
wellapi openapi main:app handlers --output openapi.json
Enable CORS in OpenAPI output:
wellapi openapi main:app handlers --output openapi.json --cors true --role_name WellApiRole
Build deployment artifacts:
wellapi build app app.zip
wellapi build dep deps.zip
Deploy with AWS CDK
from aws_cdk import Stack
from constructs import Construct
from wellapi.build.cdk import WellApiCDK
class MyStack(Stack):
def __init__(self, scope: Construct, id_: str, **kwargs) -> None:
super().__init__(scope, id_, **kwargs)
WellApiCDK(
self,
"WellApiCDK",
app_srt="main:app",
handlers_dir="handlers",
cors=True,
cache_enable=False,
log_enable=True,
)
Notes
- API Gateway cache support applies to
GETendpoints. - For full framework usage (routing, DI, middleware, SQS/jobs, testing), see
docs/framework-usage.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wellapi-0.9.7.tar.gz.
File metadata
- Download URL: wellapi-0.9.7.tar.gz
- Upload date:
- Size: 65.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30fe41ebd0df66672fb2cc737a5adf5c938d5a3f8be1f0ab35cf3d83f007a8ae
|
|
| MD5 |
6b28c697c2cc0c766af5325cbd73b16f
|
|
| BLAKE2b-256 |
ce349ff574f990790ee23b31158dab36bb1babba038acee09f20802dd62645bf
|
File details
Details for the file wellapi-0.9.7-py3-none-any.whl.
File metadata
- Download URL: wellapi-0.9.7-py3-none-any.whl
- Upload date:
- Size: 60.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
697944fd09d3256e295091781e3e3719e17982ace4cd7116eda4651711f690ae
|
|
| MD5 |
effa5004414ffa069eb92692890b72fe
|
|
| BLAKE2b-256 |
df97c11e1f412d9183dd121a814ecbe3a88c3663dbb97d05d4ad11e72b2d47b5
|