-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Building a rust binding R package depends on this r-polars #808
Comments
Here is https://github.com/rpolars/extendr_polars written by @sorhawell, but I don't know if it currently works as it is not tested and unmaintained. See also #732 and #776 (comment) Ideally, I think polars::DataFrame (Rust) should implement the Arrow C Stream interface and use it for each language's binding. (pola-rs/polars#14208) |
Thanks for the answers @eitsupi . I will try the repo above |
Contributions to https://github.com/rpolars/extendr_polars or this repository are welcome! |
When #1078 is merged, input/output through the Arrow C stream interface of Series and DataFrame will be supported, so it should be possible to read Series and DataFrame with |
In the near term there is also a very easy way to make this library publishable on |
Oh and allowing the library to also still be built as rust library instead of |
Thanks for your comment. However, I don't think there is a need to publish it to Crates.io. I don't have the bandwidth to update extendr_polars, so I'd appreciate it if someone could work on updating it. |
Well if you do not have the time to update But there are more reasons to do so! Let's say that somebody wants to write a rust library and export it via ffi to R. If this library has functions that expect or return a polars data frame then the function signatures need to use Allowing rust git import of this crate would be an easy first step to enable broader usage. The only change required for this is to update the supported [lib]
crate-type = ['staticlib', 'rlib'] This still taints any code on top to not be publishable on I hope you reconsider your stance on not publishing this crate, or at least enable building other R libraries on top of |
@etiennebacher sure thing. I would propose the following way of moving forward. Merge Request
Merge Request Tracking Issue Once 3 is completed publishing the crate to I have tested the procedure using my own private crate registry, so I am very confident that this will work. |
One additional point: this repository already depends on commits prior to polars-0.40.0. I don't see the benefit of publishing to crates.io, as it is not at all a problem to rely on Rust crates on GitHub when using Rust source code in an R package. |
Thanks for this detailed plan! This looks good to me, feel free to open a PR for 1) as it's the easiest one. Regarding 2), this might take some time (which is not a big deal since we have to wait for Edit: given @eitsupi message above (published at the same time), maybe wait before proceeding with 1) |
Not sure I understand @eitsupi. Most of the time, we use the Github commit of rust-polars which is associated to the Github release (and therefore to the new version on crates.io). There were a few occasions (like the current state of the repo) where we use a commit that is not associated with a github release but that is rare. So in most occasions, what we do is equivalent to using the crates.io versions, no? |
Yes, of course it is. But I think the patch is actually applied when it is released to crates.io. |
@eitsupi I do not understand the sentiment that polars would be unavailible on |
@ju6ge Most of Polars tests are written on the Python side, and I feel that Rust Polars is not stable at all. I think this is evident from the fact that Python Polars will soon be 1.0.0, whereas most developers do not pay attention to the version of Rust Polars (Breaking changes unmarked breaking changes are frequently introduced). Also, extendr and libR-sys are rarely released on crates.io, so I think it would be very hard for developers to stick to the version on crates.io. |
Again, I don't understand the need to register r-polars on crates.io even if all dependencies can be downloaded from crates.io. |
@eitsupi It is about the I agree that it might be annoying, if rust polars abi is unstable it does not matter if you use the git version or the crates.io version. The amount of work to stay in sync will be the same in the long run. |
In the Rust world, yes, but not in the CRAN-centered R world. In the R world, I don't see the value in releasing to crates.io at this time. |
I'm sure I've argued the same thing many times, but I welcome contributions to extendr-polars. |
It is a really painful task to fix a large number of breaking changes in Rust Polars in one PR, which is released only once a month. |
So you are arguing it is easier to update two seperate code bases instead of a single codebase? All that is needed to export to R from rust is already here.
I get that, and I get your time is limited. I do also want to express my respect for the work that has gone into this project already. |
Good point. In long-term, I expect the codebase to be simpler with savvy than with extendr. (#1126) Currently there is code on the Rust and R sides to use the Result type on extendr, and these are needed for extendr-polars (or something like that). |
I just created #1135. Which addresses enabling downstream projects to import |
First of all, thank you very much for this great R Polars project.
I would like to implement a db connection rust binding R package and convert data to polars directly and hence r-polars, but I don't know how to access r-polars robj. e.g. py-polars has https://github.com/pola-rs/pyo3-polars, which allows me to access python polars object. I was struggling to access r-polars series and dataframe from rust code, keep getting "invalid permission" or "memory not mapped" error.
Any suggestion is appreciated.
I defined a same RPolarsDataFrame struct, but apparently, this doesn't work.
The text was updated successfully, but these errors were encountered: