Skip to content

Commit 508b5e1

Browse files
authored
fix: test build package (#6)
* fix: test build package * fix: delete if * fix: ger_version error * fix: black error
1 parent 7c09f47 commit 508b5e1

File tree

5 files changed

+27
-22
lines changed

5 files changed

+27
-22
lines changed

.github/workflows/release.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
name: Release
22

3+
34
on:
45
push:
5-
branches:
6-
- main
6+
branches: [ main ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
#on:
11+
# push:
12+
# branches:
13+
# - main
714

815
permissions:
916
contents: read
@@ -31,30 +38,30 @@ jobs:
3138

3239
steps:
3340
- uses: actions/checkout@v4
34-
if: needs.release.outputs.release_created == 'true'
41+
#if: needs.release.outputs.release_created == 'true'
3542
with:
3643
fetch-depth: 0
3744

3845
- name: Set up Python ${{ matrix.python-version }}
39-
if: needs.release.outputs.release_created == 'true'
46+
#if: needs.release.outputs.release_created == 'true'
4047
uses: actions/setup-python@v4
4148
with:
4249
python-version: ${{ matrix.python-version }}
4350

4451
- name: Build wheel on Linux
45-
if: needs.release.outputs.release_created == 'true'
52+
#if: needs.release.outputs.release_created == 'true'
4653
uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_x86_64
4754
with:
4855
python-versions: 'cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312'
4956
build-requirements: 'numpy cython'
5057

5158
- name: Install dependencies
52-
if: needs.release.outputs.release_created == 'true'
59+
#if: needs.release.outputs.release_created == 'true'
5360
run: |
5461
python -m pip install twine
5562
5663
- name: Upload to PyPi
57-
if: needs.release.outputs.release_created == 'true'
64+
#if: needs.release.outputs.release_created == 'true'
5865
env:
5966
TWINE_USERNAME: __token__
6067
TWINE_PASSWORD: ${{ secrets.TESTPYPI }}
@@ -77,28 +84,28 @@ jobs:
7784

7885
steps:
7986
- uses: actions/checkout@v4
80-
if: needs.release.outputs.release_created == 'true'
87+
#if: needs.release.outputs.release_created == 'true'
8188
with:
8289
fetch-depth: 0
8390

8491
- name: Set up Python ${{ matrix.python-version }}
85-
if: needs.release.outputs.release_created == 'true'
92+
#if: needs.release.outputs.release_created == 'true'
8693
uses: actions/setup-python@v4
8794
with:
8895
python-version: ${{ matrix.python-version }}
8996

9097
- name: Install dependencies
91-
if: needs.release.outputs.release_created == 'true'
98+
#if: needs.release.outputs.release_created == 'true'
9299
run: |
93100
make dev
94101
95102
- name: Build wheel on ${{ matrix.os }}
96-
if: needs.release.outputs.release_created == 'true'
103+
#if: needs.release.outputs.release_created == 'true'
97104
run: |
98105
make build
99106
100107
- name: Upload to PyPi
101-
if: needs.release.outputs.release_created == 'true'
108+
#if: needs.release.outputs.release_created == 'true'
102109
env:
103110
TWINE_USERNAME: __token__
104111
TWINE_PASSWORD: ${{ secrets.TESTPYPI }}

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ dev: prerequisite all
113113

114114
# Check lint with black.
115115
black:
116-
black . -l 120 --check --diff
116+
black . -l 120 --check --diff --exclude qlib/_version.py
117117

118118
# Check code folder with pylint.
119119
# TODO: These problems we will solve in the future. Important among them are: W0221, W0223, W0237, E1102
@@ -195,7 +195,7 @@ lint: black pylint flake8 mypy nbqa
195195

196196
# Build the package.
197197
build:
198-
python -m build --wheel
198+
python -m build
199199

200200
# Upload the package.
201201
upload:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,4 @@ qrun = "qlib.cli.run:run"
117117
[tool.setuptools_scm]
118118
local_scheme = "no-local-version"
119119
version_scheme = "guess-next-dev"
120+
write_to = "qlib/_version.py"

qlib/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
from setuptools_scm import get_version
66

7-
__version__ = get_version(root="..", relative_to=__file__)
7+
try:
8+
from ._version import version as __version__
9+
except ImportError:
10+
__version__ = get_version(root="..", relative_to=__file__)
811
__version__bak = __version__ # This version is backup for QlibConfig.reset_qlib_version
912
import logging
1013
import os

setup.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,9 @@
44
from setuptools import Extension, setup
55

66

7-
def read(rel_path: str) -> str:
8-
here = os.path.abspath(os.path.dirname(__file__))
9-
with open(os.path.join(here, rel_path), encoding="utf-8") as fp:
10-
return fp.read()
11-
12-
137
NUMPY_INCLUDE = numpy.get_include()
148

15-
# delete setuptools_scm
9+
1610
setup(
1711
ext_modules=[
1812
Extension(

0 commit comments

Comments
 (0)