Skip to content

Commit a8944b3

Browse files
committed
fix: Drop nptyping so numpy can move to 2.x
- nptyping capped numpy<2, pinning numpy 1.26.4 which has no Python 3.13 wheels, so Windows 3.13 CI built an experimental MinGW numpy that crashed with an access violation - Replace nptyping annotations with numpy.typing.NDArray - Require numpy>=2.1 (ships cp313 wheels) and relock - Removes the np.bool8 deprecation warnings too
1 parent d069bd1 commit a8944b3

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ classifiers = [
2626
"Typing :: Typed",
2727
]
2828
dependencies = [
29-
"nptyping>=2.5.0",
29+
"numpy>=2.1.0",
3030
"pandas>=2.3.3",
3131
"scikit-learn>=1.6.0",
3232
"cloudpickle>=2.0.0",

src/sportsbet/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212

1313
import numpy as np
1414
import pandas as pd
15-
from nptyping import Bool, Float, Int, NDArray, Shape
15+
from numpy.typing import NDArray
1616

1717
Param = dict[str, Any]
1818
ParamGrid = dict[str, list[Any]] | list[dict[str, list[Any]]]
1919
TrainData = tuple[pd.DataFrame, pd.DataFrame | None, pd.DataFrame]
2020
FixturesData = tuple[pd.DataFrame, None, pd.DataFrame]
21-
Data = NDArray[Shape['*, *'], Float]
22-
BoolData = NDArray[Shape['*, *'], Bool]
23-
Indices = NDArray[Shape['*, *'], Int]
21+
Data = NDArray[np.float64]
22+
BoolData = NDArray[np.bool_]
23+
Indices = NDArray[np.intp]
2424
Schema = list[tuple[str, type[int] | type[float] | type[object] | type[np.datetime64]]]
2525
OutputsMapping = dict[str, dict[str, Callable[..., pd.DataFrame]]]

src/sportsbet/evaluation/_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import cloudpickle
1313
import numpy as np
1414
import pandas as pd
15-
from nptyping import NDArray, Shape, String
15+
from numpy.typing import NDArray
1616
from sklearn.base import BaseEstimator, ClassifierMixin, MultiOutputMixin
1717
from sklearn.exceptions import NotFittedError
1818
from sklearn.utils import check_consistent_length, check_scalar
@@ -90,7 +90,7 @@ def __init__(
9090
self.init_cash = init_cash
9191
self.stake = stake
9292

93-
def _get_feature_names_odds(self: Self, O: pd.DataFrame) -> NDArray[Shape['*'], String]: # noqa: F722
93+
def _get_feature_names_odds(self: Self, O: pd.DataFrame) -> NDArray[np.str_]:
9494
# One odds column per selected market base, at the latest snapshot, ordered to match
9595
# `betting_markets_` so positional alignment with `Y` holds.
9696
columns = list(O.columns)

src/sportsbet/evaluation/_model_selection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import numpy as np
1313
import pandas as pd
1414
from joblib import Parallel, delayed
15-
from nptyping import Float, NDArray, Shape
15+
from numpy.typing import NDArray
1616
from sklearn import get_config, set_config
1717
from sklearn.exceptions import NotFittedError
1818
from sklearn.model_selection import GridSearchCV, TimeSeriesSplit
@@ -399,7 +399,7 @@ def _scorer(
399399
estimator: BaseBettor,
400400
X: pd.DataFrame,
401401
Y: pd.DataFrame,
402-
sample_weight: NDArray[Shape['*'], Float] | None = None, # noqa: F722
402+
sample_weight: NDArray[np.float64] | None = None,
403403
**kwargs: dict[str, Any],
404404
) -> float:
405405
Y = Y[estimator.feature_names_out_]

0 commit comments

Comments
 (0)