Registry / web-framework / asgiref

asgiref

JSON →
library3.12.1pypypi✓ verified 25d ago

ASGI specification and utilities, version 3.11.1, released on a regular cadence. Provides ASGI specs, helper code, and adapters for Python applications.

pip install asgiref
INSTALL
IMPORT
SIG · ASGIREF
A
asgiref
web-frameworkpythonv3.12.1
Install
1.7s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.12.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ASGIApp
from asgiref.typing import ASGIApp
from asgiref.typing import ASGIApp

A basic ASGI application setup using asgiref and Channels, including routing and middleware.

import os from asgiref.sync import AsyncToSync from channels.routing import ProtocolTypeRouter, URLRouter from channels.auth import AuthMiddlewareStack from django.urls import path os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'your_project.settings') application = ProtocolTypeRouter({ 'http': get_asgi_application(), 'websocket': AuthMiddlewareStack( URLRouter([ path('ws/some_path/', your_consumer.as_asgi()), ]) ), })
Debug
Known issues
breakingImport paths have changed in asgiref 3.11.1; ensure correct imports to avoid ImportError.
fix
Update import statements to reflect the new module structure.
affects: 3.11.1
gotchaUsing AsyncToSync without proper context can lead to deadlocks; ensure it's used within an appropriate event loop.
fix
Use AsyncToSync within an event loop or ensure it's called from an asynchronous context.
affects: 3.11.1
breakingThe 'channels' package is not found. Ensure it is installed in the environment.
fix
Install the 'channels' package using pip: `pip install channels`.
affects: 3.11.1
breakingThe 'channels' module is not found. Ensure it is installed in your environment.
fix
Install the 'channels' package using pip: `pip install channels`.
affects: all
Upgrade
Version history
3.12.1latest on PyPI · released Jul 14, 2026
Audit
Dependencies
typing-extensionsrequiredProvides backports of Python 3.5+ typing features for earlier versions
Agent activity
35 hits · last 30 days
node
26
OpenAI (training)
1
Resources
asgiref — pip install asgiref · libregistry