Muffin – fast, lightweight, and asynchronous ASGI web framework for Python 3.11+.
Why Muffin?
Muffin combines the simplicity of microframeworks with native ASGI performance, supporting multiple async libraries (Asyncio, Trio, Curio) out of the box. Its rich plugin ecosystem makes building modern web applications pleasant and efficient.
Key Features
ASGI compatible
Competitive performance ([Benchmarks](http://klen.github.io/py-frameworks-bench/))
Multiple response types: text, HTML, JSON, streams, files, SSE, WebSockets
First-class plugin system for templating, databases, auth, and more
Installation
Muffin requires Python 3.11 or newer. We recommend using the latest stable Python.
Install via pip:
$ pip install muffin
For the standard installation with gunicorn, uvicorn, uvloop, httptools:
$ pip install muffin[standard]
Dependencies
These packages will be installed automatically:
ASGI-Tools – ASGI toolkit
Modconfig – hierarchical configuration manager
Quickstart
Create a simple “Hello User” app:
import muffin
app = muffin.Application()
@app.route('/', '/hello/{name}')
async def hello(request):
name = request.path_params.get('name', 'world')
return f'Hello, {name.title()}!'
Save this as example.py and run:
$ uvicorn example:app
Visit http://localhost:8000 or http://localhost:8000/hello/username in your browser.
Plugins
Muffin has a rich ecosystem of plugins:
[muffin-jinja2](https://github.com/klen/muffin-jinja2) – Jinja2 templates (asyncio/trio/curio)
[muffin-session](https://github.com/klen/muffin-session) – Signed cookie-based HTTP sessions
[muffin-oauth](https://github.com/klen/muffin-oauth) – OAuth integration
[muffin-sentry](https://github.com/klen/muffin-sentry) – Sentry error tracking
[muffin-peewee](https://github.com/klen/muffin-peewee-aio) – Peewee ORM integration
[muffin-babel](https://github.com/klen/muffin-babel) – i18n support
[muffin-databases](https://github.com/klen/muffin-databases) – SQL database support
[muffin-mongo](https://github.com/klen/muffin-mongo) – MongoDB integration
[muffin-rest](https://github.com/klen/muffin-rest) – REST API utilities
[muffin-redis](https://github.com/klen/muffin-redis) – Redis integration
[muffin-admin](https://github.com/klen/muffin-admin) – Auto-generated admin UI
[muffin-prometheus](https://github.com/klen/muffin-prometheus) – Prometheus metrics exporter
See each repo for usage and installation instructions.
Benchmarks
Performance comparisons are available at: http://klen.github.io/py-frameworks-bench/
Bug tracker
Found a bug or have a feature request? Please open an issue at: https://github.com/klen/muffin/issues
Contributing
Contributions are welcome! Please see [CONTRIBUTING.md](https://github.com/klen/muffin/blob/develop/CONTRIBUTING.md) for guidelines.
License
Muffin is licensed under the MIT license.
Credits
Muffin > 0.40 (completely rewritten on ASGI)
Muffin < 0.40 (based on AIOHTTP_)
Release files for muffin 2.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| muffin-2.0.2.tar.gz | 12.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| muffin-2.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.1 kB
Release files / muffin-2.0.2.tar.gz
| Download URL | muffin-2.0.2.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1fe07e6fa4827b2c069fa633dc3943dc417e187cb9d90cf096ad8a6fe3995872
|
|
BLAKE2b-256 checksum How to use checksums |
7bf0c4349e5761c5a178ab360801660ba75c8072b19b99d6fc918957cdcb4cdb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / muffin-2.0.2-py3-none-any.whl
| Download URL | muffin-2.0.2-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e8b1665f116f9a393a7251589d0c9cbc0f22b2b7ad249c14bcbc9a37defd5c91
|
|
BLAKE2b-256 checksum How to use checksums |
96f6c473988e1054b1ac58449c47b0dd943dd764684c4a76f9f4ce241a8e149a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|