aiorwlock
Read write lock for asyncio.
Decision gist · record as of 2026-08-14
Yes. aiorwlock is a mature, actively maintained library with zero known vulnerabilities, low install friction, and permissive licensing. Install it if you have asyncio code where read-write contention patterns would benefit from allowing concurrent readers; otherwise a simple asyncio.Lock is sufficient.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- The task that acquires a lock must also release it; acquiring in one task and releasing in another raises RuntimeError.
- Low install friction with no runtime dependencies.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache 2.0 (permissive), allowing use in both open-source and proprietary projects with minimal restrictions.
last release 2026-02-20 (175 days) · last repo commit 2026-08-01 · 175 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,345,391 downloads/mo, #4,022 on PyPI
Alternatives
Verify before relying
import asyncio
import aiorwlock
async def example():
rwlock = aiorwlock.RWLock()
async with rwlock.reader_lock:
print('reader holds lock')
async with rwlock.writer_lock:
print('writer holds lock')
asyncio.run(example())- Performance characteristics compared to simple mutual exclusion locks under various read/write ratios
- Thread-safety guarantees or limitations when used across multiple event loops
What it is and what it does
aiorwlock implements a read-write lock primitive for asyncio-based Python programs. It maintains separate locks for read and write operations: the read lock can be held by multiple concurrent reader tasks simultaneously, while the write lock is exclusive and blocks all other readers and writers. This design improves performance when data is read frequently but modified infrequently, since readers don't block each other.
The package is a direct port of a CPython patch and has been in production use since 2014. It supports a "fast path" mode that skips context switches when you're confident your locked code contains await statements, trading safety for minor performance gains. The default safe mode ensures fairness by allowing waiting tasks to acquire the lock even if the current holder doesn't yield control.
Use it for
- Cache or configuration store that is read frequently but updated rarely
- Shared data structure in an async web service where reads vastly outnumber writes
- Coordinating access to a resource pool where multiple consumers read status but few modify state
- Implementing reader-writer patterns in async database connection managers
- Protecting mutable state in async event handlers where contention is primarily read-heavy
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
aiorwlock is a mature, actively maintained library with zero known vulnerabilities, low install friction, and permissive licensing. Install it if you have asyncio code where read-write contention patterns would benefit from allowing concurrent readers; otherwise a simple asyncio.Lock is sufficient.
Install
aiorwlock on PyPI
Before you install
Low install friction with no runtime dependencies. Actively maintained with recent commits and a stable release history since 2014; supports current Python versions (3.9 through 3.14).
Requires Python 3.9 or later. The task that acquires a lock must also release it; acquiring in one task and releasing in another raises RuntimeError.
License in practice
Licensed under Apache 2.0 (permissive), allowing use in both open-source and proprietary projects with minimal restrictions.
Quickstart
import asyncio
import aiorwlock
async def example():
rwlock = aiorwlock.RWLock()
async with rwlock.reader_lock:
print('reader holds lock')
async with rwlock.writer_lock:
print('writer holds lock')
asyncio.run(example())
Verify before relying
- Performance characteristics compared to simple mutual exclusion locks under various read/write ratios
- Thread-safety guarantees or limitations when used across multiple event loops
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 175 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,345,391 / month, #4,022 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: AsyncIOIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9 |
Evidence: aiorwlock-1.5.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “async rwlock”
- aiorwlockProvides read-write locks for asyncio programs, allowing multiple…
- readerwriterlockProvides reader-writer lock implementations for Python that solve the…
- asyncstdlibProvides async-compatible versions of Python standard library…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also aiologic · fifolock · readerwriterlock · fastrlock · fasteners · locket · portalocker · PyMySQLLock · python-dynamodb-lock · asyncio-pool