flask-autoinject


Nameflask-autoinject JSON
Version 2.0.2 PyPI version JSON
download
home_pagehttps://github.com/turnbullerin/flask_autoinject
SummaryFlask support for dependency injection with autoinject
upload_time2023-03-27 02:01:10
maintainer
docs_urlNone
authorErin Turnbull
requires_python>=3.7
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Flask AutoInject

Flask integration to provide separate contexts 
for each request regardless of the underlying 
WSGI handler.

As of version 1.1.0, you MUST use the `init_app()` function
to properly use `autoinject` with Flask contexts. Previously,
the informant was registered automatically. Calling `init_app()` 
now (as of 2.0.0) uses the new contextvars integration in `autoinject`
by wrapping the call to wsgi_app() in an `autoinject.with_contextvars()`
decorator. This ensures that injected functions are cleaned up when the call
to wsgi_app() ends and prevents any ordering problems in terms of the 
teardown functions.

Note that this module does not provide management of autoinjected variables
outside of the context of a call to wsgi_app() (essentially from app config push to 
teardown). Any other management you will need to provide yourself.

```python
import flask
import flask_autoinject

app = flask.Flask(__name__)
flask_autoinject.init_app(app)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/turnbullerin/flask_autoinject",
    "name": "flask-autoinject",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Erin Turnbull",
    "author_email": "erin.a.turnbull@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/be/b9/2c5d03cebb200f721b93bb0c5e31ed647782669f4b0f29a3b3bbcca82b48/flask_autoinject-2.0.2.tar.gz",
    "platform": null,
    "description": "# Flask AutoInject\r\n\r\nFlask integration to provide separate contexts \r\nfor each request regardless of the underlying \r\nWSGI handler.\r\n\r\nAs of version 1.1.0, you MUST use the `init_app()` function\r\nto properly use `autoinject` with Flask contexts. Previously,\r\nthe informant was registered automatically. Calling `init_app()` \r\nnow (as of 2.0.0) uses the new contextvars integration in `autoinject`\r\nby wrapping the call to wsgi_app() in an `autoinject.with_contextvars()`\r\ndecorator. This ensures that injected functions are cleaned up when the call\r\nto wsgi_app() ends and prevents any ordering problems in terms of the \r\nteardown functions.\r\n\r\nNote that this module does not provide management of autoinjected variables\r\noutside of the context of a call to wsgi_app() (essentially from app config push to \r\nteardown). Any other management you will need to provide yourself.\r\n\r\n```python\r\nimport flask\r\nimport flask_autoinject\r\n\r\napp = flask.Flask(__name__)\r\nflask_autoinject.init_app(app)\r\n```\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Flask support for dependency injection with autoinject",
    "version": "2.0.2",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b4b8a8e763f7e95a1ecf9124621db59c77c619eae85f1171a1d4722b5ccd8243",
                "md5": "5b92822e810462b75dc21039ba5e7557",
                "sha256": "e9c24fcc2c38c78fd7d005738ab9ddced5f83240ca95a49b3a89f3ecfaf9c829"
            },
            "downloads": -1,
            "filename": "flask_autoinject-2.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5b92822e810462b75dc21039ba5e7557",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 3384,
            "upload_time": "2023-03-27T02:01:09",
            "upload_time_iso_8601": "2023-03-27T02:01:09.236982Z",
            "url": "https://files.pythonhosted.org/packages/b4/b8/a8e763f7e95a1ecf9124621db59c77c619eae85f1171a1d4722b5ccd8243/flask_autoinject-2.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "beb92c5d03cebb200f721b93bb0c5e31ed647782669f4b0f29a3b3bbcca82b48",
                "md5": "52bfcea674dbb78f67a431e070abef3f",
                "sha256": "04ed82f40de3d73d7f4f18ad90f9e3ad4dff036d8f642c4ab05d74dbbd210b9b"
            },
            "downloads": -1,
            "filename": "flask_autoinject-2.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "52bfcea674dbb78f67a431e070abef3f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 2907,
            "upload_time": "2023-03-27T02:01:10",
            "upload_time_iso_8601": "2023-03-27T02:01:10.509585Z",
            "url": "https://files.pythonhosted.org/packages/be/b9/2c5d03cebb200f721b93bb0c5e31ed647782669f4b0f29a3b3bbcca82b48/flask_autoinject-2.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-27 02:01:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "turnbullerin",
    "github_project": "flask_autoinject",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "flask-autoinject"
}
        
Elapsed time: 0.05426s