async-exit-stack


Nameasync-exit-stack JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/sorcio/async_exit_stack
SummaryAsyncExitStack backport for Python 3.5+
upload_time2018-05-07 15:54:46
maintainer
docs_urlNone
authorDavide Rizzo
requires_python>=3.5
licensePython Software Foundation License
keywords async_exit_stack
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            .. role:: python(code)
   :language: python

.. image:: https://img.shields.io/pypi/v/async_exit_stack.svg
        :target: https://pypi.python.org/pypi/async_exit_stack

.. image:: https://img.shields.io/travis/sorcio/async_exit_stack.svg
        :target: https://travis-ci.org/sorcio/async_exit_stack


=======================================
AsyncExitStack backport for Python 3.5+
=======================================


* Free software: PSF license
* Documentation: https://docs.python.org/3.7/library/contextlib.html#contextlib.AsyncExitStack

This package contains code from the CPython project.


Install
-------

::

   pip install async_exit_stack



Usage example
-------------

.. code:: python

    from async_exit_stack import AsyncExitStack

    async def some_async_function():
        async with AsyncExitStack() as stack:
            connections = [await stack.enter_async_context(get_connection())
                for i in range(5)]
            # All opened connections will automatically be released at the end of
            # the async with statement, even if attempts to open a connection
            # later in the list raise an exception.


Reference
---------

Refer to `Python 3.7 contextlib documentation
<https://docs.python.org/3.7/library/contextlib.html#contextlib.AsyncExitStack>`_
for a complete reference and more context.

`class AsyncExitStack`:python:
  An asynchronous context manager, similar to ExitStack, that supports combining
  both synchronous and asynchronous context managers, as well as having
  coroutines for cleanup logic.

  The close() method is not implemented, aclose() must be used instead.

  `enter_async_context(cm)`:python:
    Similar to enter_context() but expects an asynchronous context manager.

  `push_async_exit(exit)`:python:
    Similar to push() but expects either an asynchronous context manager or a coroutine.

  `push_async_callback(callback, *args, **kwds)`:python:
    Similar to callback() but expects a coroutine.

  `aclose()`:python:
    Similar to close() but properly handles awaitables.


=======
History
=======

1.0.0 (2018-05-07)
------------------

* First release based on Python 3.7b4.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sorcio/async_exit_stack",
    "name": "async-exit-stack",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "async_exit_stack",
    "author": "Davide Rizzo",
    "author_email": "sorcio@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/33/9c/ecf37497cd8c4aa6d62de0a67deeb80d4407fd930a689362e588458aff81/async_exit_stack-1.0.1.tar.gz",
    "platform": "",
    "description": ".. role:: python(code)\n   :language: python\n\n.. image:: https://img.shields.io/pypi/v/async_exit_stack.svg\n        :target: https://pypi.python.org/pypi/async_exit_stack\n\n.. image:: https://img.shields.io/travis/sorcio/async_exit_stack.svg\n        :target: https://travis-ci.org/sorcio/async_exit_stack\n\n\n=======================================\nAsyncExitStack backport for Python 3.5+\n=======================================\n\n\n* Free software: PSF license\n* Documentation: https://docs.python.org/3.7/library/contextlib.html#contextlib.AsyncExitStack\n\nThis package contains code from the CPython project.\n\n\nInstall\n-------\n\n::\n\n   pip install async_exit_stack\n\n\n\nUsage example\n-------------\n\n.. code:: python\n\n    from async_exit_stack import AsyncExitStack\n\n    async def some_async_function():\n        async with AsyncExitStack() as stack:\n            connections = [await stack.enter_async_context(get_connection())\n                for i in range(5)]\n            # All opened connections will automatically be released at the end of\n            # the async with statement, even if attempts to open a connection\n            # later in the list raise an exception.\n\n\nReference\n---------\n\nRefer to `Python 3.7 contextlib documentation\n<https://docs.python.org/3.7/library/contextlib.html#contextlib.AsyncExitStack>`_\nfor a complete reference and more context.\n\n`class AsyncExitStack`:python:\n  An asynchronous context manager, similar to ExitStack, that supports combining\n  both synchronous and asynchronous context managers, as well as having\n  coroutines for cleanup logic.\n\n  The close() method is not implemented, aclose() must be used instead.\n\n  `enter_async_context(cm)`:python:\n    Similar to enter_context() but expects an asynchronous context manager.\n\n  `push_async_exit(exit)`:python:\n    Similar to push() but expects either an asynchronous context manager or a coroutine.\n\n  `push_async_callback(callback, *args, **kwds)`:python:\n    Similar to callback() but expects a coroutine.\n\n  `aclose()`:python:\n    Similar to close() but properly handles awaitables.\n\n\n=======\nHistory\n=======\n\n1.0.0 (2018-05-07)\n------------------\n\n* First release based on Python 3.7b4.\n\n\n",
    "bugtrack_url": null,
    "license": "Python Software Foundation License",
    "summary": "AsyncExitStack backport for Python 3.5+",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/sorcio/async_exit_stack"
    },
    "split_keywords": [
        "async_exit_stack"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "77aef5baabf02fe19c4015b0417e72e36220fb95ed3e7cf17e8a85004b964709",
                "md5": "992cd0802def9ac79440268348a0387b",
                "sha256": "9b43b17683b3438f428ef3bbec20689f5abbb052aa4b564c643397330adfaa99"
            },
            "downloads": -1,
            "filename": "async_exit_stack-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "992cd0802def9ac79440268348a0387b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 4681,
            "upload_time": "2018-05-07T15:54:45",
            "upload_time_iso_8601": "2018-05-07T15:54:45.768173Z",
            "url": "https://files.pythonhosted.org/packages/77/ae/f5baabf02fe19c4015b0417e72e36220fb95ed3e7cf17e8a85004b964709/async_exit_stack-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "339cecf37497cd8c4aa6d62de0a67deeb80d4407fd930a689362e588458aff81",
                "md5": "4c16d3ac6243ed086ab7a9c7266f013b",
                "sha256": "24de1ad6d0ff27be97c89d6709fa49bf20db179eaf1f4d2e6e9b4409b80e747d"
            },
            "downloads": -1,
            "filename": "async_exit_stack-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4c16d3ac6243ed086ab7a9c7266f013b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 10562,
            "upload_time": "2018-05-07T15:54:46",
            "upload_time_iso_8601": "2018-05-07T15:54:46.715973Z",
            "url": "https://files.pythonhosted.org/packages/33/9c/ecf37497cd8c4aa6d62de0a67deeb80d4407fd930a689362e588458aff81/async_exit_stack-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2018-05-07 15:54:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sorcio",
    "github_project": "async_exit_stack",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "tox": true,
    "lcname": "async-exit-stack"
}
        
Elapsed time: 1.44762s