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.12+ 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)
Metadata
Release files for bareASGI 5.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bareasgi-5.0.0.tar.gz | 32.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bareasgi-5.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.4 kB
Release files / bareasgi-5.0.0.tar.gz
| Download URL | bareasgi-5.0.0.tar.gz |
|---|---|
| Size | 32.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e284ce2a05a703dcdcd62fc1b5902b972ee7b917fca730455dd3d1959797cfa5
|
|
BLAKE2b-256 checksum How to use checksums |
e9772552d81bffebc588beaf4c1fbfcc4d32182dc4c19a1168bd447b41ceb177
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / bareasgi-5.0.0-py3-none-any.whl
| Download URL | bareasgi-5.0.0-py3-none-any.whl |
|---|---|
| Size | 41.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4eb2b8e0b52bebe59880288879065e5540b3f81fdb027f11476b9b3c1983fce9
|
|
BLAKE2b-256 checksum How to use checksums |
1d0bbb378d21893140ca4f01194f8c03d610bd41a227f2274447db3756cfb371
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|