skillfed

asgiref

ASGI specs, helper code, and adapters

asgiref Permissive license BSD-3-Clause Active 1,628 v3.12.1 released

Install

asgiref on PyPI

pip

pip install asgiref

uv

uv add asgiref

poetry

poetry add asgiref

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — typing_extensions
Maintenance actively maintained — 30 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: asgiref-3.12.1-py3-none-any.whl

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Free Threading :: 2 - BetaTopic :: Internet :: WWW/HTTP

About asgiref

from the package's own PyPI description — quoted content, verbatim

asgiref

.. image:: https://github.com/django/asgiref/actions/workflows/tests.yml/badge.svg :target: https://github.com/django/asgiref/actions/workflows/tests.yml

.. image:: https://img.shields.io/pypi/v/asgiref.svg :target: https://pypi.python.org/pypi/asgiref

ASGI is a standard for Python asynchronous web apps and servers to communicate with each other, and positioned as an asynchronous successor to WSGI. You can read more at https://asgi.readthedocs.io/en/latest/

This package includes ASGI base libraries, such as:

  • Sync-to-async and async-to-sync function wrappers, asgiref.sync
  • Server base classes, asgiref.server
  • A WSGI-to-ASGI adapter, in asgiref.wsgi

Function wrappers

These allow you to wrap or decorate async or sync functions to call them from the other style (so you can call async functions from a synchronous thread, or vice-versa).

In particular:

  • AsyncToSync lets a synchronous subthread stop and wait while the async function is called on the main thread's event loop, and then control is returned to the thread when the async function is finished.

  • SyncToAsync lets async code call a synchronous function,...

Read as markdown · JSON record · Source repository · Homepage · Docs

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

asgiref provides ASGI base libraries for building asynchronous Python web applications, including sync-to-async and async-to-sync function wrappers, server base classes, and a WSGI-to-ASGI adapter for bridging synchronous and asynchronous code.

Low friction: pure Python wheel with only typing_extensions as a runtime dependency. Actively maintained with a release 30 days ago and 1628 GitHub stars. Supports Python 3.10–3.14 and includes beta support for free threading.

BSD-3-Clause is permissive and imposes minimal restrictions; you may use, modify, and distribute asgiref freely in commercial and proprietary projects provided you retain the license notice.

Usage

pip install asgiref

from asgiref.sync import sync_to_async, async_to_sync

# Wrap a sync function to call from async code
@sync_to_async
def sync_function():
    return "result"

# Wrap an async function to call from sync code
@async_to_sync
async def async_function():
    return "result"

Requires Python 3.10 or higher.

Verdict: asgiref is a production-stable, actively maintained library essential for bridging synchronous and asynchronous Python code in ASGI applications. Its low install friction, permissive BSD license, zero known vulnerabilities, and broad Python version support make it a reliable choice for async-first web frameworks and middleware.

Needs verification

  • Whether the thread_sensitive=False optimization is safe for your specific database or thread-bound dependencies.
  • Performance characteristics of sync_to_async and async_to_sync under high concurrency in your target deployment.
async to sync wrappersync to async functionASGI server libraryWSGI to ASGI adapterasynchronous web frameworkthread pool async bridgeDjango async utilities

Similar packages