Awesome Open Source
Awesome Open Source

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

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)


Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Python (864,795
Server (65,767
Web (37,583
Http (30,251
Graphql (16,172
Websocket (14,130
Prometheus (6,130
Http Server (3,975
Cors (2,982
Asyncio (2,663
Sse (1,416
Asgi (177
Bareasgi (3