---
title: "starlette | pypx"
description: "The little ASGI library that shines."
canonical_url: "https://pypx.app/packages/starlette"
meta:
  "og:description": "The little ASGI library that shines."
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_starlette%2Cversion_1.10.0%2Csummary_The%2Blittle%2BASGI%2Blibrary%2Bthat%2Bshines.%2Clicense_BSD-3-Clause%2Cp_Ii9wYWNrYWdlcy9zdGFybGV0dGUi%2Cs_LKVBp6fOMFbEpqlu.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "starlette 1.10.0"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_starlette%2Cversion_1.10.0%2Csummary_The%2Blittle%2BASGI%2Blibrary%2Bthat%2Bshines.%2Clicense_BSD-3-Clause%2Cp_Ii9wYWNrYWdlcy9zdGFybGV0dGUi%2Cs_LKVBp6fOMFbEpqlu.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **starlette**

v1.10.0

The little ASGI library that shines.

79 KB Python 3.11+ py3-none-anyBSD-3-Clause2 deps

[** Diff **](https://pypx.app/packages/starlette/diff)

`$ uv add starlette`

---

[![Build Status](https://github.com/Kludex/starlette/workflows/Test%20Suite/badge.svg)](https://github.com/Kludex/starlette/actions) [![Package version](https://badge.fury.io/py/starlette.svg)](https://pypi.python.org/pypi/starlette) [![Supported Python Version](https://img.shields.io/pypi/pyversions/starlette.svg?color=%2334D058)](https://pypi.org/project/starlette) [![Discord](https://img.shields.io/discord/1051468649518616576?logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/RxKUF5JuHs)

---

**Documentation**: https://starlette.dev

**Source Code**: https://github.com/Kludex/starlette

---

# Starlette

Starlette is a lightweight [ASGI](https://asgi.readthedocs.io/en/latest/) framework/toolkit, which is ideal for building async web services in Python.

It is production-ready, and gives you the following:

- A lightweight, low-complexity HTTP web framework.
- WebSocket support.
- In-process background tasks.
- Startup and shutdown events.
- Test client built on `httpx2`.
- CORS, GZip, Static Files, Streaming responses.
- Session and Cookie support.
- 100% test coverage.
- 100% type annotated codebase.
- Few hard dependencies.
- Compatible with `asyncio` and `trio` backends.
- Great overall performance [against independent benchmarks](https://github.com/TechEmpower/FrameworkBenchmarks).

## Installation

```
$ pip install starlette
```

You'll also want to install an ASGI server, such as [uvicorn](https://uvicorn.dev) or any of the [other ASGI server implementations](https://asgi.readthedocs.io/en/latest/implementations.html#servers).

```
$ pip install uvicorn
```

## Example

```
from starlette.applications import Starlette
from starlette.responses import JSONResponse
from starlette.routing import Route


async def homepage(request):
    return JSONResponse({'hello': 'world'})

routes = [
    Route("/", endpoint=homepage)
]

app = Starlette(debug=True, routes=routes)
```

Then run the application using Uvicorn:

```
$ uvicorn main:app
```

## Dependencies

Starlette only requires `anyio`, and the following are optional:

- [`httpx2`](https://pypi.org/project/httpx2/) - Required if you want to use the `TestClient`.
- [`jinja2`](https://jinja.palletsprojects.com/) - Required if you want to use `Jinja2Templates`.
- [`opentelemetry-api`](https://opentelemetry.io/docs/languages/python/api/) - Required for `OpenTelemetryMiddleware`.
- [`python-multipart`](https://multipart.fastapiexpert.com/) - Required if you want to support form parsing, with `request.form()`.
- [`itsdangerous`](https://itsdangerous.palletsprojects.com/) - Required for `SessionMiddleware` support.
- [`pyyaml`](https://pyyaml.org/wiki/PyYAMLDocumentation) - Required for `SchemaGenerator` support.

You can install all of these with `pip install starlette[full]`.

## Framework or Toolkit

Starlette is designed to be used either as a complete framework, or as an ASGI toolkit. You can use any of its components independently.

```
from starlette.responses import PlainTextResponse


async def app(scope, receive, send):
    assert scope['type'] == 'http'
    response = PlainTextResponse('Hello, world!')
    await response(scope, receive, send)
```

Run the `app` application in `example.py`:

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

Run uvicorn with `--reload` to enable auto-reloading on code changes.

## Modularity

The modularity that Starlette is designed on promotes building reusable components that can be shared between any ASGI framework. This should enable an ecosystem of shared middleware and mountable applications.

The clean API separation also means it's easier to understand each component in isolation.

---

## **Details **

<dl>

<dt>Version</dt>
<dd>1.10.0</dd>

<dt>License</dt>
<dd>BSD-3-Clause</dd>

<dt>Python</dt>
<dd>&gt;=3.11</dd>

<dt>Maintainer</dt>
<dd>Tom Christie &lt;tom@tomchristie.com&gt;</dd></dl>

## **Links**

- [Changelog](https://starlette.dev/release-notes/)
- [Documentation](https://starlette.dev/)
- [Funding](https://github.com/sponsors/Kludex)
- [Homepage](https://github.com/Kludex/starlette)
- [Source](https://github.com/Kludex/starlette)
- [View on PyPI](https://pypi.org/project/starlette/)

## **Release Cadence **

**20**

releases in the past year

avg 15 days between releases

## **Maintainers **

- Tom Christie · [tom@tomchristie.com](mailto:tom@tomchristie.com)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/starlette#webpage","@type":"WebPage","description":"The little ASGI library that shines.","name":"starlette","url":"https://pypx.app/packages/starlette","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/starlette"]}]},{"@id":"https://pypx.app/packages/starlette#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"The little ASGI library that shines.","license":"BSD-3-Clause","name":"starlette","softwareVersion":"1.10.0"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
