@@ -19,25 +19,15 @@ jobs:
19
19
# If you want to use python 3.7 in github action, then the latest macos system version is macos-13,
20
20
# after macos-13 python 3.7 is no longer supported.
21
21
# so we limit the macos version to macos-13.
22
- os : [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13]
22
+ os : [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13, macos-14, macos-latest ]
23
23
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
24
- python-version : [3.7, 3.8 ]
24
+ python-version : ["3.8", "3.9", "3.10", "3.11", "3.12" ]
25
25
26
26
steps :
27
27
- name : Test qlib from source
28
28
uses : actions/checkout@v3
29
29
30
- # Since version 3.7 of python for MacOS is installed in CI, version 3.7.17, this version causes "_bz not found error".
31
- # So we make the version number of python 3.7 for MacOS more specific.
32
- # refs: https://github.com/actions/setup-python/issues/682
33
30
- name : Set up Python ${{ matrix.python-version }}
34
- if : (matrix.os == 'macos-latest' && matrix.python-version == '3.7') || (matrix.os == 'macos-13' && matrix.python-version == '3.7')
35
- uses : actions/setup-python@v4
36
- with :
37
- python-version : " 3.7.16"
38
-
39
- - name : Set up Python ${{ matrix.python-version }}
40
- if : (matrix.os != 'macos-latest' || matrix.python-version != '3.7') && (matrix.os != 'macos-13' || matrix.python-version != '3.7')
41
31
uses : actions/setup-python@v4
42
32
with :
43
33
python-version : ${{ matrix.python-version }}
47
37
python -m pip install --upgrade pip
48
38
49
39
- name : Installing pytorch for macos
50
- if : ${{ matrix.os == 'macos-13' || matrix.os == 'macos-latest' }}
40
+ if : ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos- latest' }}
51
41
run : |
52
42
python -m pip install torch torchvision torchaudio
53
43
@@ -63,95 +53,41 @@ jobs:
63
53
64
54
- name : Set up Python tools
65
55
run : |
66
- python -m pip install --upgrade cython
67
- python -m pip install -e .[dev]
56
+ make dev
68
57
69
58
- name : Lint with Black
70
- # Python 3.7 will use a black with low level. So we use python with higher version for black check
71
- if : (matrix.python-version != '3.7')
72
59
run : |
73
- pip install -U black # follow the latest version of black, previous Qlib dependency will downgrade black
74
- black . -l 120 --check --diff
60
+ make black
75
61
76
62
- name : Make html with sphinx
77
63
# Since read the docs builds on ubuntu 22.04, we only need to test that the build passes on ubuntu 22.04.
78
64
if : ${{ matrix.os == 'ubuntu-22.04' }}
79
65
run : |
80
- cd docs
81
- sphinx-build -W --keep-going -b html . _build
82
- cd ..
83
-
84
- # Check Qlib with pylint
85
- # TODO: These problems we will solve in the future. Important among them are: W0221, W0223, W0237, E1102
86
- # C0103: invalid-name
87
- # C0209: consider-using-f-string
88
- # R0402: consider-using-from-import
89
- # R1705: no-else-return
90
- # R1710: inconsistent-return-statements
91
- # R1725: super-with-arguments
92
- # R1735: use-dict-literal
93
- # W0102: dangerous-default-value
94
- # W0212: protected-access
95
- # W0221: arguments-differ
96
- # W0223: abstract-method
97
- # W0231: super-init-not-called
98
- # W0237: arguments-renamed
99
- # W0612: unused-variable
100
- # W0621: redefined-outer-name
101
- # W0622: redefined-builtin
102
- # FIXME: specify exception type
103
- # W0703: broad-except
104
- # W1309: f-string-without-interpolation
105
- # E1102: not-callable
106
- # E1136: unsubscriptable-object
107
- # References for parameters: https://github.com/PyCQA/pylint/issues/4577#issuecomment-1000245962
108
- # We use sys.setrecursionlimit(2000) to make the recursion depth larger to ensure that pylint works properly (the default recursion depth is 1000).
66
+ make docs-gen
67
+
109
68
- name : Check Qlib with pylint
110
69
run : |
111
- pylint --disable=C0104,C0114,C0115,C0116,C0301,C0302,C0411,C0413,C1802,R0401,R0801,R0902,R0903,R0911,R0912,R0913,R0914,R0915,R1720,W0105,W0123,W0201,W0511,W0613,W1113,W1514,E0401,E1121,C0103,C0209,R0402,R1705,R1710,R1725,R1735,W0102,W0212,W0221,W0223,W0231,W0237,W0612,W0621,W0622,W0703,W1309,E1102,E1136 --const-rgx='[a-z_][a-z0-9_]{2,30}$' qlib --init-hook "import astroid; astroid.context.InferenceContext.max_inferred = 500; import sys; sys.setrecursionlimit(2000)"
112
- pylint --disable=C0104,C0114,C0115,C0116,C0301,C0302,C0411,C0413,C1802,R0401,R0801,R0902,R0903,R0911,R0912,R0913,R0914,R0915,R1720,W0105,W0123,W0201,W0511,W0613,W1113,W1514,E0401,E1121,C0103,C0209,R0402,R1705,R1710,R1725,R1735,W0102,W0212,W0221,W0223,W0231,W0237,W0246,W0612,W0621,W0622,W0703,W1309,E1102,E1136 --const-rgx='[a-z_][a-z0-9_]{2,30}$' scripts --init-hook "import astroid; astroid.context.InferenceContext.max_inferred = 500; import sys; sys.setrecursionlimit(2000)"
113
-
114
- # The following flake8 error codes were ignored:
115
- # E501 line too long
116
- # Description: We have used black to limit the length of each line to 120.
117
- # F541 f-string is missing placeholders
118
- # Description: The same thing is done when using pylint for detection.
119
- # E266 too many leading '#' for block comment
120
- # Description: To make the code more readable, a lot of "#" is used.
121
- # This error code appears centrally in:
122
- # qlib/backtest/executor.py
123
- # qlib/data/ops.py
124
- # qlib/utils/__init__.py
125
- # E402 module level import not at top of file
126
- # Description: There are times when module level import is not available at the top of the file.
127
- # W503 line break before binary operator
128
- # Description: Since black formats the length of each line of code, it has to perform a line break when a line of arithmetic is too long.
129
- # E731 do not assign a lambda expression, use a def
130
- # Description: Restricts the use of lambda expressions, but at some point lambda expressions are required.
131
- # E203 whitespace before ':'
132
- # Description: If there is whitespace before ":", it cannot pass the black check.
70
+ make pylint
71
+
133
72
- name : Check Qlib with flake8
134
73
run : |
135
- flake8 --ignore=E501,F541,E266,E402,W503,E731,E203 --per-file-ignores="__init__.py:F401,F403" qlib
74
+ make flake8
136
75
137
- # https://github.com/python/mypy/issues/10600
138
76
- name : Check Qlib with mypy
139
77
run : |
140
- mypy qlib --install-types --non-interactive || true
141
- mypy qlib --verbose
78
+ make mypy
142
79
143
80
- name : Check Qlib ipynb with nbqa
144
81
run : |
145
- nbqa black . -l 120 --check --diff
146
- nbqa pylint . --disable=C0104,C0114,C0115,C0116,C0301,C0302,C0411,C0413,C1802,R0401,R0801,R0902,R0903,R0911,R0912,R0913,R0914,R0915,R1720,W0105,W0123,W0201,W0511,W0613,W1113,W1514,E0401,E1121,C0103,C0209,R0402,R1705,R1710,R1725,R1735,W0102,W0212,W0221,W0223,W0231,W0237,W0612,W0621,W0622,W0703,W1309,E1102,E1136,W0719,W0104,W0404,C0412,W0611,C0410 --const-rgx='[a-z_][a-z0-9_]{2,30}$'
82
+ make nbqa
147
83
148
84
- name : Test data downloads
149
85
run : |
150
86
python scripts/get_data.py qlib_data --name qlib_data_simple --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
151
87
python scripts/get_data.py download_data --file_name rl_data.zip --target_dir tests/.data/rl
152
88
153
89
- name : Install Lightgbm for MacOS
154
- if : ${{ matrix.os == 'macos-13' || matrix.os == 'macos-latest' }}
90
+ if : ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos- latest' }}
155
91
run : |
156
92
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Microsoft/qlib/main/.github/brew_install.sh)"
157
93
HOMEBREW_NO_AUTO_UPDATE=1 brew install lightgbm
@@ -161,11 +97,9 @@ jobs:
161
97
brew unlink libomp
162
98
brew install libomp.rb
163
99
164
- # Run after data downloads
165
100
- name : Check Qlib ipynb with nbconvert
166
101
run : |
167
- # add more ipynb files in future
168
- jupyter nbconvert --to notebook --execute examples/workflow_by_code.ipynb
102
+ make nbconvert
169
103
170
104
- name : Test workflow by config (install from source)
171
105
run : |
0 commit comments