1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-06-20 04:31:42 +08:00

Compare commits

..

104 Commits

Author SHA1 Message Date
Linlang
5dfc661fc3 test build package with macos-15 2024-12-20 11:55:29 +08:00
Linlang
6a123db109 test pip install rebuild package 2024-12-20 11:43:36 +08:00
Linlang
c0f608e3f8 test pip install rebuild package 2024-12-20 11:40:43 +08:00
Linlang
dd67d235af test pip install rebuild package 2024-12-20 11:40:27 +08:00
Linlang
e111fc8172 rebuild total package 2024-12-20 11:19:36 +08:00
Linlang
1a0dc06108 rewrite deploy with macos 2024-12-19 23:57:00 +08:00
Linlang
0f0f49c860 rewrite deploy with macos 2024-12-19 23:54:28 +08:00
Linlang
f10affe9ca rewrite deploy with macos 2024-12-19 23:43:26 +08:00
Linlang
b8ff81ecd4 rewrite deploy with macos 2024-12-19 23:37:44 +08:00
Linlang
d478795b54 rewrite deploy with macos 2024-12-19 23:35:19 +08:00
Linlang
3bc1ae4aae rewrite deploy with macos 2024-12-19 23:32:53 +08:00
Linlang
80a81c0bf7 rewrite deploy with macos 2024-12-19 23:30:43 +08:00
Linlang
8581d30736 rewrite deploy with macos 2024-12-19 23:23:27 +08:00
Linlang
0486ab1f99 rewrite deploy with macos 2024-12-19 23:19:14 +08:00
Linlang
7e6bdc9493 rewrite deploy with macos 2024-12-19 23:17:54 +08:00
Linlang
5222de4934 rewrite deploy with macos 2024-12-19 22:41:20 +08:00
Linlang
94458af3f7 rewrite deploy with macos 2024-12-19 22:40:52 +08:00
Linlang
04ffb400b2 rewrite deploy with macos 2024-12-19 22:32:01 +08:00
Linlang
bfec2aa27a rewrite deploy with macos 2024-12-19 22:31:43 +08:00
Linlang
fed2691cbe rewrite deploy with macos 2024-12-19 22:08:00 +08:00
Linlang
abeb5cfbe0 rewrite deploy with macos 2024-12-19 21:37:55 +08:00
Linlang
59d28b8a11 rewrite deploy with macos 2024-12-19 21:21:15 +08:00
Linlang
22ca863113 rewrite deploy with macos 2024-12-19 20:59:46 +08:00
Linlang
01d2011905 rewrite deploy with macos 2024-12-19 20:47:55 +08:00
Linlang
e4910dd7d1 rewrite deploy with macos 2024-12-19 20:10:46 +08:00
Linlang
848e1f9b18 rewrite deploy with macos 2024-12-19 20:06:36 +08:00
Linlang
ece56371d9 rewrite deploy with macos 2024-12-19 19:32:54 +08:00
Linlang
ef289faf30 rewrite deploy with macos 2024-12-19 19:24:11 +08:00
Linlang
ed360a58d9 rewrite deploy with macos 2024-12-19 19:20:03 +08:00
Linlang
043d283d2a rewrite deploy with macos 2024-12-19 18:49:21 +08:00
Linlang
e28c1e0c38 rewrite deploy with macos 2024-12-19 18:44:41 +08:00
Linlang
2d595aca08 rewrite deploy with macos 2024-12-19 18:43:47 +08:00
Linlang
92e1f07a01 rewrite deploy with macos 2024-12-19 17:37:46 +08:00
Linlang
2a2615a71e rewrite deploy with macos 2024-12-19 17:33:36 +08:00
Linlang
36e2f66730 rewrite deploy with macos 2024-12-19 17:22:34 +08:00
Linlang
d31d17e7aa rewrite deploy with macos 2024-12-19 17:18:36 +08:00
Linlang
e3363208a0 test pip for macos 2024-12-19 16:50:29 +08:00
Linlang
fe8a860f5e build multi version for macos 2024-12-19 16:35:07 +08:00
Linlang
6f39f16695 build multi version for macos 2024-12-19 16:25:57 +08:00
Linlang
c03017628d build multi version for macos 2024-12-19 16:24:50 +08:00
Linlang
a9941bd25c fix pip install not matching packages 2024-12-19 15:43:45 +08:00
Linlang
9d324f6481 fix pip install not matching packages 2024-12-19 15:41:36 +08:00
Linlang
82e755dc7f fix pip install not matching packages 2024-12-19 15:29:51 +08:00
Linlang
f45d031727 fix pip install not matching packages 2024-12-19 15:16:44 +08:00
Linlang
0b938bdddd fix pip install not matching packages 2024-12-19 15:15:20 +08:00
Linlang
b80abdaf89 test package with pip 2024-12-19 14:59:33 +08:00
Linlang
2e2f9125a7 test package with pip 2024-12-19 14:58:28 +08:00
Linlang
16fc2f54c2 fix macos package name error 2024-12-19 14:40:09 +08:00
Linlang
b512074567 fix macos package name error 2024-12-19 14:23:39 +08:00
Linlang
351eea1f78 fix macos package name error 2024-12-19 13:59:08 +08:00
Linlang
f4bcbe3a0a fix macos package name error 2024-12-19 13:47:33 +08:00
Linlang
8e1c7d395b fix macos package name error 2024-12-19 13:37:58 +08:00
Linlang
5281d77fbb fix macos package name error 2024-12-19 13:09:00 +08:00
Linlang
431b9c1281 fix macos package name error 2024-12-19 12:29:15 +08:00
Linlang
6a4273c300 test pip install from testpypi 2024-12-19 10:50:20 +08:00
Linlang
05a9f8cd30 test pip install from testpypi 2024-12-19 10:41:31 +08:00
Linlang
34a53033f1 fix upload to testpypi error 2024-12-18 22:21:52 +08:00
Linlang
631fa33880 fix upload to testpypi error 2024-12-18 22:21:07 +08:00
Linlang
276ee144e7 fix upload to testpypi error 2024-12-18 22:09:51 +08:00
Linlang
b91d0fa076 fix upload to testpypi error 2024-12-18 22:03:35 +08:00
Linlang
c7d3f1f729 fix upload to testpypi error 2024-12-18 22:02:44 +08:00
Linlang
deffd9749f fix upload to testpypi error 2024-12-18 21:55:12 +08:00
Linlang
e82f225dc4 fix upload to testpypi error 2024-12-18 21:54:40 +08:00
Linlang
10f43b8f01 fix upload to testpypi error 2024-12-18 21:48:28 +08:00
Linlang
bac5642d69 fix upload to testpypi error 2024-12-18 21:27:57 +08:00
Linlang
1239a68edc fix upload to testpypi error 2024-12-18 21:26:43 +08:00
Linlang
07a8d72d50 fix upload to testpypi error 2024-12-18 21:21:29 +08:00
Linlang
ea9ef1343c fix upload to testpypi error 2024-12-18 21:15:59 +08:00
Linlang
cc4ac5d4d7 fix upload to testpypi error 2024-12-18 21:13:18 +08:00
Linlang
1aa61a6735 fix upload to testpypi error 2024-12-18 21:09:59 +08:00
Linlang
303e62445b fix upload to testpypi error 2024-12-18 20:54:43 +08:00
Linlang
6a0bc50386 fix upload to testpypi error 2024-12-18 20:52:07 +08:00
Linlang
86b4d4c707 fix upload to testpypi error 2024-12-18 20:44:02 +08:00
Linlang
808ef6b95e fix upload to testpypi error 2024-12-18 20:41:47 +08:00
Linlang
8aaa75daa4 fix upload to testpypi error 2024-12-18 20:15:27 +08:00
Linlang
34908c8846 fix upload to testpypi error 2024-12-18 20:13:10 +08:00
Linlang
687a2b209a fix upload to testpypi error 2024-12-18 20:06:41 +08:00
Linlang
df391f0569 fix upload to testpypi error 2024-12-18 19:58:05 +08:00
Linlang
44b674ce05 fix upload to testpypi error 2024-12-18 19:54:11 +08:00
Linlang
d592bfdea1 fix upload to testpypi error 2024-12-18 19:51:41 +08:00
Linlang
a0236654df fix upload to testpypi error 2024-12-18 19:44:50 +08:00
Linlang
666c8d541d fix upload to testpypi error 2024-12-18 19:42:49 +08:00
Linlang
c243557c13 fix upload to testpypi error 2024-12-18 19:30:26 +08:00
Linlang
624adb40a9 fix upload to testpypi error 2024-12-18 19:28:41 +08:00
Linlang
bb6acaf932 fix upload to testpypi error 2024-12-18 17:32:47 +08:00
Linlang
a8f3d382f8 fix upload to testpypi error 2024-12-18 17:29:47 +08:00
Linlang
625d119f64 fix upload to testpypi error 2024-12-18 17:25:44 +08:00
Linlang
0cafe3e12e fix upload to testpypi error 2024-12-18 17:21:59 +08:00
Linlang
a6164092a9 fix upload to testpypi error 2024-12-18 17:10:05 +08:00
Linlang
a6646dac3e fix upload to testpypi error 2024-12-18 14:52:40 +08:00
Linlang
5a8ff65a3b fix upload to testpypi error 2024-12-18 14:43:38 +08:00
Linlang
b43f8eac31 test upload to testpypi 2024-12-18 14:33:33 +08:00
Linlang
a6e9d8b594 fix build error 2024-12-17 21:13:21 +08:00
Linlang
4330975f4c fix build error 2024-12-17 21:02:49 +08:00
Linlang
fa1a4ce8f9 fix build error 2024-12-17 20:51:56 +08:00
Linlang
5b0fb43f31 fix build error 2024-12-17 20:50:44 +08:00
Linlang
7dec56876f fix build error 2024-12-17 20:41:53 +08:00
Linlang
9b9accdd68 fix build error 2024-12-17 20:22:19 +08:00
Linlang
7c9ef8db88 fix manylinux error 2024-12-17 15:25:20 +08:00
Linlang
b05d442f34 fix manylinux error 2024-12-17 15:22:43 +08:00
Linlang
0de40d1f8f fix manylinux error 2024-12-17 15:19:04 +08:00
Linlang
9e4bdc21ac fix manylinux error 2024-12-17 15:02:42 +08:00
Linlang
dbbcfef723 fix manylinux error 2024-12-17 14:46:58 +08:00
Linlang
8f16f6b0bd update publish.yaml 2024-12-17 11:48:04 +08:00
7 changed files with 36 additions and 194 deletions

