Skip to content

Commit

Permalink
Update Python requirements (#4924)
Browse files Browse the repository at this point in the history
Description of changes:
- replace `np.product()` (deprecated in NumPy 1.15 and removed in NumPy 2.0) by `np.prod()`
- bump Python version requirement of `requests` due to CVE-2024-35195
- adjust Python version requirements to resolve all dependency issues
   - `python3 -m pip install -r requirements.txt` now works again
  • Loading branch information
kodiakhq[bot] authored and jngrad committed May 22, 2024
1 parent 792f6b8 commit 59b6064
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# build system
cython>=0.29.14,<3.0
cython>=0.29.14,<3.0.10
# required scientific packages
numpy>=1.17.4
numpy>=1.17.4,<2.0
h5py>=2.7.1
# optional scientific packages
scipy>=1.4.0
Expand All @@ -13,8 +13,8 @@ vtk>=7.1.1
PyOpenGL>=3.1.0
pygame>=1.9.6
# CI-related
requests>=2.18.4 # to post on GitHub as espresso-ci
lxml>=4.2.1 # to deploy tutorials
requests>=2.32.0
lxml>=4.2.1
# sphinx and its dependencies
sphinx>=2.3.0,!=3.0.0
sphinx-toggleprompt==0.0.5
Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/cutoffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test(self):
fene = FeneBond(r_0=1, d_r_max=2, k=1)
system.bonded_inter.add(fene)
self.assertEqual(system.cell_system.max_cut_bonded, 3)
n_nodes = np.product(system.cell_system.node_grid)
n_nodes = np.prod(system.cell_system.node_grid)
if n_nodes == 1:
# Bonds don't influence interaction range
self.assertEqual(system.cell_system.interaction_range, -1)
Expand Down
4 changes: 2 additions & 2 deletions testsuite/python/lb_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def test_mass_momentum_thermostat(self):
fluid_temp += np.sum(np.copy(lb_node.velocity)**2) * dens

# Normalize
fluid_mass /= np.product(self.lbf.shape)
fluid_mass /= np.prod(self.lbf.shape)
fluid_temp *= self.system.volume() / (
3. * np.product(self.lbf.shape)**2)
3. * np.prod(self.lbf.shape)**2)

# check mass conversation
self.assertAlmostEqual(fluid_mass, self.params["dens"],
Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def test_vs_relative(self):
self.assertEqual(res[0], 0, f"vs_relative: {res}")
self.assertEqual(res[1], 5.0, f"vs_relative: {res}")
np.testing.assert_allclose(
res[2], np.array((0.5, -0.5, -0.5, -0.5)),
np.copy(res[2]), np.array([0.5, -0.5, -0.5, -0.5]),
err_msg=f"vs_relative: {res}", atol=self.tol)
# check exceptions
with self.assertRaisesRegex(ValueError, "needs input in the form"):
Expand Down

0 comments on commit 59b6064

Please sign in to comment.