janus
Mixed sync-async queue to interoperate between asyncio tasks and classic threads
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Must call aclose() when done to properly clean up internal tasks; requires Python 3.9 or later.
- Low friction: pure Python wheel with no runtime dependencies.
- Actively maintained with recent commits and stable production status.
License · maintenance · safety
Apache 2 (permissive) — Apache 2 permissive license allows commercial and private use with minimal restrictions.
last release 2024-12-13 (609 days) · last repo commit 2026-08-03 · 964 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 6,702,225 downloads/mo, #1,868 on PyPI
Alternatives
Verify before relying
import asyncio
import janus
async def main():
queue = janus.Queue()
loop = asyncio.get_running_loop()
loop.run_in_executor(None, lambda: queue.sync_q.put(None))
val = await queue.async_q.get()
await queue.aclose()
asyncio.run(main())- Whether the performance penalty for sync-only or async-only use cases is acceptable for your workload.
- Whether culsans (mentioned as an experimental alternative) offers the features or performance your application needs.
What it is and 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.
The 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—for purely synchronous or purely asynchronous scenarios, the standard library queues are faster.
Use it for
- 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.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
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.
Install
janus on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained with recent commits and stable production status.
Must call aclose() when done to properly clean up internal tasks; requires Python 3.9 or later.
License in practice
Apache 2 permissive license allows commercial and private use with minimal restrictions.
Quickstart
import asyncio
import janus
async def main():
queue = janus.Queue()
loop = asyncio.get_running_loop()
loop.run_in_executor(None, lambda: queue.sync_q.put(None))
val = await queue.async_q.get()
await queue.aclose()
asyncio.run(main())
Verify before relying
- Whether the performance penalty for sync-only or async-only use cases is acceptable for your workload.
- Whether culsans (mentioned as an experimental alternative) offers the features or performance your application needs.
Package facts
| License | Apache 2 permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 609 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,702,225 / month, #1,868 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 :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries |
Evidence: janus-2.0.0-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 › “thread asyncio communication”
- janusProvides a thread-safe queue with both synchronous and asynchronous…
- zthreadingProvides event-driven communication and task management for Python…
- culsansProvides a dual-interface queue (sync and async) that bridges…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also aiochannel · culsans · synchronicity · threaded · asyncer · arq · nexus-rpc · aiologic · persist-queue · powerbot-client