MCPcopy
hub / github.com/pallets/quart

github.com/pallets/quart @0.20.0 sqlite

repository ↗ · DeepWiki ↗ · release 0.20.0 ↗
885 symbols 3,634 edges 72 files 169 documented · 19%
README

Quart

Quart is an async Python web application framework. Using Quart you can,

  • render and serve HTML templates,
  • write (RESTful) JSON APIs,
  • serve WebSockets,
  • stream request and response data,
  • do pretty much anything over the HTTP or WebSocket protocols.

Quickstart

Install from PyPI using an installer such as pip.

$ pip install quart

Save the following as app.py. This shows off rendering a template, returning JSON data, and using a WebSocket.

from quart import Quart, render_template, websocket

app = Quart(__name__)

@app.route("/")
async def hello():
    return await render_template("index.html")

@app.route("/api")
async def json():
    return {"hello": "world"}

@app.websocket("/ws")
async def ws():
    while True:
        await websocket.send("hello")
        await websocket.send_json({"hello": "world"})
$ quart run
 * Running on http://127.0.0.1:5000 (CTRL + C to quit)

To deploy this app in a production setting see the deployment documentation.

Contributing

Quart is developed on GitHub. If you come across a bug, or have a feature request, please open an issue. To contribute a fix or implement a feature, follow our contributing guide.

Help

If you need help with your code, the Quart documentation and cheatsheet are the best places to start. You can ask for help on the Discussions tab or on our Discord chat.

Relationship with Flask

Quart is an asyncio reimplementation of the popular Flask web application framework. This means that if you understand Flask you understand Quart.

Like Flask, Quart has an ecosystem of extensions for more specific needs. In addition, a number of the Flask extensions work with Quart.

Migrating from Flask

It should be possible to migrate to Quart from Flask by a find and replace of flask to quart and then adding async and await keywords. See the migration documentation for more help.

Core symbols most depended-on inside this repo

get_data
called by 69
src/quart/wrappers/request.py
append
called by 51
src/quart/wrappers/request.py
get
called by 48
src/quart/typing.py
get
called by 31
src/quart/testing/client.py
ensure_async
called by 27
src/quart/app.py
url_for
called by 23
src/quart/helpers.py
app_context
called by 23
src/quart/app.py
pop
called by 22
src/quart/ctx.py

Shape

Function 412
Method 362
Class 63
Route 48

Languages

Python100%

Modules by API surface

tests/test_blueprints.py68 symbols
src/quart/app.py64 symbols
src/quart/typing.py56 symbols
src/quart/wrappers/response.py49 symbols
tests/test_basic.py42 symbols
tests/test_testing.py41 symbols
src/quart/ctx.py39 symbols
tests/test_app.py34 symbols
src/quart/cli.py33 symbols
tests/test_helpers.py32 symbols
src/quart/wrappers/request.py27 symbols
src/quart/testing/connections.py27 symbols

Dependencies from manifests, versioned

aiofiles
blinker1.6 · 1×
click8.0 · 1×
flask3.0 · 1×
hypercorn0.11.2 · 1×
itsdangerous
jinja2
markupsafe
werkzeug3.0 · 1×

For agents

$ claude mcp add quart \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact