ArrayRef instead of ArrayBase in function interfaces
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 141
- Avg merge
- 16m
- Merged PRs (30d)
- 3
Description
Hi,
I frequently find myself wanting a read-only array in Python backed by a Rust-owned buffer (usually to print it in an interactive session).
For this I use PyArray::borrow_from_array which takes a &ArrayBase as parameter.
I would like this function to take a &ArrayRef instead to be able to use it with a greater variety of arguments.
While this is a breaking change, I reckon the necessary code changes at call sites would be small, since ArrayBase already implements Deref<Target=ArrayRef>.
In my quick search I only found a couple of places, where this proposed change could be applied
PyArray::borrow_from_array,PyArray::from_array,impl ToPyArray for ArrayRef(? not sure about this one).
Another consequence would be to bump the minimum version of the ndarray dependency to 0.17.1.
Kind regards!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the implementations and documentation for PyArray::borrow_from_array and PyArray::from_array, then inspect the impl ToPyArray for ArrayRef and the ndarray dependency declaration. Check all affected call sites and existing project checks; done means the proposed interfaces and dependency requirement are updated consistently and the project still builds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python, rust
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100