You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2025/10/22 04:34:29 UTC

[PR] feat(r): Add reticulate/Python integration [arrow-nanoarrow]

paleolimbot opened a new pull request, #817:
URL: https://github.com/apache/arrow-nanoarrow/pull/817

   This PR adds the s3 generics required to interact with Python objects via reticulate. Thie relies on nanoarrow for Python, which also exposes primitives for interacting with capsules. In theory we wouldn't need nanoarrow for Python for the Python -> R case if we could create and consume PyCapsules but this is at least a good start!
   
   ``` r
   library(nanoarrow)
   library(reticulate)
   
   pa <- import("pyarrow", convert = FALSE)
   
   x <- pa$array(c(1, 2, 3))
   
   (array <- as_nanoarrow_array(x))
   #> <nanoarrow_array double[3]>
   #>  $ length    : int 3
   #>  $ null_count: int 0
   #>  $ offset    : int 0
   #>  $ buffers   :List of 2
   #>   ..$ :<nanoarrow_buffer validity<bool>[null] ``
   #>   ..$ :<nanoarrow_buffer data<double>[3][24 b]> `1 2 3`
   #>  $ dictionary: NULL
   #>  $ children  : list()
   (py_array <- r_to_py(array))
   #> nanoarrow.Array<double>[3]
   #> 1.0
   #> 2.0
   #> 3.0
   py_to_r(py_array)
   #> <nanoarrow_array double[3]>
   #>  $ length    : int 3
   #>  $ null_count: int 0
   #>  $ offset    : int 0
   #>  $ buffers   :List of 2
   #>   ..$ :<nanoarrow_buffer validity<bool>[null] ``
   #>   ..$ :<nanoarrow_buffer data<double>[3][24 b]> `1 2 3`
   #>  $ dictionary: NULL
   #>  $ children  : list()
   ```
   
   Closes #810.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(r): Add reticulate/Python integration [arrow-nanoarrow]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on PR #817:
URL: https://github.com/apache/arrow-nanoarrow/pull/817#issuecomment-3438374804

   If there are no objections I'll merge later today!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(r): Add reticulate/Python integration [arrow-nanoarrow]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot merged PR #817:
URL: https://github.com/apache/arrow-nanoarrow/pull/817


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org