From edcb1c63b009fa399a2e6398a518b79568f137a9 Mon Sep 17 00:00:00 2001 From: liwei Date: Tue, 12 Jul 2022 07:47:28 +0000 Subject: [PATCH 1/2] Move the version info into __init__.py --- setup.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 9b2ae6a..da40cc4 100644 --- a/setup.py +++ b/setup.py @@ -5,14 +5,29 @@ import re PACKAGE = "qibotn" + +# Returns the qibotn version +def get_version(): + """ Gets the version from the package's __init__ file + if there is some problem, let it happily fail """ + VERSIONFILE = os.path.join("src", PACKAGE, "__init__.py") + initfile_lines = open(VERSIONFILE, "rt").readlines() + VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" + for line in initfile_lines: + mo = re.search(VSRE, line, re.M) + if mo: + return mo.group(1) + + # load long description from README this_directory = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f: long_description = f.read() + setup( name="qibotn", - version="0.1", + version=get_version(), description="A tensor-network translation module for quantum computing", author="The Qibo team", author_email="", @@ -42,4 +57,4 @@ setup( python_requires=">=3.7.0", long_description=long_description, long_description_content_type='text/markdown', -) +) \ No newline at end of file From 05c1c4fb3a2446e2a36a891cd9cbcf3bf07bfd7b Mon Sep 17 00:00:00 2001 From: liwei Date: Wed, 13 Jul 2022 08:53:49 +0000 Subject: [PATCH 2/2] Change the version number to 0.0.1.dev0 to comply with PEP 8 --- src/qibotn/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qibotn/__init__.py b/src/qibotn/__init__.py index a4e2017..15addcb 100644 --- a/src/qibotn/__init__.py +++ b/src/qibotn/__init__.py @@ -1 +1 @@ -__version__ = "0.1" +__version__ = "0.0.1.dev0"