Skip to content

Commit

Permalink
Merge pull request #6 from qiboteam/refactor_version_info
Browse files Browse the repository at this point in the history
Move the version info into __init__.py
  • Loading branch information
liweintu authored Jul 14, 2022
2 parents 42abca2 + 05c1c4f commit d6aafa3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,29 @@

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="",
Expand Down Expand Up @@ -42,4 +57,4 @@
python_requires=">=3.7.0",
long_description=long_description,
long_description_content_type='text/markdown',
)
)
2 changes: 1 addition & 1 deletion src/qibotn/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1"
__version__ = "0.0.1.dev0"

0 comments on commit d6aafa3

Please sign in to comment.