from Hacker News

You can run Rust code in a Jupyter notebook

by nbrempel on 1/14/23, 3:17 PM with 25 comments

  • by grepLeigh on 1/14/23, 6:12 PM

    Between Rust kernels for Jupyter notebooks, PolarRS, and Gstreamer bindings, Rust has become my tool of choice for computer vision pipelines.

    I used to prototype in Python, then re-implement the final algorithm in Rust for performance on an embedded device. Now I just start prototyping in Rust.

  • by batterylow on 1/14/23, 6:15 PM

    Evcxr is great, and I used it to write Data Analysis with Rust Notebooks [1]! There's also this video on getting up and running with it [2], although it's 2 years old.

    Ultimately, the ecosystem isn't yet as convenient as something like Python. I used to keep an eye on "Are we learning yet?" [3] - although it's been a while now!

    [1] https://datacrayon.com/shop/product/data-analysis-with-rust-...

    [2] https://www.youtube.com/watch?v=SZKEzNL9als

    [3] https://www.arewelearningyet.com

  • by schneems on 1/14/23, 6:12 PM

    That’s interesting. This is really interesting: a REPL for Rust

    https://github.com/google/evcxr/blob/main/evcxr_repl/README.....

  • by lynndotpy on 1/14/23, 8:05 PM

    Evcxr has been instrumental for just learning Rust, IME.

    Being able to type a line of code and get immediate feedback is one of the great pleasures of interpreted languages. Really useful when "try into" or "unwrap", etc. are still unfamiliar!

  • by pornel on 1/14/23, 8:08 PM

    Word of warning: evcxr runs Rust in unoptimized debug mode. This is really unoptimized to the point it's sometimes slower than Python.
  • by epage on 1/14/23, 9:26 PM

    I'm interested in making REPL support for Rust first-class and am curious where people think evcxr lets you down in usability and any suggestions in overcoming them. Compiled languages offer unique challenges for REPLs and I feel like I've not seen it pulled off well.
  • by wiseowise on 1/14/23, 6:12 PM

    > Disclaimer

    > This is not an officially supported Google product. It's released by Google only because the (original) author happens to work there.

  • by eternalban on 1/14/23, 11:28 PM

    How cool. This motivated a quick search - this could be fun:

    How to write your own kernel

    https://jupyter-client.readthedocs.io/en/stable/kernels.html

    All the language kernels (a lot of abandoned ones - the mariaDB one ('binder') will take a while to load but SQL in Jupyter!)

    https://github.com/jupyter/jupyter/wiki/Jupyter-kernels

    p.s. sadly the Brainfuck kernel is kaput. don't get your hopes up.

  • by ismailmaj on 1/14/23, 8:03 PM

    I stopped using evcxr when I realized that I could get the same instant feedback with rust-analyzer and a properly configured IDE.

    Maybe it can be useful for data exploration with polars but I still prefer Python for that.

  • by Kab1r on 1/14/23, 6:10 PM

    I could see myself using this for prototyping
  • by Alifatisk on 1/15/23, 2:14 PM

    So this is sort of a repl for Rust?