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-5.0.0a4.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bareasgi-5.0.0a4-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file bareasgi-5.0.0a4.tar.gz.

File metadata

  • Download URL: bareasgi-5.0.0a4.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bareasgi-5.0.0a4.tar.gz
Algorithm Hash digest
SHA256 87baf4e4dee80f09a6b1ca36d2542a6dcdb0206505e0621739881d65ab0b08c4
MD5 fbef84113f5e0675be3543584b6ecb59
BLAKE2b-256 69894aa9cac78fd4a71a4d91e62e64898bb3eb7087e3db47688ae8baa3b0cc0c

See more details on using hashes here.

File details

Details for the file bareasgi-5.0.0a4-py3-none-any.whl.

File metadata

  • Download URL: bareasgi-5.0.0a4-py3-none-any.whl
  • Upload date:
  • Size: 40.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bareasgi-5.0.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 5421e3482a2175b1a82d19acfdb8247bbc5dc9a6b0faa3f9499589d47e9a3d48
MD5 1c2518d22c245b699677640abc9cf234
BLAKE2b-256 a6954e3dfe5c053059e4770c3280d921a442435337ac67c03569437070e7945f

See more details on using hashes here.

Supported by

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