skillfed

unsync

Unsynchronize asyncio

unsync v1.4.0 77.3K downloads/30d#14,539 on PyPI900
Permissive license MIT DORMANT released

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 unsync

uv

uv add unsync

poetry

poetry add unsync

Installing 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

asyncio decoratorthread pool executor decoratorasync without event loopconcurrent futures wrapperbackground task decoratorasync function decoratorthread pool async
asyncio-wrapperconcurrency-abstraction

More Application Frameworks packages