mirror of
https://github.com/microsoft/qlib.git
synced 2026-06-06 05:51:17 +08:00
ci: auto release (#1985)
* ci: auto release * fix: bug getting version in qlib/__init__.py * fix: bug getting version in setup.py * fix: bug getting version in qlib/__init__.py * fix: make the code in CI more complete * fix: specify the root directory in the get_verison method * fix: parameter error * update: optimize code && add comments
This commit is contained in:
21
.commitlintrc.js
Normal file
21
.commitlintrc.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: ["@commitlint/config-conventional"],
|
||||||
|
rules: {
|
||||||
|
// Configuration Format: [level, applicability, value]
|
||||||
|
// level: Error level, usually expressed as a number:
|
||||||
|
// 0 - disable rule
|
||||||
|
// 1 - Warning (does not prevent commits)
|
||||||
|
// 2 - Error (will block the commit)
|
||||||
|
// applicability: the conditions under which the rule applies, commonly used values:
|
||||||
|
// “always” - always apply the rule
|
||||||
|
// “never” - never apply the rule
|
||||||
|
// value: the specific value of the rule, e.g. a maximum length of 100.
|
||||||
|
// Refs: https://commitlint.js.org/reference/rules-configuration.html
|
||||||
|
"header-max-length": [2, "always", 100],
|
||||||
|
"type-enum": [
|
||||||
|
2,
|
||||||
|
"always",
|
||||||
|
["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test", "Release-As"]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,3 +1,16 @@
|
|||||||
|
<!--- Thank you for submitting a Pull Request! In order to make our work smoother. -->
|
||||||
|
<!--- please make sure your Pull Request meets the following requirements: -->
|
||||||
|
<!--- 1. Provide a general summary of your changes in the Title above; -->
|
||||||
|
<!--- 2. Add appropriate prefixes to titles, such as `build:`, `chore:`, `ci:`, `docs:`, `feat:`, `fix:`, `perf:`, `refactor:`, `revert:`, `style:`, `test:`(Ref: https://www.conventionalcommits.org/). -->
|
||||||
|
<!--- Category: -->
|
||||||
|
<!--- Patch Updates: `fix:` -->
|
||||||
|
<!--- Example: fix(auth): correct login validation issue -->
|
||||||
|
<!--- minor update (introduces new functionality): `feat` -->
|
||||||
|
<!--- Example: feature(parser): add ability to parse arrays -->
|
||||||
|
<!--- major update(destructive update): Include BREAKING CHANGE in the commit message footer, or add `! ` in the commit footer to indicate that there is a destructive update. -->
|
||||||
|
<!--- Example: feat(auth)! : remove support for old authentication method -->
|
||||||
|
<!--- Other updates: `build:`, `chore:`, `ci:`, `docs:`, `perf:`, `refactor:`, `revert:`, `style:`, `test:`. -->
|
||||||
|
|
||||||
<!--- Provide a general summary of your changes in the Title above -->
|
<!--- Provide a general summary of your changes in the Title above -->
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|||||||
6
.github/labeler.yml
vendored
6
.github/labeler.yml
vendored
@@ -1,6 +0,0 @@
|
|||||||
documentation:
|
|
||||||
- 'docs/**/*'
|
|
||||||
- '**/*.md'
|
|
||||||
|
|
||||||
waiting for triage:
|
|
||||||
- any: ['**/*', '!docs/**/*', '!**/*.md']
|
|
||||||
14
.github/workflows/labeler.yml
vendored
14
.github/workflows/labeler.yml
vendored
@@ -1,14 +0,0 @@
|
|||||||
name: "Add label automatically"
|
|
||||||
on:
|
|
||||||
- pull_request_target
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
triage:
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: write
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/labeler@v4
|
|
||||||
with:
|
|
||||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
35
.github/workflows/lint_title.yml
vendored
Normal file
35
.github/workflows/lint_title.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: Lint pull request title
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- edited
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
cancel-in-progress: true
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint-title:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# This step is necessary because the lint title uses the .commitlintrc.js file in the project root directory.
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '16'
|
||||||
|
|
||||||
|
- name: Install commitlint
|
||||||
|
run: npm install --save-dev @commitlint/{config-conventional,cli}
|
||||||
|
|
||||||
|
- name: Validate PR Title with commitlint
|
||||||
|
env:
|
||||||
|
BODY: ${{ github.event.pull_request.title }}
|
||||||
|
run: |
|
||||||
|
echo "$BODY" | npx commitlint --config .commitlintrc.js
|
||||||
65
.github/workflows/python-publish.yml
vendored
65
.github/workflows/python-publish.yml
vendored
@@ -1,65 +0,0 @@
|
|||||||
# This workflows will upload a Python Package using Twine when a release is created
|
|
||||||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
|
||||||
|
|
||||||
name: Upload Python Package
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy_with_bdist_wheel:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [windows-latest, macos-13, macos-latest]
|
|
||||||
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@v3
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
make dev
|
|
||||||
- name: Build wheel on ${{ matrix.os }}
|
|
||||||
run: |
|
|
||||||
make build
|
|
||||||
- name: Upload to PyPi
|
|
||||||
env:
|
|
||||||
TWINE_USERNAME: __token__
|
|
||||||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
||||||
run: |
|
|
||||||
twine check dist/*.whl
|
|
||||||
twine upload dist/*.whl --verbose
|
|
||||||
|
|
||||||
deploy_with_manylinux:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- 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.7.1-manylinux2014_x86_64
|
|
||||||
with:
|
|
||||||
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
|
|
||||||
env:
|
|
||||||
TWINE_USERNAME: __token__
|
|
||||||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
||||||
run: |
|
|
||||||
twine check dist/pyqlib-*-manylinux*.whl
|
|
||||||
twine upload dist/pyqlib-*-manylinux*.whl --verbose
|
|
||||||
22
.github/workflows/release-drafter.yml
vendored
22
.github/workflows/release-drafter.yml
vendored
@@ -1,22 +0,0 @@
|
|||||||
name: Release Drafter
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
# branches to consider in the event; optional, defaults to all
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update_release_draft:
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: read
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
# Drafts your next Release notes as Pull Requests are merged into "master"
|
|
||||||
- uses: release-drafter/release-drafter@v5.11.0
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
107
.github/workflows/release.yml
vendored
Normal file
107
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
release_created: ${{ steps.release_please.outputs.release_created }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Release please
|
||||||
|
id: release_please
|
||||||
|
uses: googleapis/release-please-action@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.PAT }}
|
||||||
|
release-type: simple
|
||||||
|
|
||||||
|
deploy_with_manylinux:
|
||||||
|
needs: release
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: read
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
if: needs.release.outputs.release_created == 'true'
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
if: needs.release.outputs.release_created == 'true'
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Build wheel on Linux
|
||||||
|
if: needs.release.outputs.release_created == 'true'
|
||||||
|
uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_x86_64
|
||||||
|
with:
|
||||||
|
python-versions: 'cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312'
|
||||||
|
build-requirements: 'numpy cython'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
if: needs.release.outputs.release_created == 'true'
|
||||||
|
run: |
|
||||||
|
python -m pip install twine
|
||||||
|
|
||||||
|
- name: Upload to PyPi
|
||||||
|
if: needs.release.outputs.release_created == 'true'
|
||||||
|
env:
|
||||||
|
TWINE_USERNAME: __token__
|
||||||
|
TWINE_PASSWORD: ${{ secrets.TESTPYPI }}
|
||||||
|
run: |
|
||||||
|
twine check dist/pyqlib-*-manylinux*.whl
|
||||||
|
twine upload --repository-url https://test.pypi.org/legacy/ dist/pyqlib-*-manylinux*.whl --verbose
|
||||||
|
|
||||||
|
deploy_with_bdist_wheel:
|
||||||
|
needs: release
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
# After testing, the whl files of pyqlib built by macos-14 and macos-15 in python environments of 3.8, 3.9, 3.10, 3.11, 3.12,
|
||||||
|
# the filenames are exactly duplicated, which will result in the duplicated whl files not being able to be uploaded to pypi,
|
||||||
|
# so we chose to just keep the latest macos-latest. macos-latest currently points to macos-15.
|
||||||
|
# Also, macos-13 will stop being supported on 2025-11-14.
|
||||||
|
# Refs: https://github.blog/changelog/2025-07-11-upcoming-changes-to-macos-hosted-runners-macos-latest-migration-and-xcode-support-policy-updates/
|
||||||
|
os: [windows-latest, macos-latest]
|
||||||
|
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
if: needs.release.outputs.release_created == 'true'
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
if: needs.release.outputs.release_created == 'true'
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
if: needs.release.outputs.release_created == 'true'
|
||||||
|
run: |
|
||||||
|
make dev
|
||||||
|
|
||||||
|
- name: Build wheel on ${{ matrix.os }}
|
||||||
|
if: needs.release.outputs.release_created == 'true'
|
||||||
|
run: |
|
||||||
|
make build
|
||||||
|
|
||||||
|
- name: Upload to PyPi
|
||||||
|
if: needs.release.outputs.release_created == 'true'
|
||||||
|
env:
|
||||||
|
TWINE_USERNAME: __token__
|
||||||
|
TWINE_PASSWORD: ${{ secrets.TESTPYPI }}
|
||||||
|
run: |
|
||||||
|
twine check dist/*.whl
|
||||||
|
twine upload --repository-url https://test.pypi.org/legacy/ dist/*.whl --verbose
|
||||||
18
.github/workflows/test_qlib_from_pip.yml
vendored
18
.github/workflows/test_qlib_from_pip.yml
vendored
@@ -21,7 +21,9 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Test qlib from pip
|
- name: Test qlib from pip
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
@@ -32,19 +34,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
|
|
||||||
# Will cancel this step when the next qlib version is released. The current qlib version is: 0.9.6
|
|
||||||
- name: Installing pywinpt for windows
|
|
||||||
if: ${{ matrix.os == 'windows-latest' }}
|
|
||||||
run: |
|
|
||||||
python -m pip install pywinpty --only-binary=:all:
|
|
||||||
|
|
||||||
# # joblib was released on 2025-05-04 with version 1.5.0, in which _backend_args was removed and replaced by _backend_kwargs.
|
|
||||||
# This change caused the application to fail, so the version of joblib is restricted here.
|
|
||||||
# This restriction will be removed in the next release. The current qlib version is: 0.9.6
|
|
||||||
- name: Qlib installation test
|
- name: Qlib installation test
|
||||||
run: |
|
run: |
|
||||||
python -m pip install pyqlib
|
python -m pip install pyqlib
|
||||||
python -m pip install "joblib<=1.4.2"
|
|
||||||
|
|
||||||
- name: Install Lightgbm for MacOS
|
- name: Install Lightgbm for MacOS
|
||||||
if: ${{ matrix.os == 'macos-14' || matrix.os == 'macos-15' }}
|
if: ${{ matrix.os == 'macos-14' || matrix.os == 'macos-15' }}
|
||||||
@@ -53,12 +45,10 @@ jobs:
|
|||||||
brew install libomp || brew reinstall libomp
|
brew install libomp || brew reinstall libomp
|
||||||
python -m pip install --no-binary=:all: lightgbm
|
python -m pip install --no-binary=:all: lightgbm
|
||||||
|
|
||||||
# When the new version is released it should be changed to:
|
|
||||||
# python -m qlib.cli.data qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
|
|
||||||
- name: Downloads dependencies data
|
- name: Downloads dependencies data
|
||||||
run: |
|
run: |
|
||||||
cd ..
|
cd ..
|
||||||
python -m qlib.run.get_data qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
|
python -m qlib.cli.data qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
|
||||||
cd qlib
|
cd qlib
|
||||||
|
|
||||||
- name: Test workflow by config
|
- name: Test workflow by config
|
||||||
|
|||||||
4
.github/workflows/test_qlib_from_source.yml
vendored
4
.github/workflows/test_qlib_from_source.yml
vendored
@@ -22,7 +22,9 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Test qlib from source
|
- name: Test qlib from source
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Test qlib from source slow
|
- name: Test qlib from source slow
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
@@ -37,8 +39,6 @@ jobs:
|
|||||||
run: |
|
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 qlib_data --name qlib_data_simple --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
|
||||||
|
|
||||||
# install.sh file contents from: https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
|
|
||||||
# brew_install.sh file contents from: https://raw.githubusercontent.com/Microsoft/qlib/main/.github/brew_install.sh
|
|
||||||
- name: Install Lightgbm for MacOS
|
- name: Install Lightgbm for MacOS
|
||||||
if: ${{ matrix.os == 'macos-14' || matrix.os == 'macos-15' }}
|
if: ${{ matrix.os == 'macos-14' || matrix.os == 'macos-15' }}
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
0
CHANGELOG.md
Normal file
0
CHANGELOG.md
Normal file
@@ -1,5 +1,5 @@
|
|||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools", "cython", "numpy>=1.24.0"]
|
requires = ["setuptools", "setuptools-scm", "cython", "numpy>=1.24.0"]
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
@@ -22,6 +22,7 @@ dynamic = ["version"]
|
|||||||
description = "A Quantitative-research Platform"
|
description = "A Quantitative-research Platform"
|
||||||
requires-python = ">=3.8.0"
|
requires-python = ">=3.8.0"
|
||||||
readme = {file = "README.md", content-type = "text/markdown"}
|
readme = {file = "README.md", content-type = "text/markdown"}
|
||||||
|
license = { text = "MIT" }
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pyyaml",
|
"pyyaml",
|
||||||
@@ -49,6 +50,7 @@ dependencies = [
|
|||||||
"nbconvert",
|
"nbconvert",
|
||||||
"pyarrow",
|
"pyarrow",
|
||||||
"pydantic-settings",
|
"pydantic-settings",
|
||||||
|
"setuptools-scm",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
@@ -108,3 +110,7 @@ license-files = []
|
|||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
qrun = "qlib.cli.run:run"
|
qrun = "qlib.cli.run:run"
|
||||||
|
|
||||||
|
[tool.setuptools_scm]
|
||||||
|
local_scheme = "no-local-version"
|
||||||
|
version_scheme = "guess-next-dev"
|
||||||
|
|||||||
@@ -2,15 +2,19 @@
|
|||||||
# Licensed under the MIT License.
|
# Licensed under the MIT License.
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
__version__ = "0.9.7"
|
from setuptools_scm import get_version
|
||||||
|
|
||||||
|
__version__ = get_version(root="..", relative_to=__file__)
|
||||||
__version__bak = __version__ # This version is backup for QlibConfig.reset_qlib_version
|
__version__bak = __version__ # This version is backup for QlibConfig.reset_qlib_version
|
||||||
import os
|
|
||||||
import re
|
|
||||||
from typing import Union
|
|
||||||
from ruamel.yaml import YAML
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
from .log import get_module_logger
|
from .log import get_module_logger
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
16
setup.py
16
setup.py
@@ -1,7 +1,9 @@
|
|||||||
from setuptools import setup, Extension
|
|
||||||
import numpy
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import numpy
|
||||||
|
from setuptools import Extension, setup
|
||||||
|
from setuptools_scm import get_version
|
||||||
|
|
||||||
|
|
||||||
def read(rel_path: str) -> str:
|
def read(rel_path: str) -> str:
|
||||||
here = os.path.abspath(os.path.dirname(__file__))
|
here = os.path.abspath(os.path.dirname(__file__))
|
||||||
@@ -9,18 +11,10 @@ def read(rel_path: str) -> str:
|
|||||||
return fp.read()
|
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()
|
NUMPY_INCLUDE = numpy.get_include()
|
||||||
|
|
||||||
VERSION = get_version("qlib/__init__.py")
|
|
||||||
|
|
||||||
|
VERSION = get_version(root=".", relative_to=__file__)
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
version=VERSION,
|
version=VERSION,
|
||||||
|
|||||||
Reference in New Issue
Block a user