Evcxr: A Rust REPL and Jupyter Kernel
github.com
github.com
That's an impressive amount of hacks under the hood! I thought maybe there would be an interpreter involved, but it really does invoke rustc and then loads the code with dynamic linking.
Rust hold interesting promise for data analysis and visualization at scale, especially as someone who hits use cases where Python/R start to bottleneck. The ecosystem is not there yet, though.
Rust is nice when you want something lightweight and fast, since Julia has a pretty heavyweight runtime.
We're expecting more benefits down the pipe as well with better AOT compilation support so you don't have to redo compilation so much between sessions.
Compilation and precompilation latency have been the two most consistent focuses of the developer team over the past couple years.
I also imagine future iterations will focus on AOT options as well (we already have some in the form of PackageCompiler.jl),
The data science ecosystem isn’t quite there yet, but you can still do some things easily if you want to.
If you’re interested, you may want to check out my book on the topic https://datacrayon.com/shop/product/data-analysis-with-rust-...
Do any of the other non-Python Jupyter kernels have examples of working fancy UI components? https://github.com/jupyter/jupyter/wiki/Jupyter-kernels
Jupyter kernels implement the Jupyter kernel message spec. Introspection, Completion: https://jupyter-client.readthedocs.io/en/latest/messaging.ht...
Debugging (w/ DAP: Debug Adapter Protocol) https://jupyter-client.readthedocs.io/en/latest/messaging.ht...
A `display_data` Jupyter kernel message includes a `data` key with a dict value: "The data dict contains key/value pairs, where the keys are MIME types and the values are the raw data of the representation in that format." https://jupyter-client.readthedocs.io/en/latest/messaging.ht...
This looks like it does something with MIME bundles: https://github.com/jupyter-xeus/xeus-cling/blob/00b1fa69d17b...
ipython.display: https://github.com/ipython/ipython/blob/master/IPython/displ...
ipython.core.display: https://github.com/ipython/ipython/blob/master/IPython/core/...
ipython.lib.display: https://github.com/ipython/ipython/blob/master/IPython/lib/d...
You can also run Jupyter kernels in a shell with jupyter/jupyter_console:
pip install jupyter-console jupyter-client
jupyter kernelspec list
jupyter console --kernel python3It allows you to do a 3D (offline) render with 3Delight (on AWS, if you want) – directly into a notebook.
Here is an example notebook[2].
I haven't managed to update the image dynamically while it's rendering (there's no support for that in evcxr). If anyone knows how to do this, I'd be keen to add that too.
[1] https://crates.io/crates/nsi
[2] https://github.com/virtualritz/nsi/blob/master/examples/jupy...
If you streaming in blocks on the server side and compositing them into a final render, in this case there are a couple hacks.
1) just use a timer and reload the image every x seconds
2) do a hanging read on and endpoint, return updated image. This has the nice quality of the server being able to decide the framerate.
I was wondering if sending it as an MNG with loop=1 would work.
https://ipython.readthedocs.io/en/stable/config/integrating....
You might be able to do everything in there with a little JS.
It was really useful to have easy acces to the simulation code and datastructures from the notebook where I made the plots, and use the same language for both. Glad to see the project still going strong.
For very interactive, experimental work I like having code in one pane and a REPL in another separate one - so that you can highlight and send snippets of a file to the REPL with a keystroke or two, and the code and results aren't mixed together.
RStudio or Vim Slime[1] would be my favourite examples of this kind of approach.
For more "static" literate programming, I prefer the way RMarkdown and Sweave work to Jupyter Notebooks (though I don't even use R anymore). Both have their strengths and weaknesses of course.
Knowing Rust (and other strong typed langs) I understand that it is not so easy to implement this workflow for these languages. But looking at this project I kind of have new hopes. With the strong languages it should even be possible to have intellisense-like completion/suggestion available on the REPL!
Would it be, eventually, possible use Evcxr for this purpose?