Skip to content

Commit a0ec8e2

Browse files
fonnesbeckColCarroll
authored andcommitted
Removed redundant specification of version number (#2926)
* Removed redundant specification of version number * Replaced pymc3 import in setup with regex function for getting version * Removed typo
1 parent 02af08a commit a0ec8e2

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

docs/source/conf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import os
1818
import shlex
1919

20+
import pymc3
21+
2022
# If extensions (or modules to document with autodoc) are in another directory,
2123
# add these directories to sys.path here. If the directory is relative to the
2224
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -79,9 +81,9 @@
7981
# built documents.
8082
#
8183
# The short X.Y version.
82-
version = '3.4'
84+
version = pymc3.__version__
8385
# The full version, including alpha/beta/rc tags.
84-
release = '3.4rc1'
86+
release = version
8587

8688
# The language for content autogenerated by Sphinx. Refer to documentation
8789
# for a list of supported languages.

setup.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
from os.path import realpath, dirname, join
44
from setuptools import setup, find_packages
55
import sys
6-
6+
import re
77

88
DISTNAME = 'pymc3'
99
DESCRIPTION = "Probabilistic Programming in Python: Bayesian Modeling and Probabilistic Machine Learning with Theano"
1010
AUTHOR = 'PyMC Developers'
1111
AUTHOR_EMAIL = '[email protected]'
1212
URL = "http://github.com/pymc-devs/pymc3"
1313
LICENSE = "Apache License, Version 2.0"
14-
VERSION = "3.4rc1"
1514

1615
classifiers = ['Development Status :: 5 - Production/Stable',
1716
'Programming Language :: Python',
@@ -45,10 +44,19 @@
4544
if sys.version_info[0] == 2: # py3 has mock in stdlib
4645
test_reqs.append('mock')
4746

47+
def get_version():
48+
VERSIONFILE = join('pymc3', '__init__.py')
49+
lines = open(VERSIONFILE, 'rt').readlines()
50+
version_regex = r"^__version__ = ['\"]([^'\"]*)['\"]"
51+
for line in lines:
52+
mo = re.search(version_regex, line, re.M)
53+
if mo:
54+
return mo.group(1)
55+
raise RuntimeError('Unable to find version in %s.' % (VERSIONFILE,))
4856

4957
if __name__ == "__main__":
5058
setup(name=DISTNAME,
51-
version=VERSION,
59+
version=get_version(),
5260
maintainer=AUTHOR,
5361
maintainer_email=AUTHOR_EMAIL,
5462
description=DESCRIPTION,

0 commit comments

Comments
 (0)