[Numpy-discussion] Re: NumPy security roadmap proposal

2025-06-13 Thread Ralf Gommers via NumPy-Discussion
On Fri, Jun 13, 2025 at 11:13 AM Andrew Nelson via NumPy-Discussion <
numpy-discussion@python.org> wrote:

>
> On Fri, 13 Jun 2025 at 16:43, Ralf Gommers via NumPy-Discussion <
> numpy-discussion@python.org> wrote:
>
>>
>> For 2FA and repository/PyPI access, we'll start making changes soon. Note
>> that GitHub has recently made changes to its 2FA settings that ask for
>> action from many people: on https://github.com/orgs/numpy/people you can
>> see that under "Two-factor authentication" the options increased; there is
>> now a Secure/Insecure distinction instead of only Enabled/Disabled. If you
>> want to move yourself from Insecure to Secure, you have to disable the
>> SMS/mobile recovery option in your personal settings under "Password and
>> authentication". A large majority of the 94 people with permissions are
>> currently marked as Insecure.
>>
>
> Having just visited this page I can't see any Two-factor authentication,
> or secure/insecure properties listed.
>

It may only be visible to org owners then.


> Remember that 2FA isn't just SMS, it could be an Authenticator app,
> Physical key (yubikey), etc.
>

Yes indeed. The other methods are considered secure by GitHub, just
SMS/mobile is not.

Cheers,
Ralf
___
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: Allow matrix multiplication in structured arrays

2025-06-13 Thread Marten van Kerkwijk
Hi Abel,

As long as your x,y,z are next to each other, you can transform from
your structure to an unstructured array via a view, which has very
little cost.  Though you need to be a bit careful with offsets, etc., if
there are also other elements in the structured dtype.

Example, with some extra fields:

