{"categories":[{"label":"Libraries","url":"https://skillfed.io/packages/category/software-development-libraries/2"}],"enrichment":{"capability":"Provides a thread-safe queue with both synchronous and asynchronous interfaces for passing data between classic threaded code and asyncio tasks.","skillfed_tags":["asyncio","threading","queue"],"use_cases":["Pass work items from a thread pool to asyncio tasks without manual synchronization.","Collect results from blocking I/O operations in threads and consume them asynchronously.","Integrate legacy synchronous libraries into an asyncio-based application.","Coordinate between a background worker thread and an asyncio event loop.","Implement a producer-consumer pattern where one side is threaded and the other is async."],"what_it_does":"Janus is a queue implementation that bridges synchronous (threaded) and asynchronous (asyncio) code by exposing the same queue object through two separate interfaces: sync_q for classic Python threads and async_q for asyncio tasks. It implements Queue, LifoQueue, and PriorityQueue variants, each compatible with their standard library counterparts on the sync side and asyncio queue design on the async side.\n\nThe library is built on thread-safe primitives and is production-stable, actively maintained to support current Python versions. It's designed specifically for the use case of passing data between a threaded executor and asyncio code running in the same process. The main constraint is that you must explicitly close the queue with aclose() when done, and it performs best only when actually bridging sync and async code\u2014for purely synchronous or purely asynchronous scenarios, the standard library queues are faster.","worth_installing":"Yes, if you need to communicate between threaded and asyncio code in the same process. The library is stable, well-maintained, has no external dependencies, and solves a real coordination problem. Install it only if you actually have both sync and async code to bridge; for purely sync or purely async scenarios, use the standard library queues instead."},"id":"janus","links":{"html":"https://skillfed.io/packages/janus","md":"https://skillfed.io/packages/janus.md","pypi":"https://pypi.org/project/janus/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2024-12-13","license_spdx":null,"license_treatment":"permissive","name":"janus","python_support":"supports_current","summary":"Mixed sync-async queue to interoperate between asyncio tasks and classic threads"},"popularity":{"monthly_downloads":6702225,"position":1868,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"2.0.0"}
