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.2.0.tar.gz
.
File metadata
- Download URL: bareasgi-4.2.0.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.13 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8706323de34e56e11b470c64353a13263faa96944ce59f7d1a8ddc60fab77322 |
|
MD5 | 7e13fef4094390d9ab8cf47e55f42e0f |
|
BLAKE2b-256 | d569d60fc31c7b79ec5d10448cab0f498a49dc37796ea81251cf6e8eb76c2931 |
File details
Details for the file bareasgi-4.2.0-py3-none-any.whl
.
File metadata
- Download URL: bareasgi-4.2.0-py3-none-any.whl
- Upload date:
- Size: 29.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.13 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 826f998db1794124459cedd44cb98ded921e511846782760ecbe5c591f2681be |
|
MD5 | a99627591314a82ec3c4d99d30d20627 |
|
BLAKE2b-256 | 73d9243b4a75d86468a58ee42c1295e81d339bbf8418be9b9fe847ac99568426 |