Skip to content

Commit

Permalink
single-source version to __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AlliedToasters committed May 20, 2019
1 parent 5de7954 commit 18203a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions 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.
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion space_bandits/__init__.py
Expand Up @@ -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"""
Expand Down

0 comments on commit 18203a9

Please sign in to comment.