Skip to content

Updates for numpy 2#206

Merged
javierggt merged 3 commits intomasterfrom
numpy-2
Dec 9, 2025
Merged

Updates for numpy 2#206
javierggt merged 3 commits intomasterfrom
numpy-2

Conversation

@javierggt
Copy link
Contributor

@javierggt javierggt commented Dec 3, 2025

Description

This addresses issues encountered after upgrading numpy to version 2:

  • The repr method for some types changed, change format used to pass arguments to mp_get_agasc in test_agasc_2
  • np.in1d is deprecated

A quick comment: numpy 2 is correct, because the ideal repr() implementation should return a string that, when passed to eval(), would reconstruct an object equal to the original.

In python 3.12 and numpy 1.26.4:

In [1]: import numpy as np
   ...: a = np.int32(1)
   ...: repr(a)
   ...: 
Out[1]: '1'

in python 3.13 and numpy 2.3.5

In [1]: import numpy as np
   ...: a = np.int32(1)
   ...: repr(a)
   ...: 
Out[1]: 'np.int32(1)'

This causes issues in agasc tests, because some values are passed to a command line using a format like

mp_get_agascid {!r}".format(agasc_id)

this causes the format to be applied on repr(agasc_id) which now will be 'np.int32(1)'

Interface impacts

Testing

Unit tests

  • Linux
(ska3-flight) jgonzale agasc $ git rev-parse HEAD
ecb66c99af703a0f521df34629308af3b88d5b30
(ska3-flight) jgonzale agasc $ pytest agasc
==================================================================== test session starts =====================================================================
platform linux -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0
rootdir: /proj/sot/ska/jgonzalez/git
configfile: pytest.ini
plugins: anyio-4.7.0, timeout-2.3.1
collected 79 items                                                                                                                                           

agasc/tests/test_agasc_1.py .......                                                                                                                    [  8%]
agasc/tests/test_agasc_2.py ...............................................                                                                            [ 68%]
agasc/tests/test_agasc_healpix.py ...........                                                                                                          [ 82%]
agasc/tests/test_obs_status.py ..............                                                                                                          [100%]

=============================================================== 79 passed in 148.81s (0:02:28) ===============================================================
(ska3-flight) jgonzale agasc $ conda activate ska3-flight-2026.0rc4
(ska3-flight-2026.0rc4) jgonzale agasc $ pytest agasc
==================================================================== test session starts =====================================================================
platform linux -- Python 3.13.10, pytest-9.0.1, pluggy-1.6.0
rootdir: /proj/sot/ska/jgonzalez/git
configfile: pytest.ini
plugins: timeout-2.4.0, anyio-4.12.0
collected 79 items                                                                                                                                           

agasc/tests/test_agasc_1.py .......                                                                                                                    [  8%]
agasc/tests/test_agasc_2.py ...............................................                                                                            [ 68%]
agasc/tests/test_agasc_healpix.py ...........                                                                                                          [ 82%]
agasc/tests/test_obs_status.py ..............                                                                                                          [100%]

=============================================================== 79 passed in 110.20s (0:01:50) ===============================================================

Independent check of unit tests by Jean

  • Linux ska3/flight pre-hope
ska3-jeanconn-kady> git rev-parse HEAD
ecb66c99af703a0f521df34629308af3b88d5b30
ska3-jeanconn-kady> pytest
============================================================ test session starts ============================================================
platform linux -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0
rootdir: /proj/sot/ska/jeanproj/git
configfile: pytest.ini
plugins: anyio-4.7.0, timeout-2.3.1
collected 79 items                                                                                                                          

agasc/tests/test_agasc_1.py .......                                                                                                   [  8%]
agasc/tests/test_agasc_2.py ...............................................                                                           [ 68%]
agasc/tests/test_agasc_healpix.py ...........                                                                                         [ 82%]
agasc/tests/test_obs_status.py ..............                                                                                         [100%]

====================================================== 79 passed in 179.50s (0:02:59)

Functional tests

No functional testing.

@javierggt javierggt changed the title change format used to pass arguments to mp_get_agasc in test_agasc_2 Updates for numpy 2 Dec 3, 2025
@javierggt javierggt merged commit 5dd1b1c into master Dec 9, 2025
2 checks passed
@javierggt javierggt deleted the numpy-2 branch December 9, 2025 19:34
This was referenced Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants