--- id: synchronicity version: "0.12.5" license: unclear license_treatment: permissive maintenance: active --- # synchronicity — Export blocking and async library versions from a single async implementation License: permissive · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install synchronicity uv add synchronicity poetry add synchronicity ## Description ![CI/CD badge](https://github.com/erikbern/synchronicity/actions/workflows/ci.yml/badge.svg) [![pypi badge](https://img.shields.io/pypi/v/synchronicity.svg?style=flat)](https://pypi.python.org/pypi/synchronicity) Python 3 has some amazing support for async programming but it's arguably made it a bit harder to develop libraries. Are you tired of implementing synchronous _and_ asynchronous methods doing basically the same thing? This might be a simple solution for you. Installing ========== ``` pip install synchronicity ``` Background: why is anything like this needed ============================================ Let's say you have an asynchronous function ```python fixture:quicksleep async def f(x): await asyncio.sleep(1.0) return x**2 ``` And let's say (for whatever reason) you want to offer a synchronous API to users. For instance maybe you want to make it easy to run your code in a basic script, or a user is building something that's mostly CPU-bound, so they don't want to bother with asyncio. A "simple" way to create a synchronous equivalent would be to implement a set of synchronous functions where all they do is call... ## AI interpretation — verify before relying Synchronicity wraps async functions, generators, and classes to expose both synchronous and asynchronous interfaces from a single async implementation, running the async code on a dedicated event loop in a background thread. Verdict: Synchronicity solves a genuine pain point—maintaining dual sync/async APIs—by automating wrapper generation and isolating async execution to a separate event loop. No known vulnerabilities, permissive license, minimal dependencies, and active maintenance make it a low-risk choice for libraries needing both interfaces. [View on SkillFed](https://skillfed.io/packages/synchronicity) · [View on PyPI](https://pypi.org/project/synchronicity/)