[HN Gopher] You can run Rust code in a Jupyter notebook
___________________________________________________________________
You can run Rust code in a Jupyter notebook
Author : nbrempel
Score : 123 points
Date : 2023-01-14 15:17 UTC (7 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| ismailmaj wrote:
| 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.
| lynndotpy wrote:
| 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!
| [deleted]
| Kab1r wrote:
| I could see myself using this for prototyping
| pornel wrote:
| Word of warning: evcxr runs Rust in unoptimized debug mode. This
| is really unoptimized to the point it's sometimes slower than
| Python.
| schneems wrote:
| That's interesting. This is really interesting: a REPL for Rust
|
| https://github.com/google/evcxr/blob/main/evcxr_repl/README.....
| wiseowise wrote:
| > Disclaimer
|
| > This is not an officially supported Google product. It's
| released by Google only because the (original) author happens to
| work there.
| dijit wrote:
| standard for a 20% project.
| netr0ute wrote:
| Is this how all the 20% projects work?
| dijit wrote:
| if they are open sourced, yeah
| netr0ute wrote:
| If so, then I'm not going to Google in a million years.
| User23 wrote:
| Gmail was a 20% project.
| grepLeigh wrote:
| 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.
| orlp wrote:
| I'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 wrote:
| Painful (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(s
| eries.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.
| batterylow wrote:
| 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
| kibwen wrote:
| Note 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....
| ). (Tip: alias it to something that you'll actually remember
| how to type!)
| epage wrote:
| 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.
| rowanG077 wrote:
| Did 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.
___________________________________________________________________
(page generated 2023-01-14 23:01 UTC)