quart-flask-patch


Namequart-flask-patch JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/pgjones/quart-flask-patch/
SummaryQuart-Flask-Patch is a Quart extension that patches Quart to work with Flask extensions.
upload_time2023-11-19 21:54:01
maintainer
docs_urlNone
authorpgjones
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Quart-Flask-Patch
=================

|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,

.. code-block:: python

   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,

- `Flask-BCrypt <https://flask-bcrypt.readthedocs.io>`_
- `Flask-Caching <https://flask-caching.readthedocs.io>`_
- `Flask-KVSession <https://github.com/mbr/flask-kvsession>`_
- `Flask-Limiter <https://github.com/alisaifee/flask-limiter/>`_ See
  also `Quart-Rate-Limiter
  <https://github.com/pgjones/quart-rate-limiter>`_
- `Flask-Login <https://github.com/maxcountryman/flask-login/>`_ See
  also `Quart-Login <https://github.com/0000matteo0000/quart-login>`_
  or `Quart-Auth <https://github.com/pgjones/quart-auth>`_
- `Flask-Mail <https://pythonhosted.org/Flask-Mail/>`_
- `Flask-Mako <https://pythonhosted.org/Flask-Mako/>`_
- `Flask-Seasurf <https://github.com/maxcountryman/flask-seasurf/>`_
- `Flask-SQLAlchemy <https://flask-sqlalchemy.palletsprojects.com>`_
  See also `Quart-DB <https://github.com/pgjones/quart-db>`_
- `Flask-WTF <https://flask-wtf.readthedocs.io>`_

Extensions known not to work
----------------------------

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

- `Flask-CORS <https://github.com/corydolphin/flask-cors>`_, as it
  uses ``app.make_response`` which must be awaited. Try `Quart-CORS
  <https://github.com/pgjones/quart-cors>`_ instead.
- `Flask-Restful <https://flask-restful.readthedocs.io>`_
  as it subclasses the Quart (app) class with synchronous methods
  overriding asynchronous methods. Try `Quart-OpenApi
  <https://github.com/factset/quart-openapi/>`_ or `Quart-Schema
  <https://github.com/pgjones/quart-schema>`_ instead.

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
<https://github.com/pgjones/quart-flask-patch>`_. If you come across
an issue, or have a feature request please open an `issue
<https://github.com/pgjones/quart-flask-patch/issues>`_. If you want
to contribute a fix or the feature-implementation please do (typo
fixes welcome), by proposing a `merge request
<https://github.com/pgjones/quart-flask-patch/merge_requests>`_.

Testing
~~~~~~~

The best way to test Quart-Flask-Patch is with `Tox
<https://tox.readthedocs.io>`_,

.. code-block:: console

    $ pip install tox
    $ tox

this will check the code style and run the tests.

Help
----

The Quart-Flask-Patch `documentation
<https://quart-flask-patch.readthedocs.io/en/latest/>`_ is the best
places to start, after that try searching `stack overflow
<https://stackoverflow.com/questions/tagged/quart>`_ or ask for help
`on gitter <https://gitter.im/python-quart/lobby>`_. If you still
can't find an answer please `open an issue
<https://github.com/pgjones/quart-flask-patch/issues>`_.


.. |Build Status| image:: https://github.com/pgjones/quart-flask-patch/actions/workflows/ci.yml/badge.svg
   :target: https://github.com/pgjones/quart-flask-patch/commits/main

.. |pypi| image:: https://img.shields.io/pypi/v/quart-flask-patch.svg
   :target: https://pypi.python.org/pypi/Quart-Flask-Patch/

.. |python| image:: https://img.shields.io/pypi/pyversions/quart-flask-patch.svg
   :target: https://pypi.python.org/pypi/Quart-Flask-Patch/

