Skip to content

Commit afbb178

Browse files
authored
Update publish (#1871)
* update publish * reformat with black
1 parent a0cef03 commit afbb178

File tree

8 files changed

+84
-63
lines changed

8 files changed

+84
-63
lines changed

.github/workflows/python-publish.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
os: [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13, macos-14, macos-latest]
16-
# FIXME: macos-latest will raise error now.
17-
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
15+
os: [windows-latest, macos-13, macos-latest]
1816
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
17+
exclude:
18+
- os: macos-13
19+
python-version: "3.11"
20+
- os: macos-13
21+
python-version: "3.12"
1922

2023
steps:
21-
- uses: actions/checkout@v2
24+
- uses: actions/checkout@v3
2225
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v2
26+
uses: actions/setup-python@v4
2427
with:
2528
python-version: ${{ matrix.python-version }}
2629
- name: Install dependencies
@@ -29,33 +32,34 @@ jobs:
2932
- name: Build wheel on ${{ matrix.os }}
3033
run: |
3134
make build
32-
- name: Build and publish
35+
- name: Upload to PyPi
3336
env:
3437
TWINE_USERNAME: __token__
3538
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
3639
run: |
37-
twine upload dist/*
40+
twine check dist/*.whl
41+
twine upload dist/*.whl --verbose
3842
3943
deploy_with_manylinux:
4044
runs-on: ubuntu-latest
4145
steps:
42-
- uses: actions/checkout@v2
46+
- uses: actions/checkout@v3
47+
- name: Set up Python ${{ matrix.python-version }}
48+
uses: actions/setup-python@v4
49+
with:
50+
python-version: ${{ matrix.python-version }}
4351
- name: Build wheel on Linux
44-
uses: RalfG/python-wheels-manylinux-build@v0.3.1-manylinux2010_x86_64
52+
uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_x86_64
4553
with:
46-
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
47-
python-versions: 'cp37-cp37m cp38-cp38'
54+
python-versions: 'cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312'
4855
build-requirements: 'numpy cython'
49-
- name: Set up Python
50-
uses: actions/setup-python@v2
51-
with:
52-
python-version: 3.7
5356
- name: Install dependencies
5457
run: |
55-
pip install twine
56-
- name: Build and publish
58+
python -m pip install twine
59+
- name: Upload to PyPi
5760
env:
5861
TWINE_USERNAME: __token__
5962
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
6063
run: |
61-
twine upload dist/pyqlib-*-manylinux*.whl
64+
twine check dist/pyqlib-*-manylinux*.whl
65+
twine upload dist/pyqlib-*-manylinux*.whl --verbose

.github/workflows/test_qlib_from_pip.yml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,17 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
matrix:
16-
# Since macos-latest changed from 12.7.4 to 14.4.1,
17-
# the minimum python version that matches a 14.4.1 version of macos is 3.10,
18-
# If you want to use python 3.7 in github action, then the latest macos system version is macos-13,
19-
# after macos-13 python 3.7 is no longer supported.
20-
# so we limit the macos version to macos-13.
21-
os: [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13]
22-
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
23-
python-version: [3.7, 3.8]
16+
os: [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13, macos-14, macos-15]
17+
# In github action, using python 3.7, pip install will not match the latest version of the package.
18+
# Also, python 3.7 is no longer supported from macos-14, and will be phased out from macos-13 in the near future.
19+
# All things considered, we have removed python 3.7.
20+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2421

2522
steps:
2623
- name: Test qlib from pip
2724
uses: actions/checkout@v3
2825

29-
# Since version 3.7 of python for MacOS is installed in CI, version 3.7.17, this version causes "_bz not found error".
30-
# So we make the version number of python 3.7 for MacOS more specific.
31-
# refs: https://github.com/actions/setup-python/issues/682
3226
- name: Set up Python ${{ matrix.python-version }}
33-
if: (matrix.os == 'macos-latest' && matrix.python-version == '3.7') || (matrix.os == 'macos-13' && matrix.python-version == '3.7')
34-
uses: actions/setup-python@v4
35-
with:
36-
python-version: "3.7.16"
37-
38-
- name: Set up Python ${{ matrix.python-version }}
39-
if: (matrix.os != 'macos-latest' || matrix.python-version != '3.7') && (matrix.os != 'macos-13' || matrix.python-version != '3.7')
4027
uses: actions/setup-python@v4
4128
with:
4229
python-version: ${{ matrix.python-version }}
@@ -47,13 +34,10 @@ jobs:
4734
4835
- name: Qlib installation test
4936
run: |
50-
# 2024-05-30 scs has released a new version: 3.2.4.post2,
51-
# This will cause the CI to fail, so we have limited the version of scs for now.
52-
python -m pip install "scs<=3.2.4"
53-
python -m pip install pyqlib
37+
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ pyqlib==0.9.5.80
5438
5539
- name: Install Lightgbm for MacOS
56-
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-latest' }}
40+
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos-15' }}
5741
run: |
5842
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Microsoft/qlib/main/.github/brew_install.sh)"
5943
HOMEBREW_NO_AUTO_UPDATE=1 brew install lightgbm

.github/workflows/test_qlib_from_source.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@ jobs:
1414
runs-on: ${{ matrix.os }}
1515
strategy:
1616
matrix:
17-
# Since macos-latest changed from 12.7.4 to 14.4.1,
18-
# the minimum python version that matches a 14.4.1 version of macos is 3.10,
19-
# If you want to use python 3.7 in github action, then the latest macos system version is macos-13,
20-
# after macos-13 python 3.7 is no longer supported.
21-
# so we limit the macos version to macos-13.
22-
os: [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13, macos-14, macos-latest]
23-
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
17+
os: [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13, macos-14, macos-15]
18+
# In github action, using python 3.7, pip install will not match the latest version of the package.
19+
# Also, python 3.7 is no longer supported from macos-14, and will be phased out from macos-13 in the near future.
20+
# All things considered, we have removed python 3.7.
2421
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2522

2623
steps:
@@ -37,7 +34,7 @@ jobs:
3734
python -m pip install --upgrade pip
3835
3936
- name: Installing pytorch for macos
40-
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos-latest' }}
37+
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos-15' }}
4138
run: |
4239
python -m pip install torch torchvision torchaudio
4340
@@ -87,7 +84,7 @@ jobs:
8784
python scripts/get_data.py download_data --file_name rl_data.zip --target_dir tests/.data/rl
8885
8986
- name: Install Lightgbm for MacOS
90-
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos-latest' }}
87+
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos-15' }}
9188
run: |
9289
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Microsoft/qlib/main/.github/brew_install.sh)"
9390
HOMEBREW_NO_AUTO_UPDATE=1 brew install lightgbm

.github/workflows/test_qlib_from_source_slow.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@ jobs:
1414
runs-on: ${{ matrix.os }}
1515
strategy:
1616
matrix:
17-
# Since macos-latest changed from 12.7.4 to 14.4.1,
18-
# the minimum python version that matches a 14.4.1 version of macos is 3.10,
19-
# If you want to use python 3.7 in github action, then the latest macos system version is macos-13,
20-
# after macos-13 python 3.7 is no longer supported.
21-
# so we limit the macos version to macos-13.
22-
os: [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13, macos-14, macos-latest]
23-
# not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
17+
os: [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13, macos-14, macos-15]
18+
# In github action, using python 3.7, pip install will not match the latest version of the package.
19+
# Also, python 3.7 is no longer supported from macos-14, and will be phased out from macos-13 in the near future.
20+
# All things considered, we have removed python 3.7.
2421
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2522

2623
steps:
@@ -41,7 +38,7 @@ jobs:
4138
python scripts/get_data.py qlib_data --name qlib_data_simple --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
4239
4340
- name: Install Lightgbm for MacOS
44-
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos-latest' }}
41+
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos-15' }}
4542
run: |
4643
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Microsoft/qlib/main/.github/brew_install.sh)"
4744
HOMEBREW_NO_AUTO_UPDATE=1 brew install lightgbm

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ lint: black pylint flake8 mypy nbqa
181181

182182
# Build the package.
183183
build:
184-
python -m build
184+
python -m build --wheel
185185

186186
# Upload the package.
187187
upload:
@@ -192,4 +192,4 @@ upload:
192192
########################################################################################
193193

194194
docs-gen:
195-
python -m sphinx.cmd.build -W docs $(PUBLIC_DIR)
195+
python -m sphinx.cmd.build -W docs $(PUBLIC_DIR)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ name = "pyqlib"
2121
dynamic = ["version"]
2222
description = "A Quantitative-research Platform"
2323
requires-python = ">=3.8.0"
24+
readme = {file = "README.md", content-type = "text/markdown"}
2425

2526
dependencies = [
2627
"pyyaml",

setup.cfg

Lines changed: 0 additions & 3 deletions
This file was deleted.

setup.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from setuptools import setup, Extension
2+
import numpy
3+
import os
4+
5+
6+
def read(rel_path: str) -> str:
7+
here = os.path.abspath(os.path.dirname(__file__))
8+
with open(os.path.join(here, rel_path), encoding="utf-8") as fp:
9+
return fp.read()
10+
11+
12+
def get_version(rel_path: str) -> str:
13+
for line in read(rel_path).splitlines():
14+
if line.startswith("__version__"):
15+
delim = '"' if '"' in line else "'"
16+
return line.split(delim)[1]
17+
raise RuntimeError("Unable to find version string.")
18+
19+
20+
NUMPY_INCLUDE = numpy.get_include()
21+
22+
VERSION = get_version("qlib/__init__.py")
23+
24+
25+
setup(
26+
version=VERSION,
27+
ext_modules=[
28+
Extension(
29+
"qlib.data._libs.rolling",
30+
["qlib/data/_libs/rolling.pyx"],
31+
language="c++",
32+
include_dirs=[NUMPY_INCLUDE],
33+
),
34+
Extension(
35+
"qlib.data._libs.expanding",
36+
["qlib/data/_libs/expanding.pyx"],
37+
language="c++",
38+
include_dirs=[NUMPY_INCLUDE],
39+
),
40+
],
41+
)

0 commit comments

Comments
 (0)