-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
171 lines (141 loc) · 4.9 KB
/
Copy pathtest-compatibility.yml
File metadata and controls
171 lines (141 loc) · 4.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Test Pandas/Numpy Compatibility
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
jobs:
test-compatibility:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
pandas-version: ['1.5.0', '2.0.0', '2.1.0', '2.2.0']
numpy-version: ['1.21.0', '1.24.0', '1.26.0']
exclude:
# Exclude incompatible combinations
- python-version: '3.12'
pandas-version: '1.5.0'
- python-version: '3.12'
numpy-version: '1.21.0'
- python-version: '3.8'
pandas-version: '2.2.0'
- python-version: '3.8'
numpy-version: '1.26.0'
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install specific pandas and numpy versions
run: |
python -m pip install --upgrade pip
pip install pandas==${{ matrix.pandas-version }}
pip install numpy==${{ matrix.numpy-version }}
pip install packaging
- name: Install other dependencies
run: |
pip install seaborn>=0.11.0
pip install matplotlib>=3.3.0
pip install scipy>=1.7.0
pip install tabulate>=0.8.9
pip install yfinance>=0.2.18
pip install python-dateutil>=2.8.0
pip install pytest
- name: Install quantstats in development mode
run: |
pip install -e .
- name: Print versions
run: |
python -c "import pandas as pd; import numpy as np; print(f'pandas: {pd.__version__}, numpy: {np.__version__}')"
- name: Run compatibility tests
run: |
python test_fixes.py
- name: Run pytest compatibility tests
run: |
pytest tests/test_compatibility.py -v
- name: Test frequency aliases
run: |
python -c "
import sys
sys.path.insert(0, '.')
from quantstats._compat import get_frequency_alias
print('M ->', get_frequency_alias('M'))
print('Q ->', get_frequency_alias('Q'))
print('Y ->', get_frequency_alias('Y'))
"
- name: Test safe resample operations
run: |
python -c "
import sys
sys.path.insert(0, '.')
import pandas as pd
import numpy as np
from quantstats._compat import safe_resample
# Create test data
dates = pd.date_range('2020-01-01', periods=100, freq='D')
data = pd.Series(np.random.randn(100), index=dates)
# Test resample operations
monthly = safe_resample(data, 'M', 'sum')
quarterly = safe_resample(data, 'Q', 'mean')
yearly = safe_resample(data, 'Y', 'sum')
print('Monthly periods:', len(monthly))
print('Quarterly periods:', len(quarterly))
print('Yearly periods:', len(yearly))
print('All resample operations successful!')
"
test-latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python 3.12 with latest packages
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install latest versions
run: |
python -m pip install --upgrade pip
pip install pandas numpy
pip install packaging
- name: Install other dependencies
run: |
pip install seaborn matplotlib scipy tabulate yfinance python-dateutil pytest
- name: Install quantstats in development mode
run: |
pip install -e .
- name: Print versions
run: |
python -c "import pandas as pd; import numpy as np; print(f'pandas: {pd.__version__}, numpy: {np.__version__}')"
- name: Run compatibility tests with latest versions
run: |
python test_fixes.py
- name: Run pytest compatibility tests
run: |
pytest tests/test_compatibility.py -v
test-python-313:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pandas numpy packaging
pip install seaborn matplotlib scipy tabulate yfinance python-dateutil pytest
- name: Install quantstats in development mode
run: |
pip install -e .
- name: Print versions
run: |
python -c "import pandas as pd; import numpy as np; print(f'pandas: {pd.__version__}, numpy: {np.__version__}')"
- name: Run compatibility tests with Python 3.13
run: |
python test_fixes.py
- name: Run pytest compatibility tests
run: |
pytest tests/test_compatibility.py -v