NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #583 most downloaded on PyPI
Patch asyncio to allow nested event loops
Last release 12 days ago
22 Sep 2026
Ships fairly regularly
a new release about every 5 months
Nearly every release is documented
notes for 7 of 7 stable releases
Nothing withdrawn
no release was ever pulled
10 months old
7 releases · first in 2025
One column per month.
Fix context may be re-entered and cause RuntimeError: cannot enter context ( #4 , @larsoner ).
Fix call_soon() callbacks not being called during run() (#3, @ransomr)
call_soon() callbacks not being called during run() (#3, @ransomr)apply() will set asyncio._nest_asyncio2 to help distinguish from patches made by nest_asyncio
apply() will set asyncio._nest_asyncio2 to help distinguish from patches made by nest_asyncio (#1)
apply() will warn if asyncio is already patched by nest_asyncio on Python 3.12+ (#1)
You can also set error_on_mispatched=True to turn the warning into a RuntimeError, regardless of the Python version.
feat: _nest_asyncio2 marker and error_on_mispatched
feat: _nest_asyncio2 marker and error_on_mispatched (#1)
fix: not run_close_loop by default on Python 3.12+
fix: not run_close_loop by default on Python 3.12+ (https://github.com/Chaoses-Ib/ComfyScript/issues/117, https://github.com/pyvista/pyvista/issues/7938)
See the following for details.
Add some pyvista tests
[!TIP] TL;DR: Usually you don't need to worry about this. The biggest side effect is a
ResourceWarning: unclosed event loopat exit on Python 3.12+ that is hidden by default.
If there is no existing event loop, patched asyncio.run() will create one but not close it afterwards. It will be reused later, so there will be at most one leaked loop.
asyncio.run() will always create and close the loop. But nest_asyncio (by accident or intentionally) missed it. As changing this behavior will break existing projects (e.g. ComfyScript, pyvista), nest-asyncio2 follows this behavior.
This will cause a ResourceWarning: unclosed event loop at exit on Python 3.12+, although it is hidden by default. (Note that if you call asyncio.get_event_loop() on the main thread without setting the loop before,
ResourceWarning is expected on Python 3.12~3.13, not caused by nest-asyncio2.)
If you want to follow asyncio.run()'s behavior and get rid of the ResourceWarning, you can set run_close_loop=True for all apply():
nest_asyncio2.apply(run_close_loop=True)
Or pass loop_factory to asyncio.run() on Python 3.12+:
asyncio.run(..., loop_factory=asyncio.new_event_loop)
nest-asyncio2 v2 may change run_close_loop to be enalbed by default.
fix: Python 3.14 get_event_loop_policy() deprecated warn
get_event_loop_policy() deprecated warn (https://github.com/pyvista/pyvista/issues/7938)get_event_loop_policy() deprecated warn (pyvista/pyvista#7938)nest-asyncio2 is a fork of the unmaintained `nest_asyncio`, with the following changes:
nest-asyncio2 is a fork of the unmaintained nest_asyncio, with the following changes:
loop_factory parameter supportasyncio.current_task() and others are broken in nest_asyncio)All interfaces are kept as they are. To migrate, you just need to change the package and module name to nest_asyncio2.
Your coding agent can read these notes before it upgrades. Set up the MCP server →