Skip to main content

Quart-Flask-Patch is a Quart extension that patches Quart to work with Flask extensions.

Project description

Build Status pypi python license

Quart-Flask-Patch is a Quart extension that patches Quart to work with Flask extensions.

Quickstart

Quart-Flask-Patch must be imported first in your main module, so that the patching occurs before any other code is initialised. For example, if you want to use Flask-Login,

import quart_flask_patch

from quart import Quart
import flask_login

app = Quart(__name__)
login_manager = flask_login.LoginManager()
login_manager.init_app(app)

Extensions known to work

The following flask extensions are tested and known to work with quart,

Extensions known not to work

The following flask extensions have been tested are known not to work with quart,

Caveats

Flask extensions must use the global request proxy variable to access the request, any other access e.g. via ~quart.local.LocalProxy._get_current_object will require asynchronous access. To enable this the request body must be fully received before any part of the request is handled, which is a limitation not present in vanilla flask.

Trying to use Flask alongside Quart in the same runtime will likely not work, and lead to surprising errors.

The flask extension must be limited to creating routes, using the request and rendering templates. Any other more advanced functionality may not work.

Synchronous functions will not run in a separate thread (unlike Quart normally) and hence may block the event loop.

Finally the flask_patching system also relies on patching asyncio, and hence other implementations or event loop policies are unlikely to work.

Contributing

Quart-Flask-Patch 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-Flask-Patch is with Tox,

$ pip install tox
$ tox

this will check the code style and run the tests.

Help

The Quart-Flask-Patch documentation is the best places to start, after that try searching stack overflow or ask for help on gitter. If you still can’t find an answer please open an issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quart_flask_patch-0.1.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

quart_flask_patch-0.1.0-py2.py3-none-any.whl (8.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file quart_flask_patch-0.1.0.tar.gz.

File metadata

  • Download URL: quart_flask_patch-0.1.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.8.2 Linux/5.4.0-1085-aws

File hashes

Hashes for quart_flask_patch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e53a0e3b707c826cd1029e4d1edd31a8f26841fe9e1d5bd20cc8f6038a383341
MD5 1906a319adf6399179e2198690b22846
BLAKE2b-256 98dd769af3e9b6c0c4ecad517b53206bc97530ab89117517fafb168137269a3f

See more details on using hashes here.

File details

Details for the file quart_flask_patch-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for quart_flask_patch-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8408ca7e2b794e0217262b30e30d8dbb5d84be6a965290a5cd9a1e13a78e43c2
MD5 2cae36e67185902ca87e543b929d852e
BLAKE2b-256 c87946a13313e1d14e0ee79fc82886f46a0c60686ab16cb82a431c49a916cfc3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page