akernel 0.0.5
pip install akernel==0.0.5
Released:
An asynchronous Python Jupyter kernel
Navigation
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License
- Author: David Brochart
- Requires: Python >=3.7
Classifiers
- License
- Operating System
- Programming Language
Project description
akernel
An asynchronous Python Jupyter kernel.
Features
akernel
allows for asynchronous code execution. What this means is that when used in a Jupyter
notebook, you can run cells concurrently if the code is cooperative. For instance, you can run a
cell with the following code:
# cell 1
for i in range(10):
print("cell 1:", i)
await asyncio.sleep(1)
Since this cell is async
(it has an await
), it will not block the execution of other cells.
So you can run another cell concurrently, provided that this cell is also cooperative:
# cell 2
for j in range(10):
print("cell 2:", j)
await asyncio.sleep(1)
If cell 2 was blocking, cell 1 would pause until cell 2 was finished. You can see that by changing
await asyncio.sleep(1)
into time.sleep(1)
in cell 2.
You can make a cell wait for the previous one to be finished with:
# cell 2
await __task__() # wait for cell 1 to be finished
print("cell 1 has run")
Limitations
It is still a work in progress, and a bit hacky. In particular:
- Error tracebacks are a bit messy.
- If a cell wants to access a variable of another running cell, this variable must exist before the execution of both cells.
stdout
/stderr
redirection to the cell output is only supported through theprint
function.- No rich representation for now, only the standard
__repr__
is supported. This means no matplotlib figure yet :-( But ipywidgets should work! - If the cell code has multiline strings, they must be wrapped with the
textwrap.dedent
function.
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License
- Author: David Brochart
- Requires: Python >=3.7
Classifiers
- License
- Operating System
- Programming Language
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
Built Distribution
File details
Details for the file akernel-0.0.5.tar.gz
.
File metadata
- Download URL: akernel-0.0.5.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91d3528fcbae8fd4e33e67a97915590d1251db74f85ace4c9b695ba8c7468006 |
|
MD5 | 961a816f747217e31673bc042acc00fe |
|
BLAKE2b-256 | 172c970725434eaf38391e2939bb6022c663230a2992830012a832fda1146773 |
File details
Details for the file akernel-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: akernel-0.0.5-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6628defe0436a001d850e4c26e0f92ecfc04e6493b8e5efda90fde0d7dca77b1 |
|
MD5 | c34da6b0b027617df4eedfeefcd8aa1e |
|
BLAKE2b-256 | 73a8502e5d2a32d07dd472b59de82eef5ae84266ba3d25fbbefba4b413d61c90 |