• Stars
    star
    193
  • Rank 199,909 (Top 4 %)
  • Language
    Python
  • License
    Other
  • Created about 12 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Synchronization primitives for Tornado coroutines

toro

https://raw.github.com/ajdavis/toro/master/doc/_static/toro.png

Info:Synchronization primitives for Tornado coroutines.
Author:A. Jesse Jiryu Davis

Documentation: https://toro.readthedocs.io/

Important

Toro is completed and deprecated; its features have been merged into Tornado. Development of locks and queues for Tornado coroutines continues in Tornado itself.

https://travis-ci.org/ajdavis/toro.png

About

A set of locking and synchronizing primitives analogous to those in Python's threading module or Gevent's coros, for use with Tornado's gen.engine.

Dependencies

Tornado >= version 3.0.

Examples

Here's a basic example (for more see the examples section of the docs):

from tornado import ioloop, gen
import toro

q = toro.JoinableQueue(maxsize=3)

@gen.coroutine
def consumer():
    while True:
        item = yield q.get()
        try:
            print 'Doing work on', item
        finally:
            q.task_done()

@gen.coroutine
def producer():
    for item in range(10):
        yield q.put(item)

producer()
consumer()
loop = ioloop.IOLoop.instance()
# block until all tasks are done
q.join().add_done_callback(loop.stop)
loop.start()

Documentation

You will need Sphinx and GraphViz installed to generate the documentation. Documentation can be generated like:

$ sphinx-build doc build

Testing

Run python setup.py test in the root directory.

Toro boasts 100% code coverage, including branch-coverage!

More Repositories

1

proporti.onl

Compare number of women, men, and nonbinary people among my friends and followers.
Python
238
star
2

motor-blog

Blog based on Tornado, MongoDB, and Motor. To be used with MarsEdit.
Python
148
star
3

coroutines-demo

Live-coding a Python 3 async framework
Python
67
star
4

GreenletProfiler

Abandoned, please use Yappi.
C
51
star
5

chirp

A minimal Twitter clone to demonstrate Tornado and MongoDB
JavaScript
48
star
6

python-paxos-jepsen

Paxos in Python, tested with Jepsen
Python
31
star
7

cluster-profile

Demo scripts for setting up and profiling a sharded MongoDB cluster.
Python
16
star
8

geo-paging-example

Example of using MongoDB's new $minDistance option for paging through geo results.
JavaScript
13
star
9

emptysquare-lektor

Python
13
star
10

consistency-isolation-pycon-2023

Files related to A. Jesse Jiryu Davis's PyCon 2023 talk.
Python
12
star
11

tornado-test

Conveniences for unittesting Tornado-based asynchronous code
Python
10
star
12

asyncio-chat-example

Python 3.4 asyncio chat example
JavaScript
9
star
13

things2rtm

Import tasks from Cultured Code's Things to Remember The Milk
Python
8
star
14

bson-numpy

Fast conversion between NumPy arrays and MongoDB's native data format, BSON.
Python
8
star
15

yieldpoints

Simple extensions to Tornado's gen module.
Python
8
star
16

why-should-async-get-all-the-love

Source files for A. Jesse Jiryu Davis's PyCon 2022 talk
Python
7
star
17

zero-to-app

Zero to App in 30 Minutes, with Python and MongoDB
JavaScript
5
star
18

trickle

IOStream wrapper for use with Tornado coroutines
Python
5
star
19

osbridge-2015

Script for implementing Python async coroutines, live!
Python
4
star
20

pymongo-mockup-tests

Test PyMongo with MockupDB - for eventual merge into mongo-python-driver repo.
Python
4
star
21

emptysquare.net

A minimalist static photography gallery, pulling sets from a Flickr collection.
Python
3
star
22

motor-tools

Tools for developing and testing Motor, an asynchronous Python driver for Tornado and MongoDB
Python
3
star
23

list-of-tlaplus-operators

TeX
2
star
24

rescue_bson

Python
2
star
25

motor.github.com

GitHub Pages site for Motor, an asynchronous driver for MongoDB and Tornado
2
star
26

yelp-better-bookmarks

Nicer Yelp personal bookmarks browsing with Google maps
JavaScript
2
star
27

json_validate

A wrapper function that validates that some JSON object matches a spec, something like a validating XML parser. This is particularly useful if you expose a JSON API to third-party developers and want to return a useful error if they provide malformed input.
Python
2
star
28

SyncSend

Simple means of sending very large files to someone else if you're both online at the same time
JavaScript
2
star
29

eventuallycorrect

Code and supplements for my PyCon 2015 "Eventually Correct" talk on async testing.
Python
2
star
30

ShardViz

Watch a MongoDB sharded cluster rebalancing its data distribution
Shell
1
star
31

Emptysquare-Slideshow

Generate a static HTML + jQuery slideshow from a Flickr set. Inspired by New York Times' elegant dark slideshow layouts.
Python
1
star
32

svnlog

Script to view Subversion commit comments and diffs, same as git does by default.
1
star
33

emptysquare-hugo

A. Jesse Jiryu Davis's personal blog and site.
CSS
1
star
34

eventcalendar3

Event Calendar 3 WordPress plugin - ajdavis's fork
PHP
1
star
35

three-eleven-mongolite-demo

Analyze NYC Noise Complaints with R, MongoDB, and Mongolite
R
1
star
36

uninterpolate

Update Python' code to replace the old % formatting with format()
1
star
37

emptysquare-wordpress-theme

WordPress theme for emptysquare.net
1
star
38

lambda-endsessions-python

Python
1
star
39

term2image

Read the output of a terminal command like "man" or "ls" and write a PNG.
Python
1
star
40

2021-jesse-samy-tlaplus

Source for Interactive TLA+ talk at 2021 TLA+ Conference
TLA
1
star
41

what-to-expect-when-youre-expiring

Demonstrations of what can go wrong with Python's __del__.
Python
1
star
42

ajdavis-queue-theory-exercises

Python
1
star