unsync
Unsynchronize asyncio
What it is and what it does
unsync is a decorator library that abstracts away the complexity of mixing async and synchronous code by automatically managing execution contexts. When you decorate an async function with @unsync, it runs in a background event loop managed by the library; when you decorate a regular function, it runs in a thread pool by default or a process pool if marked cpu_bound=True. All decorated functions return Unfuture objects—a hybrid future type that behaves like both asyncio.Future and concurrent.futures.Future, and can be awaited or blocked on with .result().
The library is useful when you have synchronous code that doesn't support asyncio (like blocking I/O libraries) but want to run it concurrently alongside async code, or when you want to avoid writing boilerplate event loop setup. It supports chaining operations with .then(), mixing sync and async functions in pipelines, and custom event loop policies like uvloop. The main tradeoff is that you lose explicit control over the event loop and thread/process management—the library handles it implicitly.
Use it for:
- Run blocking I/O operations (file reads, network calls to non-async libraries) concurrently without rewriting them as async.
- Execute CPU-bound work in a separate process while keeping async code responsive in the main thread.
- Chain async and sync operations together using .then() without manually managing futures or callbacks.
- Simplify migration of synchronous codebases by decorating functions without restructuring control flow.
- Avoid event loop boilerplate when mixing asyncio with libraries that only support threading or multiprocessing.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Decorator-based library that runs async functions in an ambient event loop and regular functions in thread or process pools, returning awaitable futures that combine asyncio and concurrent.futures semantics.
Yes, with conditions. The library solves a real problem—bridging async and sync code without boilerplate—and carries no security vulnerabilities or licensing concerns. However, dormancy since 2021-10-21 and unspecified Python version support mean you should verify compatibility with your target Python version before committing. Best suited for projects that need to integrate legacy synchronous libraries into async codebases and can tolerate a stable but unmaintained dependency.
Install
unsync on PyPI
pip
pip install unsyncuv
uv add unsyncpoetry
poetry add unsyncInstalling unsync
Before you install
High install friction with no runtime dependencies. Package is dormant—last release was 2021-10-21, though the repository remains active with a recent commit on 2025-01-09. Maintenance status suggests the library is stable but not actively developed.
License in practice
MIT license is permissive, allowing commercial and private use with minimal restrictions. No licensing concerns for adoption.
Quickstart
from unsync import unsync
import asyncio
@unsync
async def my_async_task():
await asyncio.sleep(1)
return 'done'
result = my_async_task().result() # Blocks until complete
Verify before relying
- Compatibility with modern Python versions not specified in fact sheet.
- Whether the library works correctly with current asyncio implementations and event loop policies.
- Performance characteristics and scalability limits for large numbers of concurrent tasks.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | dormant — 1,758 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 77,296/month — #14,539 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: unsync-1.4.0.tar.gz
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
multitaskingConverts Python methods into non-blocking,…
permissive · top 1,000 on PyPI
synchronicityWraps async functions, generators, and classes…
permissive · top 1,000 on PyPI
threadedProvides decorators to wrap functions for…
permissive · top 15,000 on PyPI
futuristFuturist provides futures utilities and…
permissive · top 15,000 on PyPI
duetDuet is a lightweight async library that wraps…
permissive · top 15,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
txaiotxaio provides a compatibility layer that lets…
permissive · top 5,000 on PyPI
Flask-ExecutorFlask-Executor wraps Python's…
permissive · top 15,000 on PyPI
requests-futuresWraps the requests library to execute HTTP…
permissive · top 5,000 on PyPI
nest-asyncioPatches asyncio to allow nested event loops,…
permissive · top 1,000 on PyPI