mirror of
https://github.com/microsoft/qlib.git
synced 2026-06-06 05:51:17 +08:00
Compare commits
104 Commits
4933fcefc4
...
update_pub
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5dfc661fc3 | ||
|
|
6a123db109 | ||
|
|
c0f608e3f8 | ||
|
|
dd67d235af | ||
|
|
e111fc8172 | ||
|
|
1a0dc06108 | ||
|
|
0f0f49c860 | ||
|
|
f10affe9ca | ||
|
|
b8ff81ecd4 | ||
|
|
d478795b54 | ||
|
|
3bc1ae4aae | ||
|
|
80a81c0bf7 | ||
|
|
8581d30736 | ||
|
|
0486ab1f99 | ||
|
|
7e6bdc9493 | ||
|
|
5222de4934 | ||
|
|
94458af3f7 | ||
|
|
04ffb400b2 | ||
|
|
bfec2aa27a | ||
|
|
fed2691cbe | ||
|
|
abeb5cfbe0 | ||
|
|
59d28b8a11 | ||
|
|
22ca863113 | ||
|
|
01d2011905 | ||
|
|
e4910dd7d1 | ||
|
|
848e1f9b18 | ||
|
|
ece56371d9 | ||
|
|
ef289faf30 | ||
|
|
ed360a58d9 | ||
|
|
043d283d2a | ||
|
|
e28c1e0c38 | ||
|
|
2d595aca08 | ||
|
|
92e1f07a01 | ||
|
|
2a2615a71e | ||
|
|
36e2f66730 | ||
|
|
d31d17e7aa | ||
|
|
e3363208a0 | ||
|
|
fe8a860f5e | ||
|
|
6f39f16695 | ||
|
|
c03017628d | ||
|
|
a9941bd25c | ||
|
|
9d324f6481 | ||
|
|
82e755dc7f | ||
|
|
f45d031727 | ||
|
|
0b938bdddd | ||
|
|
b80abdaf89 | ||
|
|
2e2f9125a7 | ||
|
|
16fc2f54c2 | ||
|
|
b512074567 | ||
|
|
351eea1f78 | ||
|
|
f4bcbe3a0a | ||
|
|
8e1c7d395b | ||
|
|
5281d77fbb | ||
|
|
431b9c1281 | ||
|
|
6a4273c300 | ||
|
|
05a9f8cd30 | ||
|
|
34a53033f1 | ||
|
|
631fa33880 | ||
|
|
276ee144e7 | ||
|
|
b91d0fa076 | ||
|
|
c7d3f1f729 | ||
|
|
deffd9749f | ||
|
|
e82f225dc4 | ||
|
|
10f43b8f01 | ||
|
|
bac5642d69 | ||
|
|
1239a68edc | ||
|
|
07a8d72d50 | ||
|
|
ea9ef1343c | ||
|
|
cc4ac5d4d7 | ||
|
|
1aa61a6735 | ||
|
|
303e62445b | ||
|
|
6a0bc50386 | ||
|
|
86b4d4c707 | ||
|
|
808ef6b95e | ||
|
|
8aaa75daa4 | ||
|
|
34908c8846 | ||
|
|
687a2b209a | ||
|
|
df391f0569 | ||
|
|
44b674ce05 | ||
|
|
d592bfdea1 | ||
|
|
a0236654df | ||
|
|
666c8d541d | ||
|
|
c243557c13 | ||
|
|
624adb40a9 | ||
|
|
bb6acaf932 | ||
|
|
a8f3d382f8 | ||
|
|
625d119f64 | ||
|
|
0cafe3e12e | ||
|
|
a6164092a9 | ||
|
|
a6646dac3e | ||
|
|
5a8ff65a3b | ||
|
|
b43f8eac31 | ||
|
|
a6e9d8b594 | ||
|
|
4330975f4c | ||
|
|
fa1a4ce8f9 | ||
|
|
5b0fb43f31 | ||
|
|
7dec56876f | ||
|
|
9b9accdd68 | ||
|
|
7c9ef8db88 | ||
|
|
b05d442f34 | ||
|
|
0de40d1f8f | ||
|
|
9e4bdc21ac | ||
|
|
dbbcfef723 | ||
|
|
8f16f6b0bd |
52
.github/workflows/python-publish.yml
vendored
52
.github/workflows/python-publish.yml
vendored
@@ -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
|
||||
|
||||
|
||||
|
||||
21
.github/workflows/test_qlib_from_pip.yml
vendored
21
.github/workflows/test_qlib_from_pip.yml
vendored
@@ -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
|
||||
|
||||
116
.github/workflows/test_qlib_from_source.yml
vendored
116
.github/workflows/test_qlib_from_source.yml
vendored
@@ -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
|
||||
61
.github/workflows/test_qlib_from_source_slow.yml
vendored
61
.github/workflows/test_qlib_from_source_slow.yml
vendored
@@ -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
|
||||
4
Makefile
4
Makefile
@@ -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)
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
41
setup.py
Normal file
41
setup.py
Normal 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],
|
||||
),
|
||||
]
|
||||
)
|
||||
Reference in New Issue
Block a user