View File

@@ -3,16 +3,22 @@
name: Upload Python Package
# on:
# release:
# types: [published]
on:
release:
types: [published]
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
deploy_with_bdist_wheel:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-13, macos-latest]
os: [windows-latest, macos-13, macos-latest, macos-15]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
exclude:
- os: macos-13
@@ -32,13 +38,13 @@ jobs:
- name: Build wheel on ${{ matrix.os }}
run: |
make build
- name: Upload to PyPi
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_PASSWORD: ${{ secrets.TESTPYPI_TOKEN }}
run: |
ls dist
twine check dist/*.whl
twine upload dist/*.whl --verbose
deploy_with_manylinux:
runs-on: ubuntu-latest
@@ -51,15 +57,19 @@ jobs:
- name: Build wheel on Linux
uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_x86_64
with:
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
python-versions: 'cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312'
build-requirements: 'numpy cython'
- name: Install dependencies
run: |
python -m pip install twine
- name: Upload to PyPi
python -m pip list
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_PASSWORD: ${{ secrets.TESTPYPI_TOKEN }}
run: |
twine check dist/pyqlib-*-manylinux*.whl
twine upload dist/pyqlib-*-manylinux*.whl --verbose
ls dist
twine check dist/*.whl

View File

@@ -13,10 +13,13 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Since macos-latest changed from 12.7.4 to 14.4.1,
# the minimum python version that matches a 14.4.1 version of macos is 3.10,
# If you want to use python 3.7 in github action, then the latest macos system version is macos-13,
# after macos-13 python 3.7 is no longer supported.
# so we limit the macos version to macos-13.
os: [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13, macos-14, macos-15]
# In github action, using python 3.7, pip install will not match the latest version of the package.
# Also, python 3.7 is no longer supported from macos-14, and will be phased out from macos-13 in the near future.
# All things considered, we have removed python 3.7.
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
@@ -34,7 +37,7 @@ jobs:
- name: Qlib installation test
run: |
python -m pip install pyqlib
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ pyqlib==0.9.5.80
- name: Install Lightgbm for MacOS
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos-15' }}

View File

@@ -1,113 +0,0 @@
name: Test qlib from source
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
timeout-minutes: 180
# we may retry for 3 times for `Unit tests with Pytest`
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13, macos-14, macos-15]
# In github action, using python 3.7, pip install will not match the latest version of the package.
# Also, python 3.7 is no longer supported from macos-14, and will be phased out from macos-13 in the near future.
# All things considered, we have removed python 3.7.
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Test qlib from source
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update pip to the latest version
run: |
python -m pip install --upgrade pip
- name: Installing pytorch for macos
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos-15' }}
run: |
python -m pip install torch torchvision torchaudio
- name: Installing pytorch for ubuntu
if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' }}
run: |
python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
- name: Installing pytorch for windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
python -m pip install torch torchvision torchaudio
- name: Set up Python tools
run: |
make dev
- name: Lint with Black
run: |
make black
- name: Make html with sphinx
# Since read the docs builds on ubuntu 22.04, we only need to test that the build passes on ubuntu 22.04.
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
make docs-gen
- name: Check Qlib with pylint
run: |
make pylint
- name: Check Qlib with flake8
run: |
make flake8
- name: Check Qlib with mypy
run: |
make mypy
- name: Check Qlib ipynb with nbqa
run: |
make nbqa
- name: Test data downloads
run: |
python scripts/get_data.py qlib_data --name qlib_data_simple --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
python scripts/get_data.py download_data --file_name rl_data.zip --target_dir tests/.data/rl
- name: Install Lightgbm for MacOS
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos-15' }}
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Microsoft/qlib/main/.github/brew_install.sh)"
HOMEBREW_NO_AUTO_UPDATE=1 brew install lightgbm
# FIX MacOS error: Segmentation fault
# reference: https://github.com/microsoft/LightGBM/issues/4229
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/fb8323f2b170bd4ae97e1bac9bf3e2983af3fdb0/Formula/libomp.rb
brew unlink libomp
brew install libomp.rb
- name: Check Qlib ipynb with nbconvert
run: |
make nbconvert
- name: Test workflow by config (install from source)
run: |
python -m pip install numba
python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
- name: Unit tests with Pytest
uses: nick-fields/retry@v2
with:
timeout_minutes: 60
max_attempts: 3
command: |
cd tests
python -m pytest . -m "not slow" --durations=0

View File

@@ -1,58 +0,0 @@
name: Test qlib from source slow
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
timeout-minutes: 720
# we may retry for 3 times for `Unit tests with Pytest`
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13, macos-14, macos-15]
# In github action, using python 3.7, pip install will not match the latest version of the package.
# Also, python 3.7 is no longer supported from macos-14, and will be phased out from macos-13 in the near future.
# All things considered, we have removed python 3.7.
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Test qlib from source slow
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python tools
run: |
make dev
- name: Downloads dependencies data
run: |
python scripts/get_data.py qlib_data --name qlib_data_simple --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
- name: Install Lightgbm for MacOS
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos-15' }}
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Microsoft/qlib/main/.github/brew_install.sh)"
HOMEBREW_NO_AUTO_UPDATE=1 brew install lightgbm
# FIX MacOS error: Segmentation fault
# reference: https://github.com/microsoft/LightGBM/issues/4229
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/fb8323f2b170bd4ae97e1bac9bf3e2983af3fdb0/Formula/libomp.rb
brew unlink libomp
brew install libomp.rb
- name: Unit tests with Pytest
uses: nick-fields/retry@v2
with:
timeout_minutes: 240
max_attempts: 3
command: |
cd tests
python -m pytest . -m "slow" --durations=0

View File

@@ -155,16 +155,15 @@ Here is a quick **[demo](https://terminalizer.com/view/3f24561a4470)** shows how
This table demonstrates the supported Python version of `Qlib`:
| | install with pip | install from source | plot |
| ------------- |:---------------------:|:--------------------:|:------------------:|
| Python 3.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Python 3.8 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Python 3.9 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Python 3.10 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Python 3.11 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Python 3.12 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Python 3.9 | :x: | :heavy_check_mark: | :x: |
**Note**:
1. **Conda** is suggested for managing your Python environment. In some cases, using Python outside of a `conda` environment may result in missing header files, causing the installation failure of certain packages.
2. Please pay attention that installing cython in Python 3.6 will raise some error when installing ``Qlib`` from source. If users use Python 3.6 on their machines, it is recommended to *upgrade* Python to version 3.8 or higher, or use `conda`'s Python to install ``Qlib`` from source.
3. For Python 3.9, `Qlib` supports running workflows such as training models, doing backtest and plot most of the related figures (those included in [notebook](examples/workflow_by_code.ipynb)). However, plotting for the *model performance* is not supported for now and we will fix this when the dependent packages are upgraded in the future.
1. Please pay attention that installing cython in Python 3.6 will raise some error when installing ``Qlib`` from source. If users use Python 3.6 on their machines, it is recommended to *upgrade* Python to version 3.7 or use `conda`'s Python to install ``Qlib`` from source.
1. For Python 3.9, `Qlib` supports running workflows such as training models, doing backtest and plot most of the related figures (those included in [notebook](examples/workflow_by_code.ipynb)). However, plotting for the *model performance* is not supported for now and we will fix this when the dependent packages are upgraded in the future.
1. `Qlib`Requires `tables` package, `hdf5` in tables does not support python3.9.
### Install with pip
Users can easily install ``Qlib`` by pip according to the following command.
@@ -182,7 +181,7 @@ Also, users can install the latest dev version ``Qlib`` by the source code accor
```bash
pip install numpy
pip install --upgrade cython
pip install --upgrade cython
```
* Clone the repository and install ``Qlib`` as follows.
@@ -190,6 +189,7 @@ Also, users can install the latest dev version ``Qlib`` by the source code accor
git clone https://github.com/microsoft/qlib.git && cd qlib
pip install . # `pip install -e .[dev]` is recommended for development. check details in docs/developer/code_standard_and_dev_guide.rst
```
**Note**: You can install Qlib with `python setup.py install` as well. But it is not the recommended approach. It will skip `pip` and cause obscure problems. For example, **only** the command ``pip install .`` **can** overwrite the stable version installed by ``pip install pyqlib``, while the command ``python setup.py install`` **can't**.
**Tips**: If you fail to install `Qlib` or run the examples in your environment, comparing your steps and the [CI workflow](.github/workflows/test_qlib_from_source.yml) may help you find the problem.

View File

@@ -2,7 +2,7 @@
# Licensed under the MIT License.
from pathlib import Path
__version__ = "0.9.6.99"
__version__ = "0.9.5.80"
__version__bak = __version__ # This version is backup for QlibConfig.reset_qlib_version
import os
from typing import Union

View File

@@ -37,5 +37,5 @@ setup(
language="c++",
include_dirs=[NUMPY_INCLUDE],
),
],
]
)