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-3.5.2.tar.gz
.
File metadata
- Download URL: bareasgi-3.5.2.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.1 CPython/3.8.5 Linux/5.8.0-50-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b18e1ce6ef79e520d5cf0e85c5fde846e64a0552924b4f1b74c3993c61f94e16 |
|
MD5 | f658925938afaae6a4e64501a42467a8 |
|
BLAKE2b-256 | cf79d3dc2269f9f1f3f8a4406f205a486c71da83443aa31b2a7833dedb68524a |
File details
Details for the file bareasgi-3.5.2-py3-none-any.whl
.
File metadata
- Download URL: bareasgi-3.5.2-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.1 CPython/3.8.5 Linux/5.8.0-50-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 656f7e80c554159b0ec6081cdfea9de199a2d8f4ba4c30f45c8a1214f6104941 |
|
MD5 | 55118dabd3351ded238c77a02e805f94 |
|
BLAKE2b-256 | 668d8752f9a410644d8008d741e06168f586b4f3046445aeec3cb23c31645817 |