fifolock
A flexible low-level tool to make synchronisation primitives in asyncio Python
What it is and what it does
Fifolock is a minimal asyncio synchronization tool that lets you build custom lock types—mutexes, read/write locks, semaphores—by defining compatibility rules between lock modes. Each mode is a subclass of asyncio.Future, and the lock grants access strictly in the order requests arrive, never allowing reentrancy.
You create a FifoLock instance, define lock-mode classes with an is_compatible method that checks whether a new request can proceed given the currently held locks, then use the lock as an async context manager. The package includes recipes for common patterns like exclusive locks, shared/exclusive (read/write) locks, and bounded semaphores. It requires Python 3.5 or later and has no external dependencies.
Use it for:
- Building a read/write lock where multiple readers can access a resource concurrently but writers get exclusive access.
- Implementing a bounded semaphore that allows concurrent operations in strict request order.
- Creating custom synchronization logic where lock compatibility depends on which modes are currently held.
- Ensuring fair, deterministic lock acquisition order in asyncio applications where FIFO fairness matters.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Fifolock provides a low-level building block for creating custom synchronization primitives in asyncio Python, where locks are granted strictly in first-in-first-out order and are not reentrant.
No, unless you have an existing codebase already using it. The package is abandoned (last release 2019-05-02, no commits since), and asyncio now includes built-in primitives that cover most common use cases. If you need custom lock semantics, consider maintaining a fork or using a maintained alternative.
Install
fifolock on PyPI
pip
pip install fifolockuv
uv add fifolockpoetry
poetry add fifolockInstalling fifolock
Before you install
Installation is frictionless—a pure Python wheel with no runtime dependencies. However, the project is abandoned; the last commit was 2019-05-02 and no releases have occurred since.
License in practice
Licensed under MIT (permissive), so you can use it freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install fifolock
import asyncio
from fifolock import FifoLock
class Mutex(asyncio.Future):
@staticmethod
def is_compatible(holds):
return not holds[Mutex]
lock = FifoLock()
async def access():
async with lock(Mutex):
pass
Requires Python 3.5 or later (requires_python: >=3.5)
Verify before relying
- Whether the package works correctly with Python versions released after 2019.
- Whether there are known issues or edge cases in FIFO lock ordering under high concurrency.
- Whether alternative asyncio lock libraries now provide similar functionality.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.5) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,661 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 236,901/month — #8,971 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fifolock-0.0.20-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI 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
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
aiorwlockProvides read-write locks for asyncio programs,…
permissive · top 5,000 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastenersProvides cross-platform locks for synchronizing…
permissive · top 5,000 on PyPI
aiologicaiologic provides thread-aware and async-aware…
permissive · top 5,000 on PyPI
locketLocket provides file-based locks for…
permissive · top 1,000 on PyPI
atomosAtomos provides thread-safe atomic primitives…
permissive · top 15,000 on PyPI
portalockerPortalocker provides cross-platform file…
permissive · top 1,000 on PyPI
posix-ipcposix_ipc provides Python bindings to POSIX…
permissive · top 15,000 on PyPI
readerwriterlockProvides reader-writer lock implementations for…
permissive · top 5,000 on PyPI
sysv-ipcProvides Python access to System V IPC…
permissive · top 15,000 on PyPI