A Python ASGI web microframework with the same API as Flask
Project description
Quart is an async Python web microframework. 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
Quart can be installed via pip,
$ pip install quart
and requires Python 3.8.0 or higher (see python version support for reasoning).
A minimal Quart example is,
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"})
if __name__ == "__main__":
app.run()
if the above is in a file called app.py it can be run as,
$ python app.py
To deploy this app in a production setting see the deployment documentation.
Contributing
Quart is developed on GitHub. If you come across an issue, or have a feature request please open an issue. If you want to contribute a fix or the feature-implementation please do (typo fixes welcome), by proposing a merge request.
Testing
The best way to test Quart is with Tox,
$ pip install tox
$ tox
this will check the code style and run the tests.
Help
The Quart documentation or cheatsheet are the best places to start, after that try searching stack overflow or ask for help on discord. If you still can’t find an answer please open an issue.
Relationship with Flask
Quart is an asyncio reimplementation of the popular Flask microframework API. 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 docs for more help.
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
File details
Details for the file quart-0.19.9.tar.gz
.
File metadata
- Download URL: quart-0.19.9.tar.gz
- Upload date:
- Size: 65.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30a61a0d7bae1ee13e6e99dc14c929b3c945e372b9445d92d21db053e91e95a5 |
|
MD5 | 473b9edb6824dd8ff79966195755f7bf |
|
BLAKE2b-256 | 07050d7a280a89b05a6b6c2224b4a1b991b7a4c52eed5e14b92c3c63ce29c235 |
Provenance
The following attestation bundles were made for quart-0.19.9.tar.gz
:
Publisher:
publish.yaml
on pallets/quart
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
quart-0.19.9.tar.gz
- Subject digest:
30a61a0d7bae1ee13e6e99dc14c929b3c945e372b9445d92d21db053e91e95a5
- Sigstore transparency entry: 148922546
- Sigstore integration time:
- Predicate type:
File details
Details for the file quart-0.19.9-py3-none-any.whl
.
File metadata
- Download URL: quart-0.19.9-py3-none-any.whl
- Upload date:
- Size: 78.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8acb8b299c72b66ee9e506ae141498bbbfcc250b5298fbdb712e97f3d7e4082f |
|
MD5 | 91db3a39fea2bdc5caad6294216e9b6a |
|
BLAKE2b-256 | a801e5d6127f6304c7e596e5c8eec5accdec0f698ec65fe342d8474ad5223717 |
Provenance
The following attestation bundles were made for quart-0.19.9-py3-none-any.whl
:
Publisher:
publish.yaml
on pallets/quart
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
quart-0.19.9-py3-none-any.whl
- Subject digest:
8acb8b299c72b66ee9e506ae141498bbbfcc250b5298fbdb712e97f3d7e4082f
- Sigstore transparency entry: 148922548
- Sigstore integration time:
- Predicate type: