An IPython extension for running twisted code
Project description
twisted_ipython
An IPython extension that uses crochet to enable running Twisted in IPython and Jupyter notebooks.
The Short Short Version
Install this package into your Jupyter notebook's kernel. Then, load the extension:
%load_ext twisted_ipython
and then turn on autoawait for Twisted:
%autoawait twisted
and with a helper for the demo
from twisted.internet import reactor
from twisted.internet.defer import Deferred
def sleep(t):
d = Deferred()
reactor.callLater(t, d.callback, None)
return d
we can now use async/await in cells like so:
print('Going to sleep...')
await sleep(1)
print('I HAVE AWAKENED!')
I Want To Know More!
Check out the much more complete README.ipynb!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
twisted_ipython-2.0.0.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for twisted_ipython-2.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a354f3965c63c6c797ab994422a1057ad7509f34581954b97cd8ac65071e2ec |
|
MD5 | 3cf6d9c7aa2cf0b47c515fd5a784a1df |
|
BLAKE2b-256 | ff7747dc49ab95d5cc8cb37c150b0ead7ef00f2b967d40db9d22c40ac753ea7b |