7 ms·
You can run Rust code in a Jupyter notebook
- ismailmaj 4y agoI 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.
- ejanus 4y agoCould you give steps on how you configured your ide?
- deleted 4y ago[deleted]
- schneems 4y agoThat’s interesting. This is really interesting: a REPL for Rust https://github.com/google/evcxr/blob/main/evcxr_repl/README.md https://github.com/google/evcxr/blob/main/evcxr_repl/README.....
- Kab1r 4y agoI could see myself using this for prototyping
- wiseowise 4y ago> Disclaimer > This is not an officially supported Google product. It's released by Google only because the (original) author happens to work there.
- grepLeigh 4y agoBetween 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.
- orlp 4y agoI'm interested in possibly contributing / optimizing in polars, I would be curious to hear from a user first-hand which things are painful and/or slow still.
- bobbylarrybobby 4y agoPainful (polars-lazy): - Very scant documentation. Many things missing docs, many documented items missing examples. - Using a custom function in a map. You have to do this `Ok(series.type()?.into_iter().map(...).collect::<ChunkedArray<_>>()).into_series()` dance every time, and it's annoying. And you have to specify the output type even though it should be inferable from the function body. - There is no good way to "get-or-null" a column, i.e., treat an absent column as all null. You have to try to select the column, check if that errored, and if so insert a column of nulls (casted to the correct type) before proceeding. - Perhaps because it uses Arrow under the hood, there is no such thing as a non-nullable column. You just always have to handle nulls. - A bit verbose due to the lack of Into<Expr> implementations for most basic types. E.G., `lit(false)` instead of `false` because `bool` is not `Into<Expr>`. - It's a bit confusing at times which features you need for which abilities, and things will panic at runtime if you don't have the necessary features enabled (e.g., the strptime function has a tz_aware:bool parameter that panics if it's true but you don't have the time zone feature enabled). Ultimately it's a young library and so I guess it comes with the territory. It's still fantastic and having used it I'd be hard pressed to go back to pandas even despite all the flaws.
- grepLeigh 4y agoTo echo the other comment, I've found digging around the test suites to be more reliable and comprehensive than the official examples/documentation. If you're running into issues with the Lazy API, read through these tests and see if that clears anything up: https://github.com/pola-rs/polars/tree/master/polars/polars-lazy/src/tests https://github.com/pola-rs/polars/tree/master/polars/polars-... My usage is very narrow (aggregating a dataframe of bounding box observations over a sliding time window) and I only use streaming Arrow IPC, which both work great!
- batterylow 4y agoEvcxr 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-notebooks/ https://datacrayon.com/shop/product/data-analysis-with-rust-... [2] https://www.youtube.com/watch?v=SZKEzNL9als https://www.youtube.com/watch?v=SZKEzNL9als [3] https://www.arewelearningyet.com https://www.arewelearningyet.com
- kibwen 4y agoNote that you can install evcxr and use it as a Rust REPL in your terminal (see https://github.com/google/evcxr/blob/main/evcxr_repl/README.md https://github.com/google/evcxr/blob/main/evcxr_repl/README.... ). (Tip: alias it to something that you'll actually remember how to type!)
- lynndotpy 4y agoEvcxr 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!
- pornel 4y agoWord of warning: evcxr runs Rust in unoptimized debug mode. This is really unoptimized to the point it's sometimes slower than Python.
- epage 4y agoI'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.
- rowanG077 4y agoDid you try GHCi? The interactive REPL of GHC (Haskell)? I feel it's the best REPL I have tried. Certainly beats out Python and JS.
- eternalban 4y agoHow 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 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 https://github.com/jupyter/jupyter/wiki/Jupyter-kernels p.s. sadly the Brainfuck kernel is kaput. don't get your hopes up.
- Alifatisk 4y agoSo this is sort of a repl for Rust?