--- id: async-exit-stack version: "1.0.1" license: Python Software Foundation License license_treatment: permissive maintenance: abandoned --- # async-exit-stack — AsyncExitStack backport for Python 3.5+ License: permissive · Maintenance: abandoned · Downloads: 88.0K/mo ## What it is and what it does AsyncExitStack is a backport of Python 3.7's asynchronous context manager from the standard library, extracted into a standalone package for use on Python 3.5 and 3.6. It allows you to combine multiple async context managers and register async cleanup callbacks within a single async with block, ensuring resources are properly released even if exceptions occur during setup. The package is essentially a copy of CPython's implementation and provides the same API as the standard library version: enter_async_context() to register async context managers, push_async_callback() to register coroutine cleanup handlers, and aclose() to trigger cleanup. It is most useful as a compatibility shim for older Python versions; modern projects targeting Python 3.7+ should use the built-in contextlib.AsyncExitStack instead. Use it for: - Managing multiple database or network connections in async code on Python 3.5–3.6 with automatic cleanup. - Registering async cleanup handlers (e.g., closing resources) that must run even if earlier setup steps fail. - Combining both sync and async context managers in a single async with block on older Python versions. - Porting async code from Python 3.7+ back to Python 3.5–3.6 without rewriting resource management logic. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides AsyncExitStack, a backport of Python 3.7's asynchronous context manager for combining and cleaning up both sync and async context managers in async code. No, unless you are maintaining legacy code on Python 3.5 or 3.6. The package is abandoned and receives no updates. Modern Python versions (3.7+) include AsyncExitStack in the standard library; use that instead. If you must support older Python, this backport works but carries no active maintenance risk mitigation. ## Install pip install async-exit-stack uv add async-exit-stack poetry add async-exit-stack ## Installing async-exit-stack Before you install: Installation is straightforward with no runtime dependencies. However, the package is abandoned—last updated in 2022 with no commits since December 2022—so it receives no active maintenance or security updates. License in practice: Licensed under the Python Software Foundation License (permissive), which allows free use, modification, and distribution with minimal restrictions. Quickstart: pip install async-exit-stack from async_exit_stack import AsyncExitStack async def example(): async with AsyncExitStack() as stack: resource = await stack.enter_async_context(get_connection()) # Resource automatically cleaned up on exit Requires Python 3.5 or later; intended for older Python versions that lack native AsyncExitStack support. Verify before relying: - Whether AsyncExitStack is still needed: Python 3.7+ includes it in the standard library contextlib module. - Compatibility with Python versions beyond 3.6: classifiers list only 3.5 and 3.6, but requires_python states >=3.5. ## Package facts - License: Python Software Foundation License (permissive) - Python support: supports_current - Install friction: low - Maintenance: abandoned - Downloads: 88.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags async context manager cleanup, asyncexitstack backport, async resource management, async context manager composition, async cleanup handlers, async with statement helpers, backport, legacy-python, async-utilities [View on SkillFed](https://skillfed.io/packages/async-exit-stack) · [View on PyPI](https://pypi.org/project/async-exit-stack/)