Muffin is a fast, simple and asyncronous web-framework for Python 3 (asyncio, trio, curio)
Project description
Muffin – fast, lightweight, and asynchronous ASGI web framework for Python 3.10+.
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.10 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_)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file muffin-1.4.2.tar.gz.
File metadata
- Download URL: muffin-1.4.2.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb82ee29d94547f8e97328d85ef3c2b4a29bfc32ec14ff1516e7e5c4b2b25e35
|
|
| MD5 |
c28e0c332d12c45d547807bcd3bf50e8
|
|
| BLAKE2b-256 |
07ad33859fc727fcfa76d9ef5a75540f6ebf33b4bec98d464814ef2c1c57b1df
|
File details
Details for the file muffin-1.4.2-py3-none-any.whl.
File metadata
- Download URL: muffin-1.4.2-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d2a5ee39636e3d8f3595ca503b4b36f69b2e2aedc547d9e9e5709d86fc13557
|
|
| MD5 |
2695c46a9abe4e3457f3fbf89c046080
|
|
| BLAKE2b-256 |
b16456fca4b53314568dc9795f187cda467c4bcd0c07e0afb3a546308d4e490d
|