Asyncer

Small, developer-experience-focused Python library for mixing async, await, and blocking code via AnyIO.

Library
PyPI
v0.0.18
2,483stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
81/100Excellent
Development Activity96
Maintenance84
Community48
Maturity56
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture82
Code Quality84
Innovation76
Learning Curve88

Asyncer is a compact utility library built on top of AnyIO that smooths the rough edges of working with async and await in Python. Created by Sebastian Ramirez (the author of FastAPI and Typer), it focuses on developer experience: strong type hints for autocompletion and inline errors, and simpler patterns for combining asynchronous code with regular blocking functions.

The library is deliberately tiny, offering a handful of well-typed helpers such as asyncify (run blocking code from async) and soonify (fire off concurrent tasks with typed results). Because it wraps AnyIO, it works on both asyncio and Trio backends without changes.

What You Get

  • asyncify() to run synchronous/blocking functions in a worker thread from async code without blocking the event loop
  • syncify() to call async functions from synchronous contexts
  • soonify() and task groups for launching concurrent tasks with typed return values
  • Full type hints tuned for mypy and editor autocompletion
  • AnyIO backing so the same code runs on asyncio or Trio

Common Use Cases

  • Calling blocking libraries (database drivers, file I/O) from async applications without stalling the loop
  • Launching several concurrent operations and collecting their typed results
  • Bridging synchronous and asynchronous code in FastAPI or other async frameworks

Under The Hood

Architecture - Asyncer is intentionally minimal: the entire public surface lives in asyncer/_main.py (~380 lines), with asyncer/__init__.py re-exporting the handful of helpers and asyncer/_compat.py smoothing over version differences. Each utility is a thin, carefully typed wrapper that delegates the actual concurrency work to AnyIO primitives — asyncify hands blocking callables to AnyIO’s worker-thread machinery, while the soonify/task-group helpers wrap AnyIO task groups to preserve return-type information.

Tech Stack - Pure Python built on a single runtime dependency, AnyIO, which in turn supports both asyncio and Trio backends. Tooling and packaging follow the FastAPI project conventions.

Code Quality - The repository has a thorough tests directory covering the utilities and the documentation tutorial examples (test_others, test_param_cancellable, test_syncify_no_raise, plus a test_tutorial suite), backed by coverage tracking in CI. The codebase is fully type-hinted and small enough to audit end to end, reflecting its stated goal of type-checker correctness.

API Design - Developer experience is the explicit design driver. The functions are named for intent (asyncify, syncify, soonify), preserve the wrapped callables’ type signatures for editor autocompletion, and require almost no boilerplate — a single await asyncify(fn)(…) call replaces manual thread-pool plumbing. Extensive documentation at asyncer.tiangolo.com with a step-by-step tutorial keeps the learning curve very low.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search