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
bareasgi-4.0.0a2.tar.gz
(22.2 kB
view hashes)
Built Distribution
bareasgi-4.0.0a2-py3-none-any.whl
(30.2 kB
view hashes)
Close
Hashes for bareasgi-4.0.0a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 112667c0dfafff0f3330a6e37a0dcd66b48610c3eaf9acbdfdcc2792c95a93ed |
|
MD5 | 338d5d3fd1c88a1506cdd2c513bf019d |
|
BLAKE2b-256 | 6c64e0b7b638e14aeaa21c769fabdb6ab53874bf4264b6a476571e8ee6843e9b |