dtype = np.dtype([("i", np.int64), ("x", np.float64), ("y", np.float64), ("z", 
np.float64), ("j", np.int64)])
atoms = np.array(
[
   (1, 0.0, 0.0, 0.0, -1),
   (2, 1.0, 0.0, 0.0, -2),
   (3, 0.0, 1.0, 0.0, -3),
   (4, 1.0, 1.0, 1.0, -4),
],
dtype=dtype,
)
dt2 = np.dtype([("i", np.int64), ("xyz", np.float64, (3,)), ("j", np.int64)])
xyz = atoms.view(dt2)["xyz"]
xyz
# array([[0., 0., 0.],
#[1., 0., 0.],
#[0., 1., 0.],
#[1., 1., 1.]])
xyz[:] = 9.
atoms
array([(1, 9., 9., 9., -1), (2, 9., 9., 9., -2), (3, 9., 9., 9., -3),
   (4, 9., 9., 9., -4)],
  dtype=[('i', ' I'm using structured arrays to store atoms data produced by LAMMPS (I'm using 
> a structured array that follows its format). I need to rotate the positions:
>
> ```
> import numpy as np
>
> transform = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype=np.float64)
> dtype = np.dtype([("x", np.float64), ("y", np.float64), ("z", np.float64)])  
> # real case with more fields, integers, bools, strings
>
> atoms = np.array(
> [
> (0.0, 0.0, 0.0),
> (1.0, 0.0, 0.0),
> (0.0, 1.0, 0.0),
> (1.0, 1.0, 1.0),
> ],
> dtype=dtype,
> )
>
> atoms[["x", "y", "z"]] = atoms[["x", "y", "z"]] @ transform.T
> ```
>
> But this produces:
>
> ```
> Traceback (most recent call last):
>   File "c:\Users\acgc99\Desktop\rotation.py", line 16, in 
> atoms[["x", "y", "z"]] = atoms[["x", "y", "z"]] @ transform.T
>  ~~~^
> numpy._core._exceptions._UFuncNoLoopError: ufunc 'matmul' did not contain a 
> loop with signature matching types (dtype([('x', ' ' None
> ```
>
> I can convert to unstructured arrays, but I guess that doing that change 
> multiple times is not efficient when working with tens of millions of atoms.
> ___
> 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: m...@astro.utoronto.ca
___
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] Allow matrix multiplication in structured arrays

2025-06-13 Thread abel . gutierrez
I'm using structured arrays to store atoms data produced by LAMMPS (I'm using a 
structured array that follows its format). I need to rotate the positions:

```
import numpy as np

transform = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype=np.float64)
dtype = np.dtype([("x", np.float64), ("y", np.float64), ("z", np.float64)])  # 
real case with more fields, integers, bools, strings

atoms = np.array(
[
(0.0, 0.0, 0.0),
(1.0, 0.0, 0.0),
(0.0, 1.0, 0.0),
(1.0, 1.0, 1.0),
],
dtype=dtype,
)

atoms[["x", "y", "z"]] = atoms[["x", "y", "z"]] @ transform.T
```

But this produces:

```
Traceback (most recent call last):
  File "c:\Users\acgc99\Desktop\rotation.py", line 16, in 
atoms[["x", "y", "z"]] = atoms[["x", "y", "z"]] @ transform.T
 ~~~^
numpy._core._exceptions._UFuncNoLoopError: ufunc 'matmul' did not contain a 
loop with signature matching types (dtype([('x', ' None
```

I can convert to unstructured arrays, but I guess that doing that change 
multiple times is not efficient when working with tens of millions of atoms.
___
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: Bumping CPU baseline to x86-64-v2

2025-06-13 Thread Ralf Gommers via NumPy-Discussion
On Fri, Jun 13, 2025 at 11:07 AM Jerome Kieffer 
wrote:

> Hi Matti,
>
> Sorry for the delay ...
>
> In one of my project I am working on, we use based Avoton server
> (Intel C2350) for CI/CD which can be rented today (2025) for less than
> 5€/month
> at online.net (a french provider). Switching to more recent generation
> of processor (E3 1245v5) would imply at least 30€/month budget which is
> much more expensive.
>

That CPU was released in Q3 2013 and does support the new x86-64-v2
baseline we are proposing (as you already said above). So there is no
problem here, is there?

Cheers,
Ralf
___
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: Bumping CPU baseline to x86-64-v2

2025-06-13 Thread Jerome Kieffer
Hi Matti,

Sorry for the delay ...

In one of my project I am working on, we use based Avoton server
(Intel C2350) for CI/CD which can be rented today (2025) for less than 5€/month
at online.net (a french provider). Switching to more recent generation
of processor (E3 1245v5) would imply at least 30€/month budget which is
much more expensive.

Concerning the energy cost, I believe Online has well optimized their
cost and if they still offer this kind of server at such low price, it
probably means this processor is still doing its job (which I can
confirm) and that the manufacturing cost has already been paid of.

It is like the switch to electric cars: it is not because all car owners
would (miraculously) switch to electric cars that the climate issue
would be (miraculously) addressed.

Cheers,
-- 
Jérôme Kieffer


On Sun, 18 May 2025 13:00:37 +0300
matti picus via NumPy-Discussion  wrote:

> Interesting. Could you give some more information that might convince NumPy
> to continue supporting these old machines? Renting implies you do not own
> them and are paying for the service. Are the energy/speed tradeoffs worth
> continuing with them, rather than asking the hosting service for a more
> modern machine? Do they use Numpy2.x in the CI/CD pipeline?

___
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 security roadmap proposal

2025-06-13 Thread matti picus via NumPy-Discussion
On Fri, Jun 13, 2025 at 9:40 AM Ralf Gommers via NumPy-Discussion
 wrote:
>
> ...
> For 2FA and repository/PyPI access, we'll start making changes soon. Note 
> that GitHub has recently made changes to its 2FA settings that ask for action 
> from many people: on https://github.com/orgs/numpy/people you can see that 
> under "Two-factor authentication" the options increased; there is now a 
> Secure/Insecure distinction instead of only Enabled/Disabled. If you want to 
> move yourself from Insecure to Secure, you have to disable the SMS/mobile 
> recovery option in your personal settings under "Password and 
> authentication". A large majority of the 94 people with permissions are 
> currently marked as Insecure.
>
> Cheers,
> Ralf
>

You may need member acess to see the "Two-factor authentication"
dropdown selector, but in any case it seems disabling the SMS/mobile
recovery option is now recommended practice. Be sure to download and
keep your recovery codes safe, as that will now be the only accepted
mode to regain access if you loose your 2fa access (i.e. loose or
change your phone number).
___
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 security roadmap proposal

2025-06-13 Thread Andrew Nelson via NumPy-Discussion
On Fri, 13 Jun 2025 at 16:43, Ralf Gommers via NumPy-Discussion <
numpy-discussion@python.org> wrote:

>
> For 2FA and repository/PyPI access, we'll start making changes soon. Note
> that GitHub has recently made changes to its 2FA settings that ask for
> action from many people: on https://github.com/orgs/numpy/people you can
> see that under "Two-factor authentication" the options increased; there is
> now a Secure/Insecure distinction instead of only Enabled/Disabled. If you
> want to move yourself from Insecure to Secure, you have to disable the
> SMS/mobile recovery option in your personal settings under "Password and
> authentication". A large majority of the 94 people with permissions are
> currently marked as Insecure.
>

Having just visited this page I can't see any Two-factor authentication, or
secure/insecure properties listed.

Remember that 2FA isn't just SMS, it could be an Authenticator app,
Physical key (yubikey), etc.
___
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