.. image:: https://raw.github.com/klen/muffin/develop/docs/static/logo-h200.png
:height: 100px
.. _description:
**Muffin** -- is a fast, lightweight and asyncronous ASGI_ web-framework for Python_ 3.
.. _badges:
.. image:: https://github.com/klen/muffin/workflows/tests/badge.svg
:target: https://github.com/klen/muffin/actions
:alt: Tests Status
.. image:: https://github.com/klen/muffin/workflows/docs/badge.svg
:target: https://klen.github.io/muffin
:alt: Documentation Status
.. image:: https://img.shields.io/pypi/v/muffin
:target: https://pypi.org/project/muffin/
:alt: PYPI Version
.. image:: https://img.shields.io/pypi/pyversions/muffin
:target: https://pypi.org/project/muffin/
:alt: Python Versions
----------
.. _features:
Features
--------
- ASGI_ compatible;
- `Competitive Performance <http://klen.github.io/py-frameworks-bench/>`_;
- All async python libraries are supported (Asyncio_, Trio_, Curio_);
- Send HTTP (text, html, json, stream, file, http errors) responses
- Support WebSockets, Server Side Events
.. _documentation:
**Docs are available at https://klen.github.io/muffin/. Pull requests
with documentation enhancements and/or fixes are awesome and most welcome.**
.. _contents:
.. contents::
.. _requirements:
.. _installation:
Installation
------------
We recommend using the latest version of Python. The library supports Python
3.8 and newer (PyPy-3.9+ are supported too).
Muffin should be installed using pip: ::
pip install muffin
The command will install minimal configuration.
To install Muffin with `gunicorn`, `uvicorn`, `uvloop`, `httptools` use the
command:
.. code-block:: console
$ pip install muffin[standard]
Dependencies
````````````
These distributions will be installed automatically when installing **Muffin**.
* `ASGI-Tools`_ - ASGI_ Toolkit
* `Modconfig`_ - Simple hierarchic configuration manager
.. _ASGI-Tools: https://klen.github.io/asgi-tools/
.. _Modconfig: https://pypi.org/project/modconfig/
.. _quickstart:
Quickstart
----------
Example "Hello User" with the Muffin:
.. code-block:: python
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()}!'
What did that code do?
1. First we imported the ``muffin.Application`` class. An instance of
this class will be our application.
2. Next we create an instance of this class.
3. We then use the ``muffin.Application.route`` decorator to tell Muffin
what URLs should trigger our handler function.
4. The function returns the message we want to display in the user's browser.
Save the script as `example.py` and run it using Uvicorn (or another ASGI_ server): ::
$ uvicorn example:app
Open http://localhost:8000, http://localhost:8000/hello/username in your browser. Enjoy!
.. TODO: Finish the general example
.. For a more complete example, see https://github.com/klen/muffin-example
.. _plugins:
Plugins overview
----------------
The list of some Muffin plugins (please make PR if you want to provide more):
`Muffin-Jinja2 <https://github.com/klen/muffin-jinja2>`_
``````````````````````````````````````````````````````````
`Jinja2 <https://jinja.palletsprojects.com/en/2.11.x/>`_ templates (asyncio/trio/curio)
.. image:: https://github.com/klen/muffin-jinja2/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-jinja2/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-jinja2
:target: https://pypi.org/project/muffin-jinja2/
:alt: PYPI Version
`Muffin-Session <https://github.com/klen/muffin-session>`_
```````````````````````````````````````````````````````````
Signed Cookie-Based HTTP sessions (asyncio/trio/curio)
.. image:: https://github.com/klen/muffin-session/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-session/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-session
:target: https://pypi.org/project/muffin-session/
:alt: PYPI Version
`Muffin-OAuth <https://github.com/klen/muffin-oauth>`_
```````````````````````````````````````````````````````
Work with OAuth (authorization, resources loading) (asyncio/trio/curio)
.. image:: https://github.com/klen/muffin-oauth/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-oauth/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-oauth
:target: https://pypi.org/project/muffin-oauth/
:alt: PYPI Version
`Muffin-Sentry <https://github.com/klen/muffin-sentry>`_
`````````````````````````````````````````````````````````
Sentry integration (asyncio/trio/curio)
.. image:: https://github.com/klen/muffin-sentry/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-sentry/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-sentry
:target: https://pypi.org/project/muffin-sentry/
:alt: PYPI Version
`Muffin-Peewee <https://github.com/klen/muffin-peewee-aio>`_
`````````````````````````````````````````````````````````````
Peewee support (SQL, ORM) (asyncio/trio/curio)
.. image:: https://github.com/klen/muffin-peewee-aio/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-peewee/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-peewee-aio
:target: https://pypi.org/project/muffin-peewee-aio/
:alt: PYPI Version
`Muffin-Babel <https://github.com/klen/muffin-babel>`_
````````````````````````````````````````````````````````
Localization support (asyncio/trio/curio)
.. image:: https://github.com/klen/muffin-babel/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-babel/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-babel
:target: https://pypi.org/project/muffin-babel/
:alt: PYPI Version
`Muffin-Databases <https://github.com/klen/muffin-databases>`_
`````````````````````````````````````````````````````````````````
Work with SQL databases (asyncio only)
.. image:: https://github.com/klen/muffin-databases/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-databases/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-databases
:target: https://pypi.org/project/muffin-databases/
:alt: PYPI Version
`Muffin-Mongo <https://github.com/klen/muffin-mongo>`_
`````````````````````````````````````````````````````````
Work with Mongo DB (asyncio only)
.. image:: https://github.com/klen/muffin-mongo/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-mongo/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-mongo
:target: https://pypi.org/project/muffin-mongo/
:alt: PYPI Version
`Muffin-REST <https://github.com/klen/muffin-rest>`_
````````````````````````````````````````````````````````
The package provides enhanced support for writing REST APIs (asyncio/trio/curio)
.. image:: https://github.com/klen/muffin-rest/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-rest/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-rest
:target: https://pypi.org/project/muffin-rest/
:alt: PYPI Version
`Muffin-Redis <https://github.com/klen/muffin-redis>`_
`````````````````````````````````````````````````````````
Redis support
.. image:: https://github.com/klen/muffin-redis/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-redis/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-redis
:target: https://pypi.org/project/muffin-redis/
:alt: PYPI Version
`Muffin-Admin <https://github.com/klen/muffin-admin>`_
`````````````````````````````````````````````````````````
Automatically build Admin UI
.. image:: https://github.com/klen/muffin-admin/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-admin/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-admin
:target: https://pypi.org/project/muffin-admin/
:alt: PYPI Version
`Muffin-Prometheus <https://github.com/klen/muffin-prometheus>`_
```````````````````````````````````````````````````````````````````
Prometheus metrics exporter
.. image:: https://github.com/klen/muffin-prometheus/workflows/tests/badge.svg
:target: https://github.com/klen/muffin-prometheus/actions
:alt: Tests Status
.. image:: https://img.shields.io/pypi/v/muffin-prometheus
:target: https://pypi.org/project/muffin-prometheus/
:alt: PYPI Version
.. _benchmarks:
Benchmarks
-----------
You could find some tests here: http://klen.github.io/py-frameworks-bench/
.. _bugtracker:
Bug tracker
-----------
If you have any suggestions, bug reports or
annoyances please report them to the issue tracker
at https://github.com/klen/muffin/issues
.. _contributing:
Contributing
------------
Development of The Muffin happens at: https://github.com/klen/muffin
Contributors
-------------
Muffin > 0.40 (completelly rewriten from scratch)
* `Kirill Klenov <https://github.com/klen>`_
Muffin < 0.40 (based on AIOHTTP_)
* `Kirill Klenov <https://github.com/klen>`_
* `Andrew Grigorev <https://github.com/ei-grad>`_
* `Diego Garcia <https://github.com/drgarcia1986>`_
.. _license:
License
-------
Licensed under a `MIT license`_.
.. _links:
.. _AIOHTTP: https://docs.aiohttp.org/en/stable/
.. _ASGI: https://asgi.readthedocs.io/en/latest/
.. _Asyncio: https://docs.python.org/3/library/asyncio.html
.. _Curio: https://curio.readthedocs.io/en/latest/
.. _MIT license: http://opensource.org/licenses/MIT
.. _Python: http://python.org
.. _Trio: https://trio.readthedocs.io/en/stable/index.html
.. _klen: https://github.com/klen
Raw data
{
"_id": null,
"home_page": "https://github.com/klen/muffin",
"name": "muffin",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "asgi, web, web framework, asyncio, trio, curio",
"author": "Kirill Klenov",
"author_email": "horneds@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/47/b4/b3fb92ded8aa49b43a1cbf0910449077b03ba38bdf4ba939f7a36ee48198/muffin-0.102.3.tar.gz",
"platform": null,
"description": ".. image:: https://raw.github.com/klen/muffin/develop/docs/static/logo-h200.png\n :height: 100px\n\n.. _description:\n\n**Muffin** -- is a fast, lightweight and asyncronous ASGI_ web-framework for Python_ 3.\n\n.. _badges:\n\n.. image:: https://github.com/klen/muffin/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin/actions\n :alt: Tests Status\n\n.. image:: https://github.com/klen/muffin/workflows/docs/badge.svg\n :target: https://klen.github.io/muffin\n :alt: Documentation Status\n\n.. image:: https://img.shields.io/pypi/v/muffin\n :target: https://pypi.org/project/muffin/\n :alt: PYPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/muffin\n :target: https://pypi.org/project/muffin/\n :alt: Python Versions\n\n----------\n\n.. _features:\n\nFeatures\n--------\n\n- ASGI_ compatible;\n- `Competitive Performance <http://klen.github.io/py-frameworks-bench/>`_;\n- All async python libraries are supported (Asyncio_, Trio_, Curio_);\n- Send HTTP (text, html, json, stream, file, http errors) responses\n- Support WebSockets, Server Side Events\n\n.. _documentation:\n\n**Docs are available at https://klen.github.io/muffin/. Pull requests\nwith documentation enhancements and/or fixes are awesome and most welcome.**\n\n.. _contents:\n\n.. contents::\n\n.. _requirements:\n\n.. _installation:\n\nInstallation\n------------\n\nWe recommend using the latest version of Python. The library supports Python\n3.8 and newer (PyPy-3.9+ are supported too).\n\nMuffin should be installed using pip: ::\n\n pip install muffin\n\nThe command will install minimal configuration.\n\nTo install Muffin with `gunicorn`, `uvicorn`, `uvloop`, `httptools` use the\ncommand:\n\n.. code-block:: console\n\n $ pip install muffin[standard]\n\nDependencies\n````````````\n\nThese distributions will be installed automatically when installing **Muffin**.\n\n* `ASGI-Tools`_ - ASGI_ Toolkit\n* `Modconfig`_ - Simple hierarchic configuration manager\n\n.. _ASGI-Tools: https://klen.github.io/asgi-tools/\n.. _Modconfig: https://pypi.org/project/modconfig/\n\n.. _quickstart:\n\nQuickstart\n----------\n\nExample \"Hello User\" with the Muffin:\n\n.. code-block:: python\n\n import muffin\n\n\n app = muffin.Application()\n\n\n @app.route('/', '/hello/{name}')\n async def hello(request):\n name = request.path_params.get('name', 'world')\n return f'Hello {name.title()}!'\n\n\nWhat did that code do?\n\n1. First we imported the ``muffin.Application`` class. An instance of\n this class will be our application.\n2. Next we create an instance of this class.\n3. We then use the ``muffin.Application.route`` decorator to tell Muffin\n what URLs should trigger our handler function.\n4. The function returns the message we want to display in the user's browser.\n\n\nSave the script as `example.py` and run it using Uvicorn (or another ASGI_ server): ::\n\n $ uvicorn example:app\n\nOpen http://localhost:8000, http://localhost:8000/hello/username in your browser. Enjoy!\n\n.. TODO: Finish the general example\n.. For a more complete example, see https://github.com/klen/muffin-example\n\n.. _plugins:\n\nPlugins overview\n----------------\n\nThe list of some Muffin plugins (please make PR if you want to provide more):\n\n`Muffin-Jinja2 <https://github.com/klen/muffin-jinja2>`_\n``````````````````````````````````````````````````````````\n\n`Jinja2 <https://jinja.palletsprojects.com/en/2.11.x/>`_ templates (asyncio/trio/curio)\n\n.. image:: https://github.com/klen/muffin-jinja2/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-jinja2/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-jinja2\n :target: https://pypi.org/project/muffin-jinja2/\n :alt: PYPI Version\n\n\n\n`Muffin-Session <https://github.com/klen/muffin-session>`_\n```````````````````````````````````````````````````````````\n\nSigned Cookie-Based HTTP sessions (asyncio/trio/curio)\n\n.. image:: https://github.com/klen/muffin-session/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-session/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-session\n :target: https://pypi.org/project/muffin-session/\n :alt: PYPI Version\n\n\n`Muffin-OAuth <https://github.com/klen/muffin-oauth>`_\n```````````````````````````````````````````````````````\n\nWork with OAuth (authorization, resources loading) (asyncio/trio/curio)\n\n.. image:: https://github.com/klen/muffin-oauth/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-oauth/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-oauth\n :target: https://pypi.org/project/muffin-oauth/\n :alt: PYPI Version\n\n\n`Muffin-Sentry <https://github.com/klen/muffin-sentry>`_\n`````````````````````````````````````````````````````````\n\nSentry integration (asyncio/trio/curio)\n\n.. image:: https://github.com/klen/muffin-sentry/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-sentry/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-sentry\n :target: https://pypi.org/project/muffin-sentry/\n :alt: PYPI Version\n\n\n`Muffin-Peewee <https://github.com/klen/muffin-peewee-aio>`_\n`````````````````````````````````````````````````````````````\n\nPeewee support (SQL, ORM) (asyncio/trio/curio)\n\n.. image:: https://github.com/klen/muffin-peewee-aio/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-peewee/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-peewee-aio\n :target: https://pypi.org/project/muffin-peewee-aio/\n :alt: PYPI Version\n\n\n`Muffin-Babel <https://github.com/klen/muffin-babel>`_\n````````````````````````````````````````````````````````\n\nLocalization support (asyncio/trio/curio)\n\n.. image:: https://github.com/klen/muffin-babel/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-babel/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-babel\n :target: https://pypi.org/project/muffin-babel/\n :alt: PYPI Version\n\n\n`Muffin-Databases <https://github.com/klen/muffin-databases>`_\n`````````````````````````````````````````````````````````````````\n\nWork with SQL databases (asyncio only)\n\n.. image:: https://github.com/klen/muffin-databases/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-databases/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-databases\n :target: https://pypi.org/project/muffin-databases/\n :alt: PYPI Version\n\n\n`Muffin-Mongo <https://github.com/klen/muffin-mongo>`_\n`````````````````````````````````````````````````````````\n\nWork with Mongo DB (asyncio only)\n\n.. image:: https://github.com/klen/muffin-mongo/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-mongo/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-mongo\n :target: https://pypi.org/project/muffin-mongo/\n :alt: PYPI Version\n\n`Muffin-REST <https://github.com/klen/muffin-rest>`_\n````````````````````````````````````````````````````````\n\nThe package provides enhanced support for writing REST APIs (asyncio/trio/curio)\n\n.. image:: https://github.com/klen/muffin-rest/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-rest/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-rest\n :target: https://pypi.org/project/muffin-rest/\n :alt: PYPI Version\n\n`Muffin-Redis <https://github.com/klen/muffin-redis>`_\n`````````````````````````````````````````````````````````\n\nRedis support\n\n.. image:: https://github.com/klen/muffin-redis/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-redis/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-redis\n :target: https://pypi.org/project/muffin-redis/\n :alt: PYPI Version\n\n`Muffin-Admin <https://github.com/klen/muffin-admin>`_\n`````````````````````````````````````````````````````````\n\nAutomatically build Admin UI\n\n.. image:: https://github.com/klen/muffin-admin/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-admin/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-admin\n :target: https://pypi.org/project/muffin-admin/\n :alt: PYPI Version\n\n`Muffin-Prometheus <https://github.com/klen/muffin-prometheus>`_\n```````````````````````````````````````````````````````````````````\n\nPrometheus metrics exporter\n\n.. image:: https://github.com/klen/muffin-prometheus/workflows/tests/badge.svg\n :target: https://github.com/klen/muffin-prometheus/actions\n :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/muffin-prometheus\n :target: https://pypi.org/project/muffin-prometheus/\n :alt: PYPI Version\n\n.. _benchmarks:\n\nBenchmarks\n-----------\n\nYou could find some tests here: http://klen.github.io/py-frameworks-bench/\n\n.. _bugtracker:\n\nBug tracker\n-----------\n\nIf you have any suggestions, bug reports or\nannoyances please report them to the issue tracker\nat https://github.com/klen/muffin/issues\n\n.. _contributing:\n\nContributing\n------------\n\nDevelopment of The Muffin happens at: https://github.com/klen/muffin\n\n\nContributors\n-------------\n\nMuffin > 0.40 (completelly rewriten from scratch)\n\n* `Kirill Klenov <https://github.com/klen>`_\n\nMuffin < 0.40 (based on AIOHTTP_)\n\n* `Kirill Klenov <https://github.com/klen>`_\n* `Andrew Grigorev <https://github.com/ei-grad>`_\n* `Diego Garcia <https://github.com/drgarcia1986>`_\n\n.. _license:\n\nLicense\n-------\n\nLicensed under a `MIT license`_.\n\n.. _links:\n\n.. _AIOHTTP: https://docs.aiohttp.org/en/stable/\n.. _ASGI: https://asgi.readthedocs.io/en/latest/\n.. _Asyncio: https://docs.python.org/3/library/asyncio.html\n.. _Curio: https://curio.readthedocs.io/en/latest/\n.. _MIT license: http://opensource.org/licenses/MIT\n.. _Python: http://python.org\n.. _Trio: https://trio.readthedocs.io/en/stable/index.html\n.. _klen: https://github.com/klen\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Muffin is a fast, simple and asyncronous web-framework for Python 3 (asyncio, trio, curio)",
"version": "0.102.3",
"project_urls": {
"Documentation": "https://klen.github.io/muffin",
"Homepage": "https://github.com/klen/muffin",
"Repository": "https://github.com/klen/muffin",
"changelog": "https://raw.githubusercontent.com/klen/muffin/master/CHANGELOG.md"
},
"split_keywords": [
"asgi",
" web",
" web framework",
" asyncio",
" trio",
" curio"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "af1ec004c8e075f47fa0b6b6f03aea1599e0e73e29d0cfb8816476c898f1fe94",
"md5": "e38e48f6643a89b5dc70263049ebc77d",
"sha256": "d0995ae8a8dbb71de1f729d93010763a7768ce53129bbd3d3316e80705a3d15a"
},
"downloads": -1,
"filename": "muffin-0.102.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e38e48f6643a89b5dc70263049ebc77d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 15773,
"upload_time": "2024-07-31T16:34:44",
"upload_time_iso_8601": "2024-07-31T16:34:44.733258Z",
"url": "https://files.pythonhosted.org/packages/af/1e/c004c8e075f47fa0b6b6f03aea1599e0e73e29d0cfb8816476c898f1fe94/muffin-0.102.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "47b4b3fb92ded8aa49b43a1cbf0910449077b03ba38bdf4ba939f7a36ee48198",
"md5": "541f8bc298dfb6dc622e0061b1d18e03",
"sha256": "a294704fc01f9c0972b11a4750c876ea44097bcadf3895ee709b9da1941dc8bc"
},
"downloads": -1,
"filename": "muffin-0.102.3.tar.gz",
"has_sig": false,
"md5_digest": "541f8bc298dfb6dc622e0061b1d18e03",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 15206,
"upload_time": "2024-07-31T16:34:48",
"upload_time_iso_8601": "2024-07-31T16:34:48.320390Z",
"url": "https://files.pythonhosted.org/packages/47/b4/b3fb92ded8aa49b43a1cbf0910449077b03ba38bdf4ba939f7a36ee48198/muffin-0.102.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-31 16:34:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "klen",
"github_project": "muffin",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "muffin"
}