Crochet 1.1.0 - Use Twisted anywhere!

Itamar Turner-Trauring itamar at
Sat Mar 15 13:23:58 CET 2014

Crochet is an MIT-licensed library that makes it easier for blocking or 
threaded applications like Flask or Django to use the Twisted networking 
framework. Crochet provides the following features:

  * Runs Twisted's reactor in a thread it manages.
  * The reactor shuts down automatically when the process' main thread
  * Hooks up Twisted's log system to the Python standard library logging
    framework. Unlike Twisted's built-in logging bridge, this includes
    support for blocking Handler instances.
  * A blocking API to eventual results (i.e. Deferred instances). This
    last feature can be used separately, so Crochet is also useful for
    normal Twisted applications that use threads.


*Trivial Example

Download a web page in a blocking manner.

from  __future__  import  print_function

import  sys

from  twisted.web.client  import  getPage
from  crochet  import  setup,  wait_for_reactor

def  download_page(url):
     return  getPage(url)

# download_page() now behaves like a normal blocking function:

*What's New in 1.1.0*

Bug fixes:

  * EventualResult.wait() can now be used safely from multiple threads,
    thanks to Gavin Panella for reporting the bug.
  * Fixed reentrancy deadlock in the logging code caused by, thanks to Rod Morehead for
    reporting the bug.
  * Crochet now installs on Python 3.3 again, thanks to Ben Cordero.
  * Crochet should now work on Windows, thanks to Konstantinos Koukopoulos.
  * Crochet tests can now run without adding its absolute path to
    PYTHONPATH or installing it first.


  * EventualResult.original_failure is now documented.


More information about the Python-announce-list mailing list