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, or as a base for larger frameworks.
Python 3.7+ 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 grapehene,
- bareASGI-rest for REST support,
- bareASGI-prometheus for prometheus metrics,
- bareASGI-session for sessions.
Functionality
While lightweight, the framework contains all the functionality required for developing sophisticated web applications including:
- Http (1.0, 1.1, 2, 3),
- WebSockets,
- A method and path based router,
- Middleware,
- Http 2 push,
- Streaming requests and responses.
Simple Server
Here is a simple server with a request handler that returns some text.
import uvicorn
from bareasgi import Application, text_writer
async def http_request_callback(scope, info, matches, content):
return 200, [(b'content-type', b'text/plain')], text_writer('This is not a test')
app = Application()
app.http_router.add({'GET'}, '/', http_request_callback)
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.0.0a5.tar.gz
.
File metadata
- Download URL: bareasgi-4.0.0a5.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.8 CPython/3.8.10 Linux/5.4.0-84-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fb5ada2c902b96e6032e19832e4df4df249d30d5016d53b9d7bd81a3c1e20b4 |
|
MD5 | 81b02444c3dd36d5a68a192262b1265e |
|
BLAKE2b-256 | 02c077f6bb2b415c3843c23a1af55e5484f35dd3e100137e921ab7ac76249afa |
File details
Details for the file bareasgi-4.0.0a5-py3-none-any.whl
.
File metadata
- Download URL: bareasgi-4.0.0a5-py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.8 CPython/3.8.10 Linux/5.4.0-84-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14e2eda5ee56c51f3e2f7368756f7f368e321fc255f5655b4f7fe200c46d172c |
|
MD5 | 8579bfdeca691300e5f713197aca0e95 |
|
BLAKE2b-256 | e426242df33b5d414843173d27f9f5bb41ba4d6710de8a15397773f35bc711e4 |