From cc3573b8a6b19ef32c9a06595f187615f25012de Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel) YANG" Date: Sun, 6 Oct 2024 20:31:55 +0800 Subject: [PATCH] Support NumPy 2 (#949) * build with numpy2 * release np <2 pin for runtime dep * TEST: force numpy 2 for test purpose * pytest only show 20 durations instead of ALL * test NumPy 1 * test finished, remove np<2 pin * fix: DeprecationWarning: pkg_resources is deprecated as an API * remove numpy from build dependency --- .github/workflows/test.yml | 2 +- matminer/__init__.py | 6 +++--- pyproject.toml | 2 -- setup.py | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8a370aa0e..d960bd4bc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,7 +73,7 @@ jobs: - name: Run tests run: | - python${{ matrix.python-version }} -m pytest --cov=matminer matminer --durations=0 --timeout=360 + python${{ matrix.python-version }} -m pytest --cov=matminer matminer --durations=20 --timeout=360 - name: Build package if: matrix.python-version == 3.9 diff --git a/matminer/__init__.py b/matminer/__init__.py index 130045a66..61e7a1e54 100644 --- a/matminer/__init__.py +++ b/matminer/__init__.py @@ -1,9 +1,9 @@ """data mining materials properties""" -from pkg_resources import DistributionNotFound, get_distribution +from importlib.metadata import PackageNotFoundError, version try: - __version__ = get_distribution("matminer").version -except DistributionNotFound: # pragma: no cover + __version__ = version("matminer") +except PackageNotFoundError: # pragma: no cover # package is not installed pass diff --git a/pyproject.toml b/pyproject.toml index 77d85ff41..adbe3e6bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,5 @@ [build-system] requires = [ - # pin NumPy version used in the build - "numpy>=1.20.1, <2", "setuptools>=43.0.0", ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index c0e79f2de..7cc859eb6 100644 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ def local_version(version): include_package_data=True, zip_safe=False, install_requires=[ - "numpy >= 1.23, < 2", + "numpy >= 1.23", "requests ~= 2.31", "pandas >= 1.5, < 3", "tqdm ~= 4.66",