Skip to content

Support Python 3.14 and upgrade NumPy to 2.x#519

Open
ziotom78 wants to merge 9 commits intomasterfrom
numpy2_py314
Open

Support Python 3.14 and upgrade NumPy to 2.x#519
ziotom78 wants to merge 9 commits intomasterfrom
numpy2_py314

Conversation

@ziotom78
Copy link
Copy Markdown
Member

With the release of PySM3 3.4.4, we can finally add support for Python 3.14 and update a few dependencies; most notably, we can now drop support for NumPy 1.x and move to NumPy 2.x.

The transition was not seamless, though. It seems that np.testing.assert_allclose() causes weird memory corruption errors when used with Py 3.14 + NumPy 2.2, so I had to change it to assert np.allclose() (which does not seem to suffer from the same problem).

Because of an updated dependency on AstroPy, a few tests that relied on HealPy to convert Equatorial coordinates into Galactic coordinates started failing, probably because of an update in the transformation matrices used by AstroPy. In a few cases I modified tests to stop using HealPy to do the conversion, but for test_scan_map.py I realized that the very long test on the binner could be significantly simplified, as in the first part it just re-implemented the map-making equation to compare it with the result of the binner. As a consequence, this test now runs in ~50% of the time.

The test in test_scan_map.py, `test_scan_map_no_interpolation`, was
simplified a lot: the first part re-implemented the code of the binner
but was no longer working because of updates in AstroPy pointing
precision.
For some weird reason, it fails to run with Python 3.14.3 and NumPy
2.2.6
@ziotom78
Copy link
Copy Markdown
Member Author

I forgot to say that, unlike NumPy and AstroPy, we are not dropping support for Python 3.10, which is the reason why I did not upgrade NumPy and AstroPy to the latest version.

The End of Life for Python 3.10 is scheduled for October 2026, so we have still some time before dropping support for it.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 14, 2026

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  litebird_sim
  bandpasses.py 235-238, 347
  grasp2alm.py 193-196
  hwp_diff_emiss.py 22-23
  pointings_in_obs.py 170
Project Total  

This report was generated by python-coverage-comment-action

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.

1 participant