--- id: aiologic version: "0.17.1" license: unclear license_treatment: permissive maintenance: active --- # aiologic — GIL-powered* locking library for Python License: permissive · Maintenance: active · Downloads: 3.3M/mo ## What it is and what it does aiologic is a synchronization library that solves a specific problem: coordinating work across Python's different concurrency models. Standard asyncio.Lock fails when tasks from different event loops try to acquire it, and threading.Lock can deadlock in similar scenarios. aiologic provides drop-in replacements—Lock, Event, Semaphore, Barrier, Condition, and Queue primitives—that work correctly whether you're coordinating async tasks within one loop, async tasks across multiple event loops in different threads, or mixing async and sync code. The library supports asyncio, trio, curio, anyio, gevent, eventlet, and threading. It's built on atomic operations and respects Python's GIL, making it performant on PyPy and compatible with free-threaded CPython 3.13+. The implementation includes fairness guarantees where possible and aims for lock-free designs with minimal context switches. It's in alpha, actively maintained, and already in use by some projects. Use it for: - Coordinate async tasks running in separate event loops across multiple threads without deadlock or RuntimeError. - Protect shared state when mixing async code (asyncio/trio) with synchronous code in the same application. - Build thread-safe async queues and barriers that work across different async frameworks (asyncio, trio, curio, anyio). - Implement fair, cancellation-aware locking for complex async workflows with timeouts and checkpoints. - Migrate from threading.Lock to an async-aware primitive without rewriting synchronization logic. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. aiologic provides thread-aware and async-aware locking and synchronization primitives that work across asyncio, trio, curio, anyio, gevent, eventlet, and threading—enabling safe coordination between async tasks in different event loops and between async and sync code. Yes, if you need to coordinate async tasks across multiple event loops or mix async and sync code—a genuine gap in the standard library. No, if you work only within a single asyncio event loop or use only threading; standard library primitives are simpler and more stable. Yes-with-conditions if you're comfortable with alpha-status software and a single-maintainer project; the library is already in use and carefully designed, but API and behavior may change. ## Install pip install aiologic uv add aiologic poetry add aiologic ## Installing aiologic Before you install: Low install friction with only three runtime dependencies (sniffio, typing-extensions, wrapt). Actively maintained as of 2026-06-27 with recent activity. Project is in alpha status and developed by a single maintainer in spare time, so stability is not guaranteed despite careful theoretical analysis claimed by the author. License in practice: Permissive licensing: source code under ISC, tests under 0BSD, documentation under CC-BY-4.0, and configuration under CC0-1.0. No restrictions on commercial use or modification of the library itself. Quickstart: import asyncio from threading import Thread import aiologic lock = aiologic.Lock() async def func(): async with lock: await asyncio.sleep(1) Thread(target=asyncio.run, args=[func()]).start() Requires Python 3.8 or later. Works on CPython and PyPy; Nuitka support is experimental. Verify before relying: - Performance characteristics and fairness guarantees compared to standard library alternatives in various concurrency scenarios. - Stability and API maturity given alpha development status and single-maintainer maintenance model. - Real-world production usage patterns beyond the one discussion example mentioned in the project status. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 3.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags cross-thread async locking, thread-safe async primitives, multi-loop synchronization, async-sync coordination, GIL-based locking library, asyncio threading locks, event loop agnostic locks, async-concurrency, thread-safety, multi-framework [View on SkillFed](https://skillfed.io/packages/aiologic) · [View on PyPI](https://pypi.org/project/aiologic/)