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
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 for a complete reference and more context.
class AsyncExitStackAn 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)Similar to enter_context() but expects an asynchronous context manager.
push_async_exit(exit)Similar to push() but expects either an asynchronous context manager or a coroutine.
push_async_callback(callback, *args, **kwds)Similar to callback() but expects a coroutine.
aclose()Similar to close() but properly handles awaitables.
History
1.0.0 (2018-05-07)
First release based on Python 3.7b4.
Metadata
Release files for async-exit-stack 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| async_exit_stack-1.0.1.tar.gz | 10.6 kB | Without provenance | Details for async_exit_stack-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| async_exit_stack-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for async_exit_stack-1.0.1-py3-none-any.whl |
Total release size: 15.2 kB
Release files / async_exit_stack-1.0.1.tar.gz
| Download URL | async_exit_stack-1.0.1.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
24de1ad6d0ff27be97c89d6709fa49bf20db179eaf1f4d2e6e9b4409b80e747d
|
|
BLAKE2b-256 checksum How to use checksums |
339cecf37497cd8c4aa6d62de0a67deeb80d4407fd930a689362e588458aff81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / async_exit_stack-1.0.1-py3-none-any.whl
| Download URL | async_exit_stack-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9b43b17683b3438f428ef3bbec20689f5abbb052aa4b564c643397330adfaa99
|
|
BLAKE2b-256 checksum How to use checksums |
77aef5baabf02fe19c4015b0417e72e36220fb95ed3e7cf17e8a85004b964709
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for async-exit-stack 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.