From 18203a9c13a4a7f9eda8a8735963196cb7bf64ee Mon Sep 17 00:00:00 2001 From: AlliedToasters Date: Mon, 20 May 2019 09:40:28 -0600 Subject: [PATCH] single-source version to __init__.py --- setup.py | 15 +++++++++++++-- space_bandits/__init__.py | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 7703f6e..372d134 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,6 @@ from distutils.core import setup import os -from space_bandits import __version__ as version - long_desc = """ A practical library for building contextual bandits models with deep Bayesian approximation. Supports both online learning and offline training of models as well as novel methods for cross-validating CB models on historic data. @@ -16,6 +14,19 @@ def parse_requirements(): requirements = f.read() return requirements.split('\n') +def parse_version(): + """gets current version of library""" + setup_dir = os.path.dirname(os.path.realpath(__file__)) + version_path = os.path.join(setup_dir, 'space_bandits', '__init__.py') + with open(version_path, 'r') as f: + content = f.read() + lines = content.split('\n') + for line in lines: + if "__version__" in line: + version = line.split('=')[1] + return version + +version = parse_version() setup( name='space-bandits', diff --git a/space_bandits/__init__.py b/space_bandits/__init__.py index d7cc533..470e2d4 100644 --- a/space_bandits/__init__.py +++ b/space_bandits/__init__.py @@ -16,7 +16,7 @@ import pickle import shutil -__version__ = '0.0.96' +__version__ = '0.0.97' def load_model(path): """loads model from path argument"""