IRust
IRust copied to clipboard
Improve Jupyter kernel support
Discussed in https://github.com/sigmaSd/IRust/discussions/107
Originally posted by baiguoname November 30, 2022 Jupyter is amazing, can I use Irust in Jupyter, especially in vscode-jupyter.
- [ ] Depends on https://github.com/sigmaSd/IRust/issues/103
Any updating in this feature? I believe there are many people like me is waiting for this.
I just want to reiterate that tere is already evcxr which have jupyter support, I'm sure they would accept feature requests for missing features
The problem with jupyterr and rust, is we don't have a real repl yet as in the code needs to be recompiled each time, so it's really slow, compare that to the instantaneous experience of Python and Julia for example
To answer your question, unfortunately I don't have time to work on it now, I'll try to get to it when I can or maybe someone can send a pr
I reread the jupyter docs and the implementation here https://github.com/sigmaSd/IRust/tree/master/crates/irust_repl#jupyter-kernel
what I see is:
- The current implementation works but is bear-bone
- I have a couple of ideas on how to improve it :
- Instead of waiting on irust to be more ipc friendly, we can just have a new binary irust_jupyter that executes the commands it receives from the python kernel (like the current re example but with more on the rust side)
- I'm not sure though if the parsing of the input should be on the python or the rust side
But I don't want to go through the effort of adding this, without knowing how people use it, so my plan for now is to wait for feedback on the current implementations:
- whats is being used for
- what are the obvious limitations and things to improve
- are there particular features ppl want
And I'll try to keep fixing low hanging fruits, until the picture is more clear and I can start on the rework
I put the re.exe
in the same directory of irust.py
, and change the absolute absolute_path/re
path in irust.py
to relative path re.
And then run jupyter from the directory. Then everything works fine, the jupyter just run magically as fast as like running the python on jupyter.
But I have an uncertainty:
Liking using irust_repl
in terminal, each time I executing an input, the already inserted code to the Repl
object will run again. I am using irust_repl
in an website server, which accept input codes at once and run the all input codes then return output. So the behavior of rerunning the inserted codes have no effect on my website server. But I thought it may have effects when running irust_repl
in jupyter. As I know, the common process of using jupyter is running the cells over and over again without restarting the kernel. So if the inserted codes have some heavy task of computing, it will take some unnecessary time to rerun these codes.
Yes unfortunately that's a core limitation to this project, it's just how it works
I improved the installation experience https://github.com/sigmaSd/IRust/blob/master/crates/irust_repl/README.md#jupyter-kernel
Now to use the kernel you just need:
pip install irust_kernel
python -m irust_kernel.install
I added support for evcxr protocol, so now you can use programs that targets it, example: https://github.com/sigmaSd/IRust/blob/master/crates/irust_repl/irust_kernel/evcxr.ipynb