mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-04 03:21:00 +08:00
solve VERSION.txt bug (#732)
* solve VERSION.txt bug * back to main version * change setup and init to follow pypi type * add read function * solve black format Co-authored-by: DefangCui <170007807@pku.edu.cn>
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
# Licensed under the MIT License.
|
||||
from pathlib import Path
|
||||
|
||||
_version_path = Path(__file__).absolute().parent / "VERSION.txt" # This file is copyed from setup.py
|
||||
__version__ = _version_path.read_text(encoding="utf-8").strip()
|
||||
__version__ = "0.8.0.99"
|
||||
__version__bak = __version__ # This version is backup for QlibConfig.reset_qlib_version
|
||||
import os
|
||||
from typing import Union
|
||||
|
||||
21
setup.py
21
setup.py
@@ -6,6 +6,21 @@ import numpy
|
||||
|
||||
from setuptools import find_packages, setup, Extension
|
||||
|
||||
|
||||
def read(rel_path: str) -> str:
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
with open(os.path.join(here, rel_path)) 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.")
|
||||
|
||||
|
||||
# Package meta-data.
|
||||
NAME = "pyqlib"
|
||||
DESCRIPTION = "A Quantitative-research Platform"
|
||||
@@ -14,11 +29,7 @@ REQUIRES_PYTHON = ">=3.5.0"
|
||||
from pathlib import Path
|
||||
from shutil import copyfile
|
||||
|
||||
CURRENT_DIR = Path(__file__).absolute().parent
|
||||
_version_src = CURRENT_DIR / "VERSION.txt"
|
||||
_version_dst = CURRENT_DIR / "qlib" / "VERSION.txt"
|
||||
copyfile(_version_src, _version_dst)
|
||||
VERSION = _version_dst.read_text(encoding="utf-8").strip()
|
||||
VERSION = get_version("qlib/__init__.py")
|
||||
|
||||
# Detect Cython
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user