Skip to content

fix: support numpy 2.0 by removing deprecated APIs#3

Open
yasumorishima wants to merge 2 commits intonasa:mainfrom
yasumorishima:fix/numpy2-compat
Open

fix: support numpy 2.0 by removing deprecated APIs#3
yasumorishima wants to merge 2 commits intonasa:mainfrom
yasumorishima:fix/numpy2-compat

Conversation

@yasumorishima
Copy link

Summary

  • Replace numpy.distutils.exec_command with subprocess.run (removed in numpy 2.0)
  • Replace np.NaN with np.nan (removed in numpy 2.0)
  • Update comment referencing deprecated np.float alias
  • Eliminate shell=True in subprocess call for security (use argument list + cwd instead)

Relates to nasa/Kamodo#154

Changes

File Change
kamodo/util.py numpy.distutils.exec_commandsubprocess.run with argument list, cwd=folder, no shell=True
kamodo/kamodo.py np.NaNnp.nan
kamodo/rpc/proto.py Comment: np.floatnumpy float

Context

numpy.distutils was removed in NumPy 2.0 (migration guide). The exec_command function has been replaced with subprocess.run using an argument list (no shell=True) and shlex.quote for safe argument handling.

A companion PR for kamodo_ccmc (nasa/Kamodo#156) has also been submitted.

- Replace numpy.distutils.exec_command with subprocess.run (removed in numpy 2.0)
- Replace np.NaN with np.nan (removed in numpy 2.0)
- Update comment referencing deprecated np.float alias

Relates to nasa/Kamodo#154
Address CodeRabbit review: use argument list instead of shell string
to prevent command injection. Use cwd parameter instead of cd command.
Add shlex for safe argument splitting.
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