def version(path):
    version_file = read(path)
    version_match = re.search(r"""^__version__ = ['"]([^'"]*)['"]""",
                              version_file, re.M)
    if version_match:
        return version_match.group(1)
    raise RuntimeError("Unable to find version string.")
Obtain the packge version from a python file e.g. pkg/__init__.py
dataset/ETHPy150Open astroML/gatspy/setup.py/version