Skip to content

Commit

Permalink
deps: support numpy 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jun 20, 2024
1 parent 16746b6 commit 7008631
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pip>=9.0.1
numpy>1.16,<2.0
numpy>1.16,<2.1
sympy>=1.9,<1.13
psutil>=5.1.0,<7.0
py-cpuinfo<10
Expand Down
18 changes: 18 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
import versioneer

import os
import pkg_resources
from setuptools import setup, find_packages


def numpy_compat(required):
new_reqs = [r for r in required if "numpy" not in r and "sympy" not in r]
try:
sympy_version = pkg_resources.get_distribution("sympy").version
min_ver2 = pkg_resources.parse_version("1.12.1")
if pkg_resources.parse_version(sympy_version) < min_ver2:
new_reqs.append("numpy>1.16,<2.0")
else:
new_reqs.append("numpy>=2.0")
except pkg_resources.DistributionNotFound:
new_reqs.extend(["sympy>=1.12.1", "numpy>=2.0"])

return new_reqs


with open('requirements.txt') as f:
required = f.read().splitlines()
required = numpy_compat(required)

with open('requirements-optional.txt') as f:
optionals = f.read().splitlines()
Expand Down

0 comments on commit 7008631

Please sign in to comment.