From f05d3b00c1339f4ea8de73ee460ef3616e0d50cf Mon Sep 17 00:00:00 2001 From: Amir Bilu Date: Mon, 23 Aug 2021 14:44:08 +0300 Subject: [PATCH] fix version --- setup.py | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 87e483f..5ce2ed7 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,30 @@ import setuptools import os +import codecs from glob import glob -from src.jupyter_tabnine._version import __version__ as version -with open('./README.rst') as f: + +def read(rel_path): + here = os.path.abspath(os.path.dirname(__file__)) + with codecs.open(os.path.join(here, rel_path), "r") as fp: + return fp.read() + + +def get_version(rel_path): + for line in read(rel_path).splitlines(): + if line.startswith("__version__"): + delim = '"' if '"' in line else "'" + return line.split(delim)[1] + else: + raise RuntimeError("Unable to find version string.") + + +with open("./README.rst") as f: readme = f.read() setuptools.setup( name="jupyter_tabnine", - version=version, + version=get_version("src/jupyter_tabnine/_version.py"), url="https://github.com/wenmin-wu/jupyter-tabnine", author="Wenmin Wu", long_description=readme, @@ -16,14 +32,19 @@ author_email="wuwenmin1991@gmail.com", license="MIT", description="Jupyter notebook extension which support coding auto-completion based on Deep Learning", - packages=setuptools.find_packages('src'), - package_dir={'': 'src'}, - data_files=[('static', glob('src/jupyter_tabnine/static/*'))], - install_requires=['ipython', 'jupyter_core', 'nbconvert', 'notebook >=4.2',], - python_requires='>=3.5', + packages=setuptools.find_packages("src"), + package_dir={"": "src"}, + data_files=[("static", glob("src/jupyter_tabnine/static/*"))], + install_requires=[ + "ipython", + "jupyter_core", + "nbconvert", + "notebook >=4.2", + ], + python_requires=">=3.5", classifiers=[ - 'Framework :: Jupyter', + "Framework :: Jupyter", ], include_package_data=True, - zip_safe=False + zip_safe=False, )