Skip to content

Commit

Permalink
Make version accessible from within python
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Petersen committed Nov 23, 2018
1 parent 8642117 commit 345e25e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
24 changes: 18 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import re

from setuptools import setup

Expand All @@ -15,17 +16,28 @@ def resolve_requirements(file):
return requirements


with open(os.path.join(os.path.dirname(__file__), "Readme.md")) as f:
readme = f.read()
def read_file(file):
with open(file) as f:
content = f.read()
return content


def find_version(file):
content = read_file(file)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", content, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")

with open(os.path.join(os.path.dirname(__file__), "LICENSE")) as f:
license = f.read()

required = resolve_requirements(os.path.join(os.path.dirname(__file__), 'requirements_full.txt'))
readme = read_file(os.path.join(os.path.dirname(__file__), "Readme.md"))
license = read_file(os.path.join(os.path.dirname(__file__), "LICENSE"))
version = find_version(os.path.join(os.path.dirname(__file__), "trixi", "__init__.py"))

setup(name='trixi',
version='0.1.0.1',
description='Package to log visualizations and experiments, e.g. with visdom',
version=version,
description='Manage your machine learning experiments with trixi - modular, reproducible, high fashion',
long_description=readme,
long_description_content_type="text/markdown",
url='https://github.com/MIC-DKFZ/trixi',
Expand Down
2 changes: 2 additions & 0 deletions trixi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use_agg = True
import matplotlib
if use_agg: matplotlib.use("Agg", warn=False)

__version__ = "0.1.1.0"

0 comments on commit 345e25e

Please sign in to comment.