Registry / database / culsans

culsans

JSON →
library0.11.0pypypi✓ verified 85d ago

Culsans is a thread-safe async-aware queue for Python, providing a drop-in replacement for asyncio.Queue and janus.Queue with improved cancellation handling, phase-fair priority, and reentrant readers-writer lock (RWLock). It supports Python >=3.8 and is built on top of the aiologic library. Current version is 0.11.0, with a release cadence of approximately monthly updates.

pip install culsans
INSTALL
IMPORT
SIG · CULSANS
C
culsans
databasepythonv0.11.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Queue
from culsans import Queue
from culsans.queue import Queue
Queue is directly exposed at the package level, not in a submodule.
QueueShutDown
from culsans import QueueShutDown
from culsans.exceptions import QueueShutDown
Exception classes are exported from the top-level package.
Grouper
from culsans import Grouper
Introduced in 0.11.0; ensure version >= 0.11.0.
RWLock
from culsans import RWLock
Introduced in 0.11.0; ensure version >= 0.11.0.

Basic async producer-consumer example using Culsans Queue.

import asyncio from culsans import Queue async def producer(queue): for i in range(5): await queue.put(i) print(f'Produced {i}') async def consumer(queue): while True: item = await queue.get() if item is None: break print(f'Consumed {item}') queue.task_done() async def main(): queue = Queue() prod = asyncio.create_task(producer(queue)) cons = asyncio.create_task(consumer(queue)) await prod await queue.put(None) # sentinel await cons asyncio.run(main())
Debug
Known issues
breakingIn version 0.9.0, checkpoint functions are now called before queue operations instead of after. This may increase the number of explicit context switches, affecting performance or behavior in tight loops.
fix
If you rely on checkpoint timing, review your code for any assumptions about when checkpoints are called. Consider using synchronous methods if context switches are costly.
affects: >=0.9.0
deprecatedPython 3.8 support was added in 0.8.0, but Python 3.8 is itself end-of-life. Future versions may drop Python 3.8 support.
fix
Upgrade to Python 3.9+ to ensure compatibility with future releases.
affects: >=0.8.0, <0.12.0
gotchaQueueShutDown is raised on various operations after close() or shutdown(), consistent with Python 3.13's queue shutdown. However, on Python <3.13, the exception is backported and may cause name conflicts with type checkers.
fix
Use 'from culsans import QueueShutDown' to ensure compatibility across Python versions; avoid importing from the stdlib's asyncio.queues.
affects: <3.13
gotchaMixedQueue is a protocol, not a concrete class. Do not instantiate MixedQueue directly.
fix
Use MixedQueue only for type annotations; use Queue, LifoQueue, PriorityQueue, etc. for instantiation.
affects: >=0.8.0
Errors
Common errors & fixes
from culsans.queue import Queue ModuleNotFoundError: No module named 'culsans.queue'
Queue is not in a submodule; it is directly exported from the top-level package.
fix
Use 'from culsans import Queue'
AttributeError: module 'culsans' has no attribute 'LifoQueue'
LifoQueue was removed in version 0.7.0 in favor of general Queue with an optional 'maxsize' parameter and 'type' argument? Actually, LifoQueue is still present, but this error may occur if using an old version or incorrect import path.
fix
Ensure you have installed culsans >=0.7.0. Use 'from culsans import LifoQueue' if you need LIFO behavior.
Upgrade
Version history
0.11.0latest on PyPI · released Dec 31, 2025
Audit
Dependencies
aiologicrequiredCore dependency for lock-free async primitives
Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
culsans — pip install culsans · libregistry