.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg
   :target: https://github.com/pgjones/quart-flask-patch/blob/main/LICENSE


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pgjones/quart-flask-patch/",
    "name": "quart-flask-patch",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "pgjones",
    "author_email": "philip.graham.jones@googlemail.com",
    "download_url": "https://files.pythonhosted.org/packages/f6/5f/f1e7642a719ccdd8ef40af4529ba5f0984f90b480dfdce87142826801e6e/quart_flask_patch-0.3.0.tar.gz",
    "platform": null,
    "description": "Quart-Flask-Patch\n=================\n\n|Build Status| |pypi| |python| |license|\n\nQuart-Flask-Patch is a Quart extension that patches Quart to work with\nFlask extensions.\n\nQuickstart\n----------\n\nQuart-Flask-Patch must be imported first in your main module, so that\nthe patching occurs before any other code is initialised. For example,\nif you want to use Flask-Login,\n\n.. code-block:: python\n\n   import quart_flask_patch\n\n   from quart import Quart\n   import flask_login\n\n   app = Quart(__name__)\n   login_manager = flask_login.LoginManager()\n   login_manager.init_app(app)\n\nExtensions known to work\n------------------------\n\nThe following flask extensions are tested and known to work with\nquart,\n\n- `Flask-BCrypt <https://flask-bcrypt.readthedocs.io>`_\n- `Flask-Caching <https://flask-caching.readthedocs.io>`_\n- `Flask-KVSession <https://github.com/mbr/flask-kvsession>`_\n- `Flask-Limiter <https://github.com/alisaifee/flask-limiter/>`_ See\n  also `Quart-Rate-Limiter\n  <https://github.com/pgjones/quart-rate-limiter>`_\n- `Flask-Login <https://github.com/maxcountryman/flask-login/>`_ See\n  also `Quart-Login <https://github.com/0000matteo0000/quart-login>`_\n  or `Quart-Auth <https://github.com/pgjones/quart-auth>`_\n- `Flask-Mail <https://pythonhosted.org/Flask-Mail/>`_\n- `Flask-Mako <https://pythonhosted.org/Flask-Mako/>`_\n- `Flask-Seasurf <https://github.com/maxcountryman/flask-seasurf/>`_\n- `Flask-SQLAlchemy <https://flask-sqlalchemy.palletsprojects.com>`_\n  See also `Quart-DB <https://github.com/pgjones/quart-db>`_\n- `Flask-WTF <https://flask-wtf.readthedocs.io>`_\n\nExtensions known not to work\n----------------------------\n\nThe following flask extensions have been tested are known not to work\nwith quart,\n\n- `Flask-CORS <https://github.com/corydolphin/flask-cors>`_, as it\n  uses ``app.make_response`` which must be awaited. Try `Quart-CORS\n  <https://github.com/pgjones/quart-cors>`_ instead.\n- `Flask-Restful <https://flask-restful.readthedocs.io>`_\n  as it subclasses the Quart (app) class with synchronous methods\n  overriding asynchronous methods. Try `Quart-OpenApi\n  <https://github.com/factset/quart-openapi/>`_ or `Quart-Schema\n  <https://github.com/pgjones/quart-schema>`_ instead.\n\nCaveats\n-------\n\nFlask extensions must use the global request proxy variable to access\nthe request, any other access e.g. via\n``~quart.local.LocalProxy._get_current_object`` will require\nasynchronous access. To enable this the request body must be fully\nreceived before any part of the request is handled, which is a\nlimitation not present in vanilla flask.\n\nTrying to use Flask alongside Quart in the same runtime will likely\nnot work, and lead to surprising errors.\n\nThe flask extension must be limited to creating routes, using the\nrequest and rendering templates. Any other more advanced functionality\nmay not work.\n\nSynchronous functions will not run in a separate thread (unlike Quart\nnormally) and hence may block the event loop.\n\nFinally the flask_patching system also relies on patching asyncio, and\nhence other implementations or event loop policies are unlikely to\nwork.\n\nContributing\n------------\n\nQuart-Flask-Patch is developed on `GitHub\n<https://github.com/pgjones/quart-flask-patch>`_. If you come across\nan issue, or have a feature request please open an `issue\n<https://github.com/pgjones/quart-flask-patch/issues>`_. If you want\nto contribute a fix or the feature-implementation please do (typo\nfixes welcome), by proposing a `merge request\n<https://github.com/pgjones/quart-flask-patch/merge_requests>`_.\n\nTesting\n~~~~~~~\n\nThe best way to test Quart-Flask-Patch is with `Tox\n<https://tox.readthedocs.io>`_,\n\n.. code-block:: console\n\n    $ pip install tox\n    $ tox\n\nthis will check the code style and run the tests.\n\nHelp\n----\n\nThe Quart-Flask-Patch `documentation\n<https://quart-flask-patch.readthedocs.io/en/latest/>`_ is the best\nplaces to start, after that try searching `stack overflow\n<https://stackoverflow.com/questions/tagged/quart>`_ or ask for help\n`on gitter <https://gitter.im/python-quart/lobby>`_. If you still\ncan't find an answer please `open an issue\n<https://github.com/pgjones/quart-flask-patch/issues>`_.\n\n\n.. |Build Status| image:: https://github.com/pgjones/quart-flask-patch/actions/workflows/ci.yml/badge.svg\n   :target: https://github.com/pgjones/quart-flask-patch/commits/main\n\n.. |pypi| image:: https://img.shields.io/pypi/v/quart-flask-patch.svg\n   :target: https://pypi.python.org/pypi/Quart-Flask-Patch/\n\n.. |python| image:: https://img.shields.io/pypi/pyversions/quart-flask-patch.svg\n   :target: https://pypi.python.org/pypi/Quart-Flask-Patch/\n\n.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg\n   :target: https://github.com/pgjones/quart-flask-patch/blob/main/LICENSE\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Quart-Flask-Patch is a Quart extension that patches Quart to work with Flask extensions.",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/pgjones/quart-flask-patch/",
        "Repository": "https://github.com/pgjones/quart-flask-patch/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cbcead2b19e3a26d2c611aa883b8500e8b4eb08f8a2d1595e28c37864e54e99c",
                "md5": "0dade1b2d381b9599dc941b275a6e2c1",
                "sha256": "b5a1d97a8edee9f40082db278fb491687d712af9bc8eb774830ea6f92790b990"
            },
            "downloads": -1,
            "filename": "quart_flask_patch-0.3.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0dade1b2d381b9599dc941b275a6e2c1",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 9231,
            "upload_time": "2023-11-19T21:53:59",
            "upload_time_iso_8601": "2023-11-19T21:53:59.814242Z",
            "url": "https://files.pythonhosted.org/packages/cb/ce/ad2b19e3a26d2c611aa883b8500e8b4eb08f8a2d1595e28c37864e54e99c/quart_flask_patch-0.3.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f65ff1e7642a719ccdd8ef40af4529ba5f0984f90b480dfdce87142826801e6e",
                "md5": "113c59f74cc5773a569a7e716a0aee39",
                "sha256": "81dc073698d54ffe1d8c85a556881c13215923a920f9300a02b5005d5447268d"
            },
            "downloads": -1,
            "filename": "quart_flask_patch-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "113c59f74cc5773a569a7e716a0aee39",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8754,
            "upload_time": "2023-11-19T21:54:01",
            "upload_time_iso_8601": "2023-11-19T21:54:01.332135Z",
            "url": "https://files.pythonhosted.org/packages/f6/5f/f1e7642a719ccdd8ef40af4529ba5f0984f90b480dfdce87142826801e6e/quart_flask_patch-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-19 21:54:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pgjones",
    "github_project": "quart-flask-patch",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "quart-flask-patch"
}
        
Elapsed time: 0.76465s