From 8621e330f914d84b12ae2bea6b6c1681f84eb48a Mon Sep 17 00:00:00 2001 From: Young Date: Mon, 27 Sep 2021 05:45:49 +0000 Subject: [PATCH] Share version number --- MANIFEST.in | 1 + VERSION.txt | 1 + qlib/__init__.py | 8 +++----- setup.py | 9 ++++++++- 4 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 MANIFEST.in create mode 100644 VERSION.txt diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000000..8dd91c79d2c --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include qlib/VERSION.txt diff --git a/VERSION.txt b/VERSION.txt new file mode 100644 index 00000000000..79e6b01ac90 --- /dev/null +++ b/VERSION.txt @@ -0,0 +1 @@ +0.7.1.99 diff --git a/qlib/__init__.py b/qlib/__init__.py index e6b24abeb3c..7d23df2685e 100644 --- a/qlib/__init__.py +++ b/qlib/__init__.py @@ -1,17 +1,15 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. +from pathlib import Path - -__version__ = "0.7.1" +_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__bak = __version__ # This version is backup for QlibConfig.reset_qlib_version - - import os import yaml import logging import platform import subprocess -from pathlib import Path from .log import get_module_logger diff --git a/setup.py b/setup.py index 790ce097959..d43257353a0 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,14 @@ DESCRIPTION = "A Quantitative-research Platform" REQUIRES_PYTHON = ">=3.5.0" -VERSION = "0.7.1" +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() # Detect Cython try: