Skip to content

Commit e1b068d

Browse files
committed
ENH: Add support for NumPy 3
Add build support for NumPy 2
1 parent 256887c commit e1b068d

11 files changed

+32
-41
lines changed

arch/tests/bootstrap/test_bootstrap.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ def test_jackknife(bs_setup):
538538

539539
x = bs_setup.x_df
540540
results_df = _loo_jackknife(bs_setup.func, len(x), (x,), {})
541-
assert_equal(results, results_df)
541+
assert_allclose(results, results_df)
542542

543543
y = bs_setup.y
544544
results = _loo_jackknife(bs_setup.func, len(y), (y,), {})

arch/tests/univariate/test_arch_in_mean.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
SP500 = 100 * sp500.load()["Adj Close"].pct_change().dropna()
1919
SP500 = SP500.iloc[SP500.shape[0] // 2 :]
20-
X = pd.concat([SP500, SP500], axis=1, copy=True)
20+
X = pd.concat([SP500, SP500], axis=1)
2121
X.columns = pd.Index([0, 1])
2222
RANDOMSTATE = np.random.RandomState(12349876)
2323
X.loc[:, :] = RANDOMSTATE.standard_normal(X.shape)

arch/typing.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
AnyArray = np.ndarray[Any, Any] # pragma: no cover
4646
Uint32Array = np.ndarray[Any, np.dtype[np.uint32]] # pragma: no cover
4747
else:
48-
Uint32Array = (
49-
IntArray
50-
) = Float64Array = Int64Array = Int32Array = BoolArray = AnyArray = NDArray
48+
Uint32Array = IntArray = Float64Array = Int64Array = Int32Array = BoolArray = (
49+
AnyArray
50+
) = NDArray
5151

5252
BootstrapIndexT = Union[
5353
Int64Array, tuple[Int64Array, ...], tuple[list[Int64Array], dict[str, Int64Array]]

arch/unitroot/critical_values/simulation/phillips-ouliaris-simulation-process.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
META = {"z_a": "negative", "z_t": "negative", "p_u": "positive", "p_z": "positive"}
2121
CRITICAL_VALUES = (1, 5, 10)
2222
PLOT = False
23-
WINS: dict[int, int] = defaultdict(lambda: 0)
23+
WINS: dict[int, int] = defaultdict(int)
2424
# 1. Load data
2525
# 2. Compute critical values
2626

arch/unitroot/unitroot.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1144,9 +1144,7 @@ def _compute_statistic(self) -> None:
11441144
self._stat_tau = sqrt(gamma0 / lam2) * ((rho - 1) / sigma) - 0.5 * (
11451145
(lam2 - gamma0) / lam
11461146
) * (n * sigma / s)
1147-
self._stat_rho = n * (rho - 1) - 0.5 * (n**2.0 * sigma2 / s2) * (
1148-
lam2 - gamma0
1149-
)
1147+
self._stat_rho = n * (rho - 1) - 0.5 * (n**2.0 * sigma2 / s2) * (lam2 - gamma0)
11501148

11511149
self._nobs = int(resols.nobs)
11521150
if self._test_type == "rho":

arch/utility/array.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,15 @@ def ensure1d(
3838
x: int | float | Sequence[int | float] | ArrayLike,
3939
name: Hashable | None,
4040
series: Literal[True] = ...,
41-
) -> Series:
42-
... # pragma: no cover
41+
) -> Series: ... # pragma: no cover
4342

4443

4544
@overload
4645
def ensure1d(
4746
x: int | float | Sequence[int | float] | ArrayLike,
4847
name: Hashable | None,
4948
series: Literal[False],
50-
) -> np.ndarray:
51-
... # pragma: no cover
49+
) -> np.ndarray: ... # pragma: no cover
5250

5351

5452
def ensure1d(

arch/utility/timeseries.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ def add_trend(
4848
prepend: bool = ...,
4949
nobs: int = ...,
5050
has_constant: Literal["raise", "add", "skip"] = ...,
51-
) -> Float64Array:
52-
... # pragma: no cover
51+
) -> Float64Array: ... # pragma: no cover
5352

5453

5554
@overload
@@ -59,8 +58,7 @@ def add_trend(
5958
prepend: bool = ...,
6059
nobs: None = ...,
6160
has_constant: Literal["raise", "add", "skip"] = ...,
62-
) -> Float64Array:
63-
... # pragma: no cover
61+
) -> Float64Array: ... # pragma: no cover
6462

