@@ -19,25 +19,15 @@ jobs:
1919 # If you want to use python 3.7 in github action, then the latest macos system version is macos-13,
2020 # after macos-13 python 3.7 is no longer supported.
2121 # 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 ]
2323 # 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" ]
2525
2626 steps :
2727 - name : Test qlib from source
2828 uses : actions/checkout@v3
2929
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
3330 - 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')
4131 uses : actions/setup-python@v4
4232 with :
4333 python-version : ${{ matrix.python-version }}
4737 python -m pip install --upgrade pip
4838
4939 - 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' }}
5141 run : |
5242 python -m pip install torch torchvision torchaudio
5343
@@ -63,95 +53,41 @@ jobs:
6353
6454 - name : Set up Python tools
6555 run : |
66- python -m pip install --upgrade cython
67- python -m pip install -e .[dev]
56+ make dev
6857
6958 - 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')
7259 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
7561
7662 - name : Make html with sphinx
7763 # Since read the docs builds on ubuntu 22.04, we only need to test that the build passes on ubuntu 22.04.
7864 if : ${{ matrix.os == 'ubuntu-22.04' }}
7965 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+
10968 - name : Check Qlib with pylint
11069 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+
13372 - name : Check Qlib with flake8
13473 run : |
135- flake8 --ignore=E501,F541,E266,E402,W503,E731,E203 --per-file-ignores="__init__.py:F401,F403" qlib
74+ make flake8
13675
137- # https://github.com/python/mypy/issues/10600
13876 - name : Check Qlib with mypy
13977 run : |
140- mypy qlib --install-types --non-interactive || true
141- mypy qlib --verbose
78+ make mypy
14279
14380 - name : Check Qlib ipynb with nbqa
14481 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
14783
14884 - name : Test data downloads
14985 run : |
15086 python scripts/get_data.py qlib_data --name qlib_data_simple --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
15187 python scripts/get_data.py download_data --file_name rl_data.zip --target_dir tests/.data/rl
15288
15389 - 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' }}
15591 run : |
15692 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Microsoft/qlib/main/.github/brew_install.sh)"
15793 HOMEBREW_NO_AUTO_UPDATE=1 brew install lightgbm
@@ -161,11 +97,9 @@ jobs:
16197 brew unlink libomp
16298 brew install libomp.rb
16399
164- # Run after data downloads
165100 - name : Check Qlib ipynb with nbconvert
166101 run : |
167- # add more ipynb files in future
168- jupyter nbconvert --to notebook --execute examples/workflow_by_code.ipynb
102+ make nbconvert
169103
170104 - name : Test workflow by config (install from source)
171105 run : |
0 commit comments