skillfed

aiologic

GIL-powered* locking library for Python

aiologic v0.17.1 3.3M downloads/30d#2,684 on PyPI92
Permissive license Active released

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 on this page — 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

aiologic on PyPI

pip

pip install aiologic

uv

uv add aiologic

poetry

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 the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 3 — sniffio, typing-extensions, wrapt
Maintenance actively maintained — 48 days since the last release
Last repo commit
First released
Downloads 3,253,484/month — #2,684 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: aiologic-0.17.1-py3-none-any.whl

Keywords: anyio, async, async-await, asyncio, concurrency, eventlet, gevent, greenlet, library, locking, mypy, python, synchronization, thread-safety, threading, trio

Development Status :: 3 - AlphaFramework :: AnyIOFramework :: AsyncIOFramework :: TrioIntended Audience :: DevelopersLicense :: OSI Approved :: ISC License (ISCL)Operating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Free Threading :: 2 - BetaProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

cross-thread async lockingthread-safe async primitivesmulti-loop synchronizationasync-sync coordinationGIL-based locking libraryasyncio threading locksevent loop agnostic locks
async-concurrencythread-safetymulti-framework

More Python Modules packages

Further reading