[Numpy-discussion] Exposing `from_dlpack` to the main namespace

2022-03-08 Thread Sebastian Berg
Hi,

just a brief note that:

https://github.com/numpy/numpy/pull/21145

will add `np.from_dlpack` (to import objects implementing the
`__dlpack__` dunder [1].  It was added with an underscore mainly due to
unlucky timing, IIRC.  There may also be some choices that could be
different, but I believe they ended up on the restrictive side for now
so that shouldn't need to worry us.

So this is just a heads-up, since it is an API addition, and I am not
sure it was brought up on the mailing list before.

Cheers,

Sebastian


[1] https://dmlc.github.io/dlpack/latest/python_spec.html


signature.asc
Description: This is a digitally signed message part
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] Re: Numpy Participation in Google Season of Docs 2022

2022-03-08 Thread bhavuk kalra
Hello Melissa,

Thank you for such a warm welcome. I am looking forward to joining the 
community calls on
9 March - Community Calls
10 - March - Newcomers Calls
and of course
14 March - Documentation Team Meeting.

I have started contributing to the Documentation for NumPy and have made a Pull 
Request for the same.
Reference - https://github.com/numpy/numpy/pull/21167.

If voluntary community Meeting Notes Taker are allowed then do let me know. 

Once again, Thank you for such a warm welcome! Looking forward to meeting you 
in the community calls.

Regards,
Bhavuk Kalra
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] Re: Exposing `from_dlpack` to the main namespace

2022-03-08 Thread Stefan van der Walt
Hi Sebastian,

On Tue, Mar 8, 2022, at 07:41, Sebastian Berg wrote:
> just a brief note that:
>
> https://github.com/numpy/numpy/pull/21145
>
> will add `np.from_dlpack` (to import objects implementing the
> `__dlpack__` dunder [1].

In other places in the ecosystem, like pandas and xarray, `from_x` and friends 
live as static methods on their respective classes.  Any reason not to add this 
as `numpy.array.from_dlpack`? We may also want to consider adding all the other 
`from*`'s there and deprecating the original usage (without removing it).

Stéfan
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] Re: Exposing `from_dlpack` to the main namespace

2022-03-08 Thread Stephan Hoyer
On Tue, Mar 8, 2022 at 8:27 AM Stefan van der Walt 
wrote:

> In other places in the ecosystem, like pandas and xarray, `from_x` and
> friends live as static methods on their respective classes.  Any reason not
> to add this as `numpy.array.from_dlpack`? We may also want to consider
> adding all the other `from*`'s there and deprecating the original usage
> (without removing it).
>

Pandas and Xarray make almost everything else a method, too, and encourage
using "method chaining" for manipulating datasets. So I'm not sure they are
great precedents here.

I think static/class methods are a fine way to write constructors, but are
not inherently superior. My vote would be to keep it as a function for
consistency with existing numpy constructors like frombuffer. It might even
make sense to call it np.fromdlpack, though the underscore really does
increase readability.
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] Re: Exposing `from_dlpack` to the main namespace

2022-03-08 Thread Sebastian Berg
On Tue, 2022-03-08 at 08:26 -0800, Stefan van der Walt wrote:
> Hi Sebastian,
> 
> On Tue, Mar 8, 2022, at 07:41, Sebastian Berg wrote:
> > just a brief note that:
> > 
> > https://github.com/numpy/numpy/pull/21145
> > 
> > will add `np.from_dlpack` (to import objects implementing the
> > `__dlpack__` dunder [1].
> 
> In other places in the ecosystem, like pandas and xarray, `from_x`
> and friends live as static methods on their respective classes.  Any
> reason not to add this as `numpy.array.from_dlpack`? We may also want
> to consider adding all the other `from*`'s there and deprecating the
> original usage (without removing it).


One thing I did not mention, is that what the data-api folks included
the symbol in their namespace [1].  So keeping it in the main namespace
has the benefit of aligning with that.


A class-/staticmethod would be an interesting API choice.  But I
suppose it would mainly be nice if we have a clear intention of moving
the others, too?  (Which unfortunately seems slow?)

If we almost certainly only consider duplicating this as methods, I
would tend to not worry about it for this PR – adding it doesn't stop
us from doing that later.
But of course it may still be a good time to discuss it!

An annoyance with methods is that our class is `np.ndarray` with an
awkward `__new__` [2].
So if it is `np.array.from_*` it would not be (only) a static- or
classmethod, but also attached to that function.

Cheers,

Sebastian


[1]
https://data-apis.org/array-api/latest/API_specification/generated/signatures.creation_functions.from_dlpack.html

[2] I suppose there may be a point in moving `np.ndarray(...)` users to
something more appropriate.  And maybe even eventually making
`np.array` the actual class.  But, if possible, the last part would be
a very long haul.


> 

> Stéfan
> 



signature.asc
Description: This is a digitally signed message part
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] Re: Exposing `from_dlpack` to the main namespace

2022-03-08 Thread Stefan van der Walt
On Tue, Mar 8, 2022, at 09:01, Sebastian Berg wrote:
> An annoyance with methods is that our class is `np.ndarray` with an
> awkward `__new__` [2].
> So if it is `np.array.from_*` it would not be (only) a static- or
> classmethod, but also attached to that function.

It sounds like there are several good reasons not to go the static route; 
thanks for considering, though.

Stéfan
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2022-03-08 Thread Sebastian Berg
Hi all,

Our bi-weekly triage-focused NumPy development meeting is Wednesday,
March 9th at 17:00 UTC (9:00am Pacific Time).
Everyone is invited to join in and edit the work-in-progress meeting
topics and notes:
https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg

I encourage everyone to notify us of issues or PRs that you feel should
be prioritized, discussed, or reviewed.

Best regards

Sebastian





signature.asc
Description: This is a digitally signed message part
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] NumPy Newcomers Hour – Thursday, March 10th

2022-03-08 Thread Inessa Pawson
The next NumPy Newcomers Hour will be held this *Thursday, March 10th at 4
pm UTC*.

*Mukulika Pahari* will present her tutorial *Analyzing the impact of the
lockdown on air quality in Delhi, India* (
https://numpy.org/numpy-tutorials/content/tutorial-air-quality-analysis.html
).

Join us *via Zoom*: https://us02web.zoom.us/j/87192457898

Cheers,
Inessa

Inessa Pawson
NumPy Contributor Experience Lead
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com