-
Notifications
You must be signed in to change notification settings - Fork 120
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
PyArrayDescr
methods like in np.dtype
+ some missing stuff in npyffi
#261
Conversation
There's still a few TODOs and questions around that will need to be resolved, plus I wanted to add at least some trivial tests for each of the methods, and add a |
Another thing I don't like is how typenums are encoded right now - maybe clean it up a bit?
What could be done:
From the public API perspective, you could then do |
I don't think that it is possible to reference the type alias in a
Personally, I would actually prefer it not becoming part of the API again if possible. Put differently, I see API surface as a liability that should be avoided if possible. |
@adamreichold Fixed all todos and a few things noted above, let me know if you think anything else is needed to change/add/remove. (I still need to write tests for all of this; although it's all quite trivial it should all get triggered at least once somewhere in the test suite.) As for pub fn get_field(&self, name: &str) -> PyResult<(&PyArrayDescr, usize)> And then we don't have maps, iterators and excessive unwrapping, it all lands onto the user and we keep it reasonably simple. Here, Given that there's already |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 just skim read, got a few quick thoughts. Thanks!
Would it be worth adding some tests for the new dtype methods? edit: I see you mentioned that above!
If there's interest, you might want to add a coverage job to CI. You can steal configuration from pyo3 :) |
Looks pretty nice, good point! (never had a chance to use ci coverage with rust in particular for some reason, but from a brief look at pyo3's codecov reports looks pretty cool). I'll try to open a separate pr for that tomorrow here. |
71811a9
to
0c8c520
Compare
Ok:
|
e7e160e
to
7c988d1
Compare
7c988d1
to
ce897cb
Compare
Ok, clippy's finally happy. Added a changelog entry as well. So unless there's further comments this should be good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, clippy's finally happy. Added a changelog entry as well. So unless there's further comments this should be good to go.
I think so too. Will leave it open until tomorrow if anybody else wants to have a look.
(It is a matter of personal preferences, but I do find the changelog entry a bit on the wordy end of the scale. This could undermine the changelog's purpose of quickly getting an overview of the changes. The argument does not seem strong enough to me to ask for changes, I just wanted to mention it for consideration.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done, thank you!
@adamreichold I've noticed that as well. I guess I'm just used to more lengthy changelogs like the one we keep in the hdf5 crate. For me personally, if I'm an active user of some crate, I would be more than happy if the devs shared all the new functionality and features that may be relevant to me as a user. As long as it's written in a structured form in human language and doesn't look like Arrow changelog. In cases like the one here, I suggest to always commit as much information as possible to the changelog, and before the release to shorten it down if needed and prettify it (e.g. "10 new methods added to Looking at the current But anyways, I'm more of a newcomer here so that's my personal 2 cents on the subject :) |
npyffi
stuff has been pulled out ofpyo3-type-desc
.PyArrayDescr
mostly replicatenp.dtype
object, plus a few methods replicating C macros (this will greatly simplify writing tests inpyo3-type-desc
, plus makesPyArrayDescr
object somewhat useful).