Skip to main content
2025 Python Packaging Survey is now live!  Take the survey now

The little ASGI library that shines.

Project description

starlette

✨ The little ASGI library that shines. ✨

Build Status Coverage Package version


Documentation: https://www.starlette.io/


Starlette is a small library for working with ASGI.

It gives you Request and Response classes, request routing, websocket support, static files support, and a test client.

Requirements

Python 3.6+

Installation

$ pip3 install starlette

Example

from starlette.response import Response


class App:
    def __init__(self, scope):
        self.scope = scope

    async def __call__(self, receive, send):
        response = Response('Hello, world!', media_type='text/plain')
        await response(receive, send)

You can run the application with any ASGI server, including uvicorn, daphne, or hypercorn.

Install the Uvicorn ASGI server:

$ pip3 install uvicorn
[...]
Successfully installed uvicorn

Run the App application in example.py:

$ uvicorn run example:App
INFO: Started server process [11509]
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

— ⭐️ —

Starlette is BSD licensed code. Designed & built in Brighton, England.

Supported by

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