Skip to content

Commit 1e6c66b

Browse files
committed
fix: resolve test failures and dependency issues
- Remove pypfopt dependency causing compatibility issues - Lower version requirements for better Python 3.8-3.11 compatibility - Simplify GitHub Actions workflow to focus on Python 3.9-3.11 - Add basic functionality test to verify module imports work - Improve test output with success indicators
1 parent 340cd3a commit 1e6c66b

File tree

2 files changed

+33
-21
lines changed

2 files changed

+33
-21
lines changed

.github/workflows/test.yml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: [3.8, 3.9, "3.10", "3.11"]
14+
python-version: ["3.9", "3.10", "3.11"]
1515

1616
steps:
1717
- uses: actions/checkout@v4
@@ -26,21 +26,34 @@ jobs:
2626
python -m pip install --upgrade pip
2727
pip install -r requirements.txt
2828
29-
- name: Test imports
29+
- name: Test basic imports
3030
run: |
31-
python -c "import pandas, numpy, matplotlib, yfinance, scipy, sklearn; print('All imports successful!')"
31+
python -c "import pandas, numpy, matplotlib, yfinance, scipy, sklearn; print('All basic imports successful!')"
3232
3333
- name: Test data utilities
3434
run: |
35-
python -c "from src.data_utils import download_prices; print('Data utils import successful!')"
35+
python -c "from src.data_utils import download_prices; print('Data utils import successful!')"
3636
3737
- name: Test optimization modules
3838
run: |
39-
python -c "from src.markowitz import markowitz_weights; print('Markowitz module import successful!')"
40-
python -c "from src.risk_parity import risk_parity_weights; print('Risk parity module import successful!')"
41-
python -c "from src.monte_carlo import monte_carlo_simulation; print('Monte Carlo module import successful!')"
42-
python -c "from src.black_litterman import black_litterman_weights; print('Black-Litterman module import successful!')"
43-
python -c "from src.ml_predictor import ml_predictor; print('ML predictor module import successful!')"
44-
python -c "from src.hybrid_model import hybrid_weights; print('Hybrid model module import successful!')"
45-
python -c "from src.custom_metrics_opt import custom_metrics_weights; print('Custom metrics module import successful!')"
46-
python -c "from src.walkforward_backtest import walkforward_backtest; print('Walkforward backtest module import successful!')"
39+
python -c "from src.markowitz import markowitz_weights; print('✅ Markowitz module import successful!')"
40+
python -c "from src.risk_parity import risk_parity_weights; print('✅ Risk parity module import successful!')"
41+
python -c "from src.monte_carlo import monte_carlo_simulation; print('✅ Monte Carlo module import successful!')"
42+
python -c "from src.black_litterman import black_litterman_weights; print('✅ Black-Litterman module import successful!')"
43+
python -c "from src.ml_predictor import ml_predictor; print('✅ ML predictor module import successful!')"
44+
python -c "from src.hybrid_model import hybrid_weights; print('✅ Hybrid model module import successful!')"
45+
python -c "from src.custom_metrics_opt import custom_metrics_weights; print('✅ Custom metrics module import successful!')"
46+
python -c "from src.walkforward_backtest import walkforward_backtest; print('✅ Walkforward backtest module import successful!')"
47+
48+
- name: Test basic functionality
49+
run: |
50+
python -c "
51+
import numpy as np
52+
from src.risk_parity import risk_parity_weights
53+
54+
# Test basic functionality
55+
cov_matrix = np.array([[0.01, 0.005], [0.005, 0.01]])
56+
weights = risk_parity_weights(cov_matrix)
57+
print(f'✅ Risk parity weights calculated: {weights}')
58+
print('✅ Basic functionality test passed!')
59+
"

requirements.txt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
numpy>=1.26.0
2-
pandas>=2.1.0
3-
scipy>=1.11.0
4-
matplotlib>=3.8.0
5-
seaborn>=0.13.0
6-
scikit-learn>=1.3.0
7-
yfinance>=0.2.40
8-
ta>=0.10.2
9-
pypfopt>=1.5.5
1+
numpy>=1.21.0
2+
pandas>=1.5.0
3+
scipy>=1.9.0
4+
matplotlib>=3.5.0
5+
seaborn>=0.11.0
6+
scikit-learn>=1.1.0
7+
yfinance>=0.2.0
8+
ta>=0.10.0
109

1110

0 commit comments

Comments
 (0)