A lightweight ASGI framework
Project description
bareASGI
A lightweight Python ASGI web server framework (read the docs).
Overview
This is a bare ASGI web server framework. The goal is to provide a minimal implementation, with other facilities (serving static files, CORS, sessions, etc.) being implemented by optional packages.
The framework is targeted at micro-services which require a light footprint (in a container for example), or as a base for larger frameworks.
Python 3.8+ is required.
Optional Packages
- bareASGI-cors for cross origin resource sharing,
- bareASGI-static for serving static files,
- bareASGI-jinja2 for Jinja2 template rendering,
- bareASGI-graphql-next for GraphQL and graphene,
- bareASGI-rest for REST support,
- bareASGI-prometheus for prometheus metrics,
- bareASGI-session for sessions.
Functionality
The framework provides the basic functionality required for developing a web application, including:
- Http,
- WebSockets,
- Routing,
- Lifecycle,
- Middleware
Simple Server
Here is a simple server with a request handler that returns some text.
import uvicorn
from bareasgi import Application, HttpRequest, HttpResponse, text_writer
async def example_handler(request: HttpRequest) -> HttpResponse:
return HttpResponse(
200,
[(b'content-type', b'text/plain')],
text_writer('This is not a test')
)
app = Application()
app.http_router.add({'GET'}, '/', example_handler)
uvicorn.run(app, port=9009)
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
File details
Details for the file bareasgi-4.1.0.tar.gz
.
File metadata
- Download URL: bareasgi-4.1.0.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.13 Darwin/21.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3320b745c9c75ebafeae9e9a67351b0904f49e3bc126c9b8d629c334fc123fa8 |
|
MD5 | 3ec8b69a1db6650c72dd445bff9c9e30 |
|
BLAKE2b-256 | 1a8f9557860ebc1cd847dc96a35780dc883645e2eeed45636c50ec3c61bc243d |
File details
Details for the file bareasgi-4.1.0-py3-none-any.whl
.
File metadata
- Download URL: bareasgi-4.1.0-py3-none-any.whl
- Upload date:
- Size: 29.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.13 Darwin/21.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e891f0d08ecfe83a6d3fc5389dcf9fb3ba96afb57d2776a847b76a22aec019de |
|
MD5 | 13b30244062fa9c89504bfeaf7e8edb2 |
|
BLAKE2b-256 | f9eb7c55e93102409d6aecaa485f3dd90d791694aea01da5aa7c3a78d96ab9c0 |