Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,45 @@ Currently, the IPython kernel will only process one message at a time. Including
Being able to wait on user input in Jupyter opens up possibilities for building interfaces. For example, in the GIF below, you can `await` on a GUI that takes a series of inputs.


![Demo](https://gist.githubusercontent.com/sonthonaxrk/01a0428bd318e477686d21a8b3135534/raw/7dcd0601bab46f291821023bbe3c69fdc4477407/asnyc_widget.gif)
## Quickstart

``` bash
git clone ...
pip install ./async-gui-ipython-kernel
python -m async_gui_ipython_kernel install --user

```

[Example Async Widget](https://gist.githubusercontent.com/sonthonaxrk/cf805531e9c362ae16722f6e9439814a/raw/5bbabeed1e0afec91b35eca47264e96308991136/ipywidget_async.py)
Make sure to set your kernel to `Async GUI Python 3 (async_gui_ipython_kernel)`.

## Quickstart
## Example

The following snippet prints a sequence of numbers, and each iteration requires the user to click the button to continue. "Vanilla" kernel would not respond on the clicks.


``` python
import asyncio
import ipywidgets as widgets

def wait_for_click(w):
e = asyncio.Event()
def handler(_):
e.set()
w.on_click(handler, remove = True)
w.on_click(handler)
return e.wait()

btn = widgets.Button(description = 'push')
display(btn)

for i in range(1, 1 + 3):
print(i)
print('press button to continue...')
await wait_for_click(btn)

print('done')

pip install git+git://github.com/sonthonaxrk/async_gui_ipython_kernel.git#egg=async_gui_ipython_kernel

Make sure to set your kernel to 'Async GUI kernel'.
```


## Disclaimer
Expand Down
165 changes: 0 additions & 165 deletions async_gui_ipython_kernel.py

This file was deleted.

19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[project]
name = "async-gui-ipython-kernel"
version = "0.0.2"

description = "Allows GUI events to be processed while the IPython kernel is processing a cell"

readme = "README.md"
keywords = []

dependencies = [
"ipykernel==6.29.5",
"jupyter_client==8.6.3"]

requires-python = ">= 3.10"


[tool.setuptools.packages.find]
namespaces = true
where = ["src"]
25 changes: 0 additions & 25 deletions setup.py

This file was deleted.

10 changes: 0 additions & 10 deletions share/jupyter/kernels/spec/kernel.json

This file was deleted.

Loading