From 5d79fc139414be1aca8b74185451fdfe68f3b07b Mon Sep 17 00:00:00 2001 From: Andrew Yates Date: Sat, 13 Jun 2020 16:01:58 +0200 Subject: [PATCH] release 0.2.1 --- capreolus/__init__.py | 2 ++ docs/conf.py | 29 ++++++++++++++++++++++++----- setup.py | 18 +++++++++++++++++- 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/capreolus/__init__.py b/capreolus/__init__.py index 6b4a1c546..9056e08db 100644 --- a/capreolus/__init__.py +++ b/capreolus/__init__.py @@ -4,6 +4,8 @@ from profane import ConfigOption, Dependency, constants, config_list_to_dict +__version__ = "0.2.1" + # specify a base package that we should look for modules under (e.g., .task) # constants must be specified before importing Task (or any other modules!) constants["BASE_PACKAGE"] = "capreolus" diff --git a/docs/conf.py b/docs/conf.py index a58d502ee..97db7c46d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,17 +18,36 @@ sys.path.insert(0, os.path.abspath("../")) assert os.path.exists(os.path.abspath("../capreolus")) +# from https://packaging.python.org/guides/single-sourcing-package-version/ +def read(rel_path): + here = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(here, rel_path), "rt") 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.") + + # -- Project information ----------------------------------------------------- project = "Capreolus" copyright = "2020" -author = "" +author = "Andrew Yates" -# The short X.Y version -version = "0.2" # The full version, including alpha/beta/rc tags -release = "0.2.0" - +release = get_version("../capreolus/__init__.py") +# The short X.Y version +version = release +# no need to separate these currently +# version = ".".join(release.split(".")[:2]) +# assert version.count(".") == 1 +assert release.startswith(version) # -- General configuration --------------------------------------------------- diff --git a/setup.py b/setup.py index 3a04d0fdb..67575c34d 100644 --- a/setup.py +++ b/setup.py @@ -23,9 +23,25 @@ def run(self): with open("README.md", "r") as fh: long_description = fh.read() +# from https://packaging.python.org/guides/single-sourcing-package-version/ +def read(rel_path): + here = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(here, rel_path), "rt") 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.") + + setuptools.setup( name="capreolus", - version="0.2.0", + version=get_version("capreolus/__init__.py"), author="Andrew Yates, Kevin Martin Jose, Xinyu Zhang, Siddhant Arora, Wei Yang, Jimmy Lin", author_email="", description="A toolkit for end-to-end neural ad hoc retrieval",