pypi / asgiref
asgiref
What changed in asgiref 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-28.
4 breaking1 deprecations1 new APIs and options1 performance1 tooling6 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initasgiref 314 changes
Breaking changes 4
Local is now marked @final and raises TypeError if subclassed; subclassing was unsupported and could not work correctly with the specialised implementations.
Support for EOL Python 3.10 has been dropped.
Support for EOL Python 3.9 was dropped.
The tests extra no longer installs mypy.
Deprecations 1
asgiref.timeout.timeout is deprecated and will be removed in a future release; use asyncio.timeout() instead.
New APIs and options 1
An explicit executor can be provided to nest ThreadSensitiveContext and move thread-sensitive work away from the parent context's shared worker. The executor must run sequentially on a single thread, and the caller manages its lifecycle.
Performance 1
Local attribute access is now 2–3x faster because internal specialisations are selected by thread_critical instead of checking the mode on every access.
Tooling 1
A separate extra is available for type-checking the codebase.
Fixes and other changes 6
Support for Python 3.15 has been added.
Restored the previous internal code shape relied on by some APM services; this does not constitute an API stability promise.
The event loop is resolved when the callable is invoked rather than when AsyncToSync is instantiated, helping avoid deadlocks involving stopped event loops.
Fixed data leaking between unrelated sync threads when thread_inherit_context is enabled, restoring documented thread-local behavior.
Fixed failure on Python 3.14 by using asyncio.run() when no event loop exists.
Fixed an event loop deadlock when exiting ThreadSensitiveContext while its executor thread was still blocked waiting on the event loop.