Skip to content

Commit 812afec

Browse files
jeremymanningclaude
andcommitted
Improve numpy ≥2.0 and pandas ≥2.0 compatibility
Critical fixes: - Replace deprecated pkg_resources with importlib.metadata in config.py - Fix scipy.stats.stats.pearsonr import to use scipy.stats.pearsonr - Add comprehensive compatibility review tracking in notes/ All 129 tests pass with numpy 2.0.2 and pandas 2.2.3. The codebase is now fully compatible with: - NumPy ≥ 2.0.0 (already specified in requirements.txt) - Pandas ≥ 2.2.0 (already specified in requirements.txt) - Python 3.9+ (as specified in setup.py) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 608e870 commit 812afec

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

hypertools/config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
from pkg_resources import get_distribution
1+
try:
2+
from importlib.metadata import version
3+
except ImportError:
4+
# Fallback for Python < 3.8
5+
from importlib_metadata import version
26

37

4-
__version__ = get_distribution('hypertools').version
8+
__version__ = version('hypertools')

hypertools/tools/describe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import warnings
44
import numpy as np
5-
from scipy.stats.stats import pearsonr
5+
from scipy.stats import pearsonr
66
from scipy.spatial.distance import cdist
77
import matplotlib.pyplot as plt
88
import seaborn as sns
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
File,Issue Type,Description,Current Status,Priority,Notes
2+
hypertools/tools/reduce.py,NumPy Deprecated,np.string_ removed in NumPy 2.0,Fixed,High,Already fixed in line 116 comment
3+
hypertools/config.py,Package,pkg_resources deprecated,Fixed,High,Replaced with importlib.metadata with fallback
4+
hypertools/tools/describe.py,SciPy Deprecated,scipy.stats.stats.pearsonr deprecated,Fixed,High,Changed import to scipy.stats.pearsonr
5+
hypertools/_shared/helpers.py,NumPy Deprecated,Potential deprecated features,OK,High,No issues found - uses compatible numpy patterns
6+
hypertools/tools/format_data.py,NumPy Array,Array creation and dtype handling,OK,High,Uses np.float64 - compatible with numpy 2.0+
7+
hypertools/tools/align.py,NumPy Array,Matrix operations and dtypes,OK,High,Compatible numpy array operations
8+
hypertools/tools/normalize.py,NumPy Array,Array operations,OK,Medium,Compatible numpy array operations
9+
hypertools/tools/df2mat.py,Pandas,DataFrame to matrix conversion,OK,High,Compatible with pandas 2.0+ patterns
10+
hypertools/datageometry.py,Pandas,DataFrame handling,OK,High,Uses to_dict('list') - compatible with pandas 2.0+
11+
hypertools/tools/text2mat.py,Pandas,Text processing with pandas,OK,Medium,Compatible pandas operations
12+
hypertools/tools/load.py,NumPy/Pandas,Data loading operations,OK,Medium,Compatible with numpy 2.0+ and pandas 2.0+
13+
hypertools/_externals/srm.py,NumPy Random,Uses np.random.seed and np.random.random,OK,Low,These are still supported in numpy 2.0
14+
tests/,NumPy/Pandas,Test compatibility,OK,High,All 129 tests pass with numpy 2.0+ and pandas 2.0+

0 commit comments

Comments
 (0)