Skip to content

Commit 2c8490d

Browse files
committed
fix: isolate optional scientific dependencies
Keep Python 3.15 core installation independent of Numba and compiled optional packages while preserving stable development and feature extras.\n\nRefs #33
1 parent 4b32094 commit 2c8490d

5 files changed

Lines changed: 79 additions & 57 deletions

File tree

‎pyproject.toml‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,9 @@ dependencies = [
7777
"polars>=0.20.0",
7878
"pandas>=2.0.0",
7979
"numpy>=1.24.0,<2.6",
80-
"pyarrow>=14.0.0",
81-
82-
# Scientific computing
83-
"scipy>=1.10.0",
84-
"scikit-learn>=1.3.0",
85-
"statsmodels>=0.14.0",
8680

8781
# Performance optimization
88-
"numba>=0.57.0",
82+
"numba>=0.57.0; python_version < '3.15'",
8983

9084
# Configuration
9185
"pydantic>=2.0.0,<3; python_version < '3.15'",
@@ -107,18 +101,25 @@ ta = [
107101
# Feature store with DuckDB
108102
store = [
109103
"duckdb>=0.9.0",
104+
"pyarrow>=14.0.0",
110105
]
111106

112107
# Trading calendar support
113108
calendars = [
114109
"pandas-market-calendars>=4.0.0",
115110
]
116111

112+
# Statistical diagnostics
113+
stats = [
114+
"statsmodels>=0.14.0",
115+
]
116+
117117
# Visualization and plotting
118118
viz = [
119119
"plotly>=5.15.0",
120120
"matplotlib>=3.7.0",
121121
"seaborn>=0.12.0",
122+
"pyarrow>=14.0.0",
122123
]
123124

124125
# ML diagnostics
@@ -146,6 +147,8 @@ dev = [
146147
"lightgbm>=4.0.0",
147148
"shap>=0.44.0",
148149
"arch>=6.0.0",
150+
"pyarrow>=14.0.0",
151+
"statsmodels>=0.14.0",
149152
]
150153

151154
# Documentation generation
@@ -176,6 +179,8 @@ all = [
176179
"ipdb>=0.13.0",
177180
"pre-commit>=3.3.0",
178181
"arch>=6.0.0",
182+
"pyarrow>=14.0.0",
183+
"statsmodels>=0.14.0",
179184
"mkdocs>=1.6,<2",
180185
"mkdocs-material>=9.5.0",
181186
"mkdocstrings[python]>=0.24.0",
@@ -207,6 +212,8 @@ dev = [
207212
"pandas-market-calendars>=4.0.0",
208213
"duckdb>=0.9.0",
209214
"matplotlib>=3.7.0",
215+
"pyarrow>=14.0.0",
216+
"statsmodels>=0.14.0",
210217
]
211218

212219
[tool.pytest.ini_options]

‎src/ml4t/engineer/features/fdiff.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _adfuller(values: npt.NDArray[np.float64]) -> tuple[float, float]:
2626
except ImportError as error:
2727
raise ImportError(
2828
"ADF diagnostics require statsmodels. "
29-
"Install statsmodels>=0.14 or reinstall ml4t-engineer."
29+
"Install ml4t-engineer[stats] or statsmodels>=0.14."
3030
) from error
3131

3232
result = adfuller(values, autolag="AIC")

‎tests/test_fdiff.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def missing_statsmodels(_name: str) -> None:
3131

3232
with pytest.raises(
3333
ImportError,
34-
match=r"Install statsmodels>=0\.14 or reinstall ml4t-engineer",
34+
match=r"Install ml4t-engineer\[stats\] or statsmodels>=0\.14",
3535
):
3636
fdiff_module._adfuller(np.array([1.0]))
3737

‎tests/test_release_policy.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,14 @@ def test_package_supports_python_312_and_later() -> None:
172172
dependencies = project["project"]["dependencies"]
173173

174174
assert project["project"]["requires-python"] == ">=3.12"
175-
assert "numba>=0.57.0" in dependencies
176-
assert "pyarrow>=14.0.0" in dependencies
177-
assert "scipy>=1.10.0" in dependencies
178-
assert "scikit-learn>=1.3.0" in dependencies
179-
assert "statsmodels>=0.14.0" in dependencies
175+
assert "numba>=0.57.0; python_version < '3.15'" in dependencies
176+
assert "statsmodels>=0.14.0" in project["project"]["optional-dependencies"]["stats"]
177+
assert "pyarrow>=14.0.0" in project["project"]["optional-dependencies"]["store"]
178+
assert "pyarrow>=14.0.0" in project["project"]["optional-dependencies"]["viz"]
179+
assert not any(
180+
dependency.startswith(("pyarrow", "scipy", "scikit-learn", "statsmodels"))
181+
for dependency in dependencies
182+
)
180183
assert {
181184
"pydantic>=2.0.0,<3; python_version < '3.15'",
182185
"pydantic==2.14.0b1; python_version >= '3.15'",

0 commit comments

Comments
 (0)