Skip to main content

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

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


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.3.0.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

bareasgi-4.3.0-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file bareasgi-4.3.0.tar.gz.

File metadata

  • Download URL: bareasgi-4.3.0.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.14 Darwin/21.6.0

File hashes

Hashes for bareasgi-4.3.0.tar.gz
Algorithm Hash digest
SHA256 ce946a651ba2764b98e8aa2dc04236ce875a774863899e9cf195019ed7e964de
MD5 d3edf77e2dd3d9f7cc0f52667caec357
BLAKE2b-256 5319291bbe3ed271551a802605ea189d132bc1b6aec75d81ce6090209fb2ab6e

See more details on using hashes here.

File details

Details for the file bareasgi-4.3.0-py3-none-any.whl.

File metadata

  • Download URL: bareasgi-4.3.0-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.14 Darwin/21.6.0

File hashes

Hashes for bareasgi-4.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83a18e72bae918288894c9d9716c42ae94a60ee2d84cd430862b5e602e409448
MD5 f2542154f8ee48ecf3eca973c2e63bc3
BLAKE2b-256 05fb820f59b50eb25af1e8f8cd7f2e8819085318538745efb96b59b132cccc12

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page