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.0a3.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.0a3-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bareasgi-5.0.0a3.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.0a3.tar.gz
Algorithm Hash digest
SHA256 76abcdf845b22185f13e9be9aff9b458c346b6fb3292703d1b9a0c4f220b4ded
MD5 5b6223f4842388234c55c3b477f53380
BLAKE2b-256 2301fec9833a4ded81cb34a13d80a11588539114a447ca4bb4c5dd15a1c5c5da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bareasgi-5.0.0a3-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.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 e28f5287959d223a6bdf0b18391dedfe0550ab92b5212a39f5b2528fdcc621d8
MD5 ec38f6c39b237cd635735d38ce26028c
BLAKE2b-256 a8cd6f9c7a998e96cfccc3723dd1fe80af6eb1307bbc872d2ab7d2df1b8afa1a

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