Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumPy2 support fix #374

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

Conversation

alexmgoldberg
Copy link

@alexmgoldberg alexmgoldberg commented Jan 18, 2024

Issue Number. Is this pull request related to any outstanding issues? If so, list the issue number.
Fixes #372

Describe the changes made. A clear and concise description of what the problem is and what you did to fix it. E.g. [...] was happening and I've changed [...] to fix it.
Ran ruff to support numpy2
There are no instances of NPY201 errors found 7 instances of NPY201 errors found, easily fixed.
There are unrelated unfixed errors below:

ruff check .
src/westpa/__init__.py:16:1: E402 Module level import not at top of file
src/westpa/cli/tools/w_assign.py:477:23: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `numpy.bytes_` instead.
src/westpa/cli/tools/w_assign.py:484:33: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `numpy.bytes_` instead.
src/westpa/cli/tools/w_assign.py:487:52: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `numpy.bytes_` instead.
src/westpa/cli/tools/w_assign.py:561:39: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `numpy.bytes_` instead.
src/westpa/cli/tools/w_eddist.py:493:20: F841 Local variable `n_iter` is assigned to but never used
src/westpa/cli/tools/w_ipa.py:163:29: E741 Ambiguous variable name: `l`
src/westpa/cli/tools/w_multi_west.py:6:1: E402 Module level import not at top of file
src/westpa/cli/tools/w_multi_west.py:7:1: E402 Module level import not at top of file
src/westpa/cli/tools/w_multi_west.py:8:1: E402 Module level import not at top of file
src/westpa/cli/tools/w_multi_west.py:9:1: E402 Module level import not at top of file
src/westpa/cli/tools/w_multi_west.py:10:1: E402 Module level import not at top of file
src/westpa/cli/tools/w_multi_west.py:13:1: E402 Module level import not at top of file
src/westpa/cli/tools/w_pdist.py:496:20: F841 Local variable `n_iter` is assigned to but never used
src/westpa/cli/tools/w_red.py:226:20: F841 Local variable `cilb` is assigned to but never used
src/westpa/cli/tools/w_red.py:226:26: F841 Local variable `ciub` is assigned to but never used
src/westpa/core/_rc.py:46:16: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks
src/westpa/core/binning/mab.py:70:9: F841 Local variable `eigval` is assigned to but never used
src/westpa/core/h5io.py:345:47: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `numpy.bytes_` instead.
src/westpa/core/h5io.py:348:50: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `numpy.bytes_` instead.
src/westpa/core/propagators/executable.py:625:13: F841 Local variable `rusage` is assigned to but never used
src/westpa/core/propagators/executable.py:634:13: F841 Local variable `rusage` is assigned to but never used
src/westpa/core/propagators/executable.py:654:21: F841 Local variable `rusage` is assigned to but never used
src/westpa/core/propagators/executable.py:665:21: F841 Local variable `rusage` is assigned to but never used
src/westpa/core/sim_manager.py:347:17: F841 Local variable `rbstate` is assigned to but never used
src/westpa/core/we_driver.py:550:26: F841 Local variable `parent` is assigned to but never used
src/westpa/core/we_driver.py:591:37: F841 Local variable `parent` is assigned to but never used
src/westpa/core/we_driver.py:614:26: F841 Local variable `parent` is assigned to but never used
src/westpa/core/we_driver.py:679:35: F841 Local variable `parent` is assigned to but never used
src/westpa/oldtools/aframe/trajwalker.py:5:1: E402 Module level import not at top of file
src/westpa/westext/hamsm_restarting/example_overrides.py:10:1: E402 Module level import not at top of file
src/westpa/westext/stringmethod/string_method.py:179:33: NPY201 [*] `np.mat` will be removed in NumPy 2.0. Use `numpy.asmatrix` instead.
src/westpa/westext/stringmethod/string_method.py:244:17: E731 Do not assign a `lambda` expression, use a `def`
src/westpa/work_managers/zeromq/node.py:12:1: E402 Module level import not at top of file
src/westpa/work_managers/zeromq/node.py:14:1: E402 Module level import not at top of file
src/westpa/work_managers/zeromq/node.py:15:1: E402 Module level import not at top of file
src/westpa/work_managers/zeromq/work_manager.py:397:13: F841 Local variable `task_id` is assigned to but never used
tests/test_binning.py:54:9: E731 Do not assign a `lambda` expression, use a `def`
tests/test_binning.py:55:9: E731 Do not assign a `lambda` expression, use a `def`
tests/test_functional/test_mclib.py:43:40: F841 Local variable `k_` is assigned to but never used
tests/test_tools/test_w_states.py:18:14: F841 Local variable `err` is assigned to but never used
Found 41 errors.
[*] 7 fixable with the `--fix` option (19 hidden fixes can be enabled with the `--unsafe-fixes` option).

All tests passed when numpy commit 539dafa was installed

Goals and Outstanding Issues. A clear and concise list of goals (to be) accomplished.

  • Make sure numpy2 is supported
  • Fixed additional ruff lint errors

Major files changed.

  • see below

Status.

  • Bug fix (non-breaking change which fixes an issue)
  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • All new and existing tests passed.

Additional context. Add any other context or screenshots about the pull request here.

@alexmgoldberg alexmgoldberg added the dependencies For PRs that update a dependency file label Jan 18, 2024
Copy link

codecov bot commented Jan 18, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (1fd4f8a) 41.92% compared to head (80aae91) 41.92%.

Files Patch % Lines
src/westpa/core/data_manager.py 0.00% 2 Missing ⚠️
src/westpa/core/h5io.py 50.00% 1 Missing ⚠️
src/westpa/westext/stringmethod/string_method.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #374   +/-   ##
========================================
  Coverage    41.92%   41.92%           
========================================
  Files          131      131           
  Lines        17009    17009           
========================================
  Hits          7131     7131           
  Misses        9878     9878           
Flag Coverage Δ
unittests 41.92% <60.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jeremyleung521 jeremyleung521 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after those new commits. However, we might actually hold this until the numpy 2.0 release candidate is released (Feb 1st, 2024 Week 2 or 3 of Feb ???) as more breaking changes might arise (as per this thread).

@jeremyleung521 jeremyleung521 added this to the 2022.08 milestone Mar 25, 2024
@jeremyleung521 jeremyleung521 mentioned this pull request Mar 25, 2024
8 tasks
@jeremyleung521 jeremyleung521 modified the milestones: 2022.09, 2022.10 May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies For PRs that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants