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 finishes.
- Hooks up Twisted's log system to the Python standard library
loggingframework. Unlike Twisted's built-inloggingbridge, this includes support for blocking Handler instances. - A blocking API to eventual results (i.e.
Deferredinstances). This last feature can be used separately, so Crochet is also useful for normal Twisted applications that use threads.
Documentation can be found on Read The Docs.
Bugs and feature requests should be filed at the project Github page.
0.9.0
New features:
- Expanded and much improved documentation, including a new section with design suggestions.
- New decorator
@wait_for_reactoradded, a simpler alternative to@run_in_reactor. - Refactored
@run_in_reactor, making it a bit more responsive. - Blocking operations which would otherwise never finish due to reactor having
stopped (
EventualResult.wait()or@wait_for_reactordecorated call) will be interrupted with aReactorStoppedexception.
Bug fixes:
@run_in_reactordecorated functions (or rather, their generated wrapper) are interrupted by Ctrl-C.- On POSIX platforms, a workaround is installed to ensure processes started by reactor.spawnProcess have their exit noticed. See Twisted ticket 6378 for more details about the underlying issue.
0.8.1
EventualResult.wait()now raises error if called in the reactor thread.- Unittests are now included in the release tarball.
- Allow Ctrl-C to interrupt
EventualResult.wait(timeout=None).
0.7.0
- Improved documentation.
0.6.0
- Renamed
DeferredResulttoEventualResult, to reduce confusion with Twisted'sDeferredclass. The old name still works, but is deprecated. - Deprecated
@in_reactor, replaced with@run_in_reactorwhich doesn't change the arguments to the wrapped function. The deprecated API still works, however. - Unhandled exceptions in
EventualResultobjects are logged. - Added more examples.
setup.py sdistshould work now.
0.5.0
- Initial release.