Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Mixed sync-async queue to interoperate between asyncio tasks and classic threads

Project description Chat on Gitter

Mixed sync-async queue, supposed to be used for communicating between classic synchronous (threaded) code and asynchronous (in terms of asyncio) one.

Like Janus god the queue object from the library has two faces: synchronous and asynchronous interface.

Synchronous is fully compatible with standard queue, asynchronous one follows asyncio queue design.

Usage example

import asyncio
import janus

loop = asyncio.get_event_loop()
queue = janus.Queue(loop=loop)

def threaded(sync_q):
    for i in range(100):

async def async_coro(async_q):
    for i in range(100):
        val = await async_q.get()
        assert val == i

fut = loop.run_in_executor(None, threaded, queue.sync_q)

Communication channels

aio-libs google group:!forum/aio-libs

Feel free to post your questions and ideas here.

gitter chat


janus library is offered under Apache 2 license.


The library development is sponsored by DataRobot (


0.4.0 (2018-07-28)

  • Add py.typed macro #89
  • Drop python 3.4 support and fix minimal version python3.5.3 #88
  • Add property with that indicates if queue is closed #86

0.3.2 (2018-07-06)

  • Fixed python 3.7 support #97

0.3.1 (2018-01-30)

  • Fixed bug with join() in case tasks are added by sync_q.put() #75

0.3.0 (2017-02-21)

  • Expose unfinished_tasks property #34

0.2.4 (2016-12-05)

  • Restore tarball deploying

0.2.3 (2016-07-12)

  • Fix exception type

0.2.2 (2016-07-11)

  • Update asyncio.async() to use asyncio.ensure_future() #6

0.2.1 (2016-03-24)

  • Fix python test command #4

0.2.0 (2015-09-20)

  • Support Python 3.5

0.1.5 (2015-07-24)

  • Use loop.time() instead of time.monotonic()

0.1.1 (2015-06-12)

  • Fix some typos in README and
  • Add addtional checks for loop closing
  • Mention DataRobot

0.1.0 (2015-06-11)

  • Initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for janus, version 0.4.0
Filename, size File type Python version Upload date Hashes
Filename, size janus-0.4.0-py3-none-any.whl (7.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size janus-0.4.0.tar.gz (18.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page