--- id: culsans version: "0.11.0" license: unclear license_treatment: permissive maintenance: active --- # culsans — Thread-safe async-aware queue for Python License: permissive · Maintenance: active · Downloads: 2.9M/mo ## What it is and what it does Culsans is a dual-interface queue library that lets synchronous and asynchronous code communicate through a single queue object. It exposes a `.sync_q` property for threaded, eventlet, or gevent code and an `.async_q` property for asyncio, trio, or curio code, allowing you to bridge concurrency models that normally don't mix. The synchronous interface is fully compatible with Python's standard queue module, while the asynchronous interface follows asyncio queue semantics. The library is built on aiologic and inspired by janus, but extends support to include trio and curio on the async side, and eventlet and gevent on the sync side. It includes features like dynamic maxsize adjustment, peek operations, atomic clearing, and the ability to subclass queues with custom storage backends. All internal methods are called in exclusive access mode, so custom subclasses don't need to worry about thread-safety. Use it for: - Bridging legacy synchronous code running in threads with new asyncio-based services in the same application. - Distributing work between a thread pool and an async task group without manual synchronization primitives. - Building adapter layers that accept messages from both sync and async producers and route them appropriately. - Migrating from standard queue to async-aware queues while keeping existing threaded code intact. - Coordinating between eventlet or gevent greenlets and trio or asyncio tasks in polyglot concurrency setups. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a dual-interface queue (sync and async) that bridges synchronous threaded code with asynchronous code across multiple async frameworks and sync concurrency models. Yes, if you need to bridge sync and async code in the same process. The low install friction, permissive ISC license, active maintenance, and broad concurrency framework support make it a solid choice for this specific problem. The Alpha status is not a blocker given recent activity and zero known vulnerabilities, but test it in your target concurrency mix before production use. ## Install pip install culsans uv add culsans poetry add culsans ## Installing culsans Before you install: Low install friction with only 2 runtime dependencies (aiologic and typing-extensions). Actively maintained with recent commits; marked as Alpha but in active development since 2024-11-02. License in practice: ISC License (permissive) places minimal restrictions on use, modification, and distribution; suitable for both open-source and proprietary projects. Quickstart: import culsans queue = culsans.Queue() # Sync side: queue.sync_q.put(item) # Async side: await queue.async_q.get() queue.shutdown() Requires Python 3.8 or later; async usage requires asyncio, trio, or curio; sync usage with eventlet or gevent requires those libraries installed separately. Verify before relying: - Whether the checkpoint behavior inherited from aiologic has measurable performance impact in typical workloads. - Real-world stability and maturity signals beyond the Alpha classification and download metrics. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 2.9M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags sync async queue bridge, thread safe async queue, cross-concurrency queue, asyncio threading queue, queue sync async interop, concurrency-bridge, async-sync-interop [View on SkillFed](https://skillfed.io/packages/culsans) · [View on PyPI](https://pypi.org/project/culsans/)