6563

6664
@overload
@@ -70,8 +68,7 @@ def add_trend(
7068
prepend: bool = ...,
7169
nobs: None = ...,
7270
has_constant: Literal["raise", "add", "skip"] = ...,
73-
) -> pd.DataFrame:
74-
... # pragma: no cover
71+
) -> pd.DataFrame: ... # pragma: no cover
7572

7673

7774
def add_trend(

ci/azure/azure_template_posix.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ jobs:
4545
python39_numpy120:
4646
python.version: '3.9'
4747
MATPLOTLIB: 3.3.0
48-
NUMPY: 1.20.0
49-
SCIPY: 1.7.0
50-
PANDAS: 1.2.0
48+
NUMPY: 1.22.3
49+
SCIPY: 1.8.0
50+
PANDAS: 1.4.0
5151
python_310_no_binary:
5252
python.version: '3.10'
5353
ARCH_NO_BINARY: true
5454
PYTEST_OPTS: '--skip-slow'
55-
PANDAS: 1.4.0
55+
PANDAS: 1.5.0
5656
USE_NUMBA: true
5757
python_39_no_binary_environment:
5858
python.version: '3.9'
@@ -62,22 +62,22 @@ jobs:
6262
PYTEST_OPTS: '--skip-slow'
6363
python_39_no_numba:
6464
python.version: '3.9'
65-
NUMPY: 1.21.0
65+
NUMPY: 1.24.0
6666
USE_NUMBA: false
67-
MATPLOTLIB: 3.3.0
67+
MATPLOTLIB: 3.5.0
6868
PANDAS: 1.5.0
6969
PYTEST_PATTERN: "(slow or not slow)"
7070
python_39_numpy_118:
7171
python.version: '3.9'
72-
NUMPY: 1.22.0
72+
NUMPY: 1.24.0
7373
USE_NUMBA: false
7474
PYTEST_PATTERN: "(slow or not slow)"
7575
python_minimums:
7676
python.version: '3.9'
77-
NUMPY: 1.19.0
78-
SCIPY: 1.5.0
79-
MATPLOTLIB: 3.3.0
80-
PANDAS: 1.1.0
77+
NUMPY: 1.23.0
78+
SCIPY: 1.9.0
79+
MATPLOTLIB: 3.4.0
80+
PANDAS: 1.4.0
8181
python312_pre:
8282
python.version: '3.12'
8383
pip.pre: true

pyproject.toml

+3-4
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,16 @@ requires = [
5555
"setuptools>=61",
5656
"wheel",
5757
"setuptools_scm[toml]>=8.0.3,<9",
58-
"oldest-supported-numpy>=2022.11.19",
59-
"cython>=0.29.34", # Works with 3.0.0b2
60-
58+
"cython>=3.0.10",
59+
"numpy>=2.0.0rc1,<3"
6160
]
6261
build-backend = "setuptools.build_meta"
6362

6463
[tool.setuptools.dynamic]
6564
dependencies = { file = ["requirements.txt"] }
6665

6766
[tool.black]
68-
target-version = ['py39', 'py310', 'py311']
67+
target-version = ['py39', 'py310', 'py311', 'py312']
6968
exclude = '''
7069
(
7170
\.egg

requirements-dev.txt

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
# versioning
22
setuptools_scm[toml]>=8.0.3,<9
33
packaging
4-
oldest-supported-numpy>=2022.11.19
54

65
# Performance
7-
cython>=0.29.34 # Works with 3.0.0b2
6+
cython>=3.0.10
87
numba>=0.49,!=0.50.*;python_version<"3.12"
98

109
# Graphics
1110
matplotlib>=3
1211
seaborn
1312

1413
# Tests
15-
pytest>=7.3
14+
pytest>=7.3,<8
1615
pytest-xdist
1716
pytest-cov
1817

1918
# formatting
20-
black[jupyter]==23.12.1
19+
black[jupyter]~=24.4.0
2120
isort~=5.0
2221
colorama
2322
flake8

requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
numpy>=1.19
2-
scipy>=1.5
3-
pandas>=1.1
1+
numpy>=1.22.3
2+
scipy>=1.8
3+
pandas>=1.4
44
statsmodels>=0.12

0 commit comments

Comments
 (0)