Muffin
Fast, lightweight, asynchronous ASGI web framework for Python 3.11+. Documentation: https://klen.github.io/muffin
Why Muffin?
Muffin combines the simplicity of microframeworks with native ASGI performance, supporting multiple async libraries (Asyncio, Trio, Curio) out of the box. Its plugin ecosystem covers templating, databases, auth and more.
Key features:
- ASGI compatible
- Competitive performance
- Supports Asyncio, Trio and Curio
- Multiple response types: text, HTML, JSON, streams, files, SSE, WebSockets
- First-class plugin system
Installation
Muffin requires Python 3.11 or newer. We recommend using the latest stable Python.
$ pip install muffin
For the standard installation with gunicorn, uvicorn, uvloop and httptools:
$ pip install muffin[standard]
Dependencies 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-jinja2: Jinja2 templates (asyncio/trio/curio)
- muffin-session: signed cookie-based HTTP sessions
- muffin-oauth: OAuth1/OAuth2 integration
- muffin-sentry: Sentry error tracking
- muffin-peewee-aio: Peewee ORM integration with async support
- muffin-babel: localization with Babel
- muffin-databases: async support for a range of databases
- muffin-mongo: MongoDB integration
- muffin-redis: Redis integration
- muffin-rest: REST helpers
- muffin-apiclient: support for external APIs
- muffin-grpc: gRPC support
- muffin-kafka: Kafka integration
- muffin-admin: admin interface
- 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.
License
Muffin is licensed under the MIT license.
Credits
Muffin > 0.40 (completely rewritten on ASGI)
Muffin < 0.40 (based on AIOHTTP)
Metadata
Release files for muffin 3.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| muffin-3.4.1.tar.gz | 13.9 kB | Without provenance | Details for muffin-3.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| muffin-3.4.1-py3-none-any.whl | Python 3 | none | any | Details for muffin-3.4.1-py3-none-any.whl |
Total release size: 31.1 kB
Release files / muffin-3.4.1.tar.gz
| Download URL | muffin-3.4.1.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fbc05e7fb4d23b74c89605e816e9cbaeee53adaf17688fe5d02fa90b7df9ba34
|
|
BLAKE2b-256 checksum How to use checksums |
68573b80074c3cdcc963886c0f36615c922b84cb0797e92adde6dc196a103ba0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / muffin-3.4.1-py3-none-any.whl
| Download URL | muffin-3.4.1-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8bfccdcd7215ec4990935aa58028eacdbafbb372131fc41b134c95991822b9d7
|
|
BLAKE2b-256 checksum How to use checksums |
16c1c269489431607e6b0c7c4398fba19d38322c9b45c5640202c5d124b39c5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for muffin 3.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.