1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-06-06 05:51:17 +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
9 changed files with 82 additions and 219 deletions

View File

@@ -3,24 +3,33 @@
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, ubuntu-20.04, ubuntu-22.04, macos-13, macos-14, macos-latest]
# FIXME: macos-latest will raise error now.
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
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
python-version: "3.11"
- os: macos-13
python-version: "3.12"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
@@ -32,30 +41,35 @@ jobs:
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_PASSWORD: ${{ secrets.TESTPYPI_TOKEN }}
run: |
twine upload dist/*
ls dist
twine check dist/*.whl
deploy_with_manylinux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Build wheel on Linux
uses: RalfG/python-wheels-manylinux-build@v0.3.1-manylinux2010_x86_64
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: 'cp37-cp37m cp38-cp38'
python-versions: 'cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312'
build-requirements: 'numpy cython'
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
pip install twine
python -m pip install twine
python -m pip list
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_PASSWORD: ${{ secrets.TESTPYPI_TOKEN }}
run: |
twine upload dist/pyqlib-*-manylinux*.whl
ls dist
twine check dist/*.whl

View File

@@ -18,25 +18,15 @@ jobs:
# 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]
os: [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13, macos-14, macos-15]
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
python-version: [3.7, 3.8]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Test qlib from pip
uses: actions/checkout@v3
# Since version 3.7 of python for MacOS is installed in CI, version 3.7.17, this version causes "_bz not found error".
# So we make the version number of python 3.7 for MacOS more specific.
# refs: https://github.com/actions/setup-python/issues/682
- name: Set up Python ${{ matrix.python-version }}
if: (matrix.os == 'macos-latest' && matrix.python-version == '3.7') || (matrix.os == 'macos-13' && matrix.python-version == '3.7')
uses: actions/setup-python@v4
with:
python-version: "3.7.16"
- name: Set up Python ${{ matrix.python-version }}
if: (matrix.os != 'macos-latest' || matrix.python-version != '3.7') && (matrix.os != 'macos-13' || matrix.python-version != '3.7')
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
@@ -47,13 +37,10 @@ jobs:
- name: Qlib installation test
run: |
# 2024-05-30 scs has released a new version: 3.2.4.post2,
# This will cause the CI to fail, so we have limited the version of scs for now.
python -m pip install "scs<=3.2.4"
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-latest' }}
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

View File

@@ -1,116 +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:
# 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-latest]
# 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:
- 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-latest' }}
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-latest' }}
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,61 +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:
# 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-latest]
# 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:
- 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-latest' }}
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

@@ -181,7 +181,7 @@ lint: black pylint flake8 mypy nbqa
# Build the package.
build:
python -m build
python -m build --wheel
# Upload the package.
upload:
@@ -192,4 +192,4 @@ upload:
########################################################################################
docs-gen:
python -m sphinx.cmd.build -W docs $(PUBLIC_DIR)
python -m sphinx.cmd.build -W docs $(PUBLIC_DIR)

View File

@@ -21,6 +21,7 @@ name = "pyqlib"
dynamic = ["version"]
description = "A Quantitative-research Platform"
requires-python = ">=3.8.0"
readme = {file = "README.md", content-type = "text/markdown"}
dependencies = [
"pyyaml",

View File

@@ -2,7 +2,7 @@
# Licensed under the MIT License.
from pathlib import Path
__version__ = "0.9.5.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

@@ -1,3 +0,0 @@
[metadata]
name = qlib
version = attr: qlib.__version__

41
setup.py Normal file
View File

@@ -0,0 +1,41 @@
from setuptools import setup, Extension
import numpy
import os
def read(rel_path: str) -> str:
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, rel_path), encoding="utf-8") as fp:
return fp.read()
def get_version(rel_path: str) -> str:
for line in read(rel_path).splitlines():
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
raise RuntimeError("Unable to find version string.")
NUMPY_INCLUDE = numpy.get_include()
VERSION = get_version("qlib/__init__.py")
setup(
version=VERSION,
ext_modules=[
Extension(
"qlib.data._libs.rolling",
["qlib/data/_libs/rolling.pyx"],
language="c++",
include_dirs=[NUMPY_INCLUDE],
),
Extension(
"qlib.data._libs.expanding",
["qlib/data/_libs/expanding.pyx"],
language="c++",
include_dirs=[NUMPY_INCLUDE],
),
]
)