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

Uploaded Source

Built Distribution

bareasgi-4.4.1-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bareasgi-4.4.1.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.6 Linux/5.19.0-41-generic

File hashes

Hashes for bareasgi-4.4.1.tar.gz
Algorithm Hash digest
SHA256 07743cf8e880b4fca9e3fb582c92ee0a5360d4280b091d5bc0bd00f0b4090e59
MD5 c000c553430f05d40694587ecd734a61
BLAKE2b-256 6e5a4c5135db83cfacd1a933b080c5481a5f0838ad4c2987b55c92b6c6f7653d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bareasgi-4.4.1-py3-none-any.whl
  • Upload date:
  • Size: 30.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.6 Linux/5.19.0-41-generic

File hashes

Hashes for bareasgi-4.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82823b0e452d80981682fbe637feef604910b0b68eaec83224e20ae248e39ad8
MD5 4e3492a262b69532b3d9afbd3dc4e3ef
BLAKE2b-256 338db6cd6411eb1034562407c0b4b44648e8ca35971f34fe82a81a1a04f5acb3

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