Skip to main content

Lynara

Lynara lets you run your ASGI (Starlette, FastAPI, Django) applications in a serverless runtime like AWS Lambda. It closely follows what Uvicorn does with the exception that there's no long-lived loop and instead a Lambda event is translated to an ASGI HTTP event and served to the application accordingly.

To use Lynara in an AWS Lambda handler you can:

import asyncio
from lynara import Lynara, APIGatewayProxyEventV2Interface


app = FastAPI()
lynara = Lynara(app=app)

def lambda_handler(event, context):
    return asyncio.run(lynara.run(event, context, APIGatewayProxyEventV2Interface))

Lynara will produce a dictionary with an AWS Lambda HTTP response for your handler to respond with.

Development

Get Hatch (pipx is a good option): https://hatch.pypa.io/latest/install/#pipx.

pipx install hatch

Install all Python versions:

hatch python install all

Running tests

https://hatch.pypa.io/1.10/tutorials/testing/overview/#passing-arguments

For development you might find the following useful to use with pdb:

hatch test -- -s -n 0 --log-cli-level

To run a single test:

hatch -v test -- "tests/test_fastapi.py::test_fastapi_app_lifespan[on]"

For HTML coverage report

hatch test -- --cov --cov-report=html

Contributing

Make sure to run tests, static checks and mypy before submitting a change:

hatch run check

Writing docs

hatch docs:serve

Release files for lynara 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lynara 0.2.0
File Size Uploaded
lynara-0.2.0.tar.gz 22.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lynara 0.2.0
File Interpreter ABI Platform
lynara-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.8 kB

Release files / lynara-0.2.0.tar.gz

Download URL lynara-0.2.0.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dac757bfbb7dd8c580aaf5fdabe607307bcb76a098f3cd5744bfc473913f9c7b
BLAKE2b-256 checksum
How to use checksums
8017e51d64f43debd59109748f938b619575a344d07d507204020657e86fe5c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / lynara-0.2.0-py3-none-any.whl

Download URL lynara-0.2.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb2967c15f86ca3cf7ba10f405bab1dfb6e3d4dc79ca7c717155d9d3b693a4fd
BLAKE2b-256 checksum
How to use checksums
818ac7cfb8678aa4b45e651f72e2ee4da875873bb80a1aec36f0d49dc2b6d86a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page