Skip to content

Commit bf4808c

Browse files
MAINT: Set __version__ in numpy_financial/__init__.py
1 parent 6a8aef5 commit bf4808c

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

doc/source/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# https://www.sphinx-doc.org/en/master/usage/configuration.html
66

77
import os
8+
import numpy_financial
89

910
# -- Path setup --------------------------------------------------------------
1011

@@ -43,7 +44,7 @@
4344
# This pattern also affects html_static_path and html_extra_path.
4445
exclude_patterns = []
4546

46-
version = '0.0.1.dev0'
47+
version = numpy_financial.__version__
4748

4849
# -- Options for HTML output -------------------------------------------------
4950

numpy_financial/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11

22

3+
__version__ = "0.0.1.dev3"
4+
35
from ._financial import *

setup.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
#!/usr/bin/env python
22

33

4+
def get_version():
5+
"""
6+
Find the value assigned to __version__ in numpy_financial/__init__.py.
7+
8+
This function assumes that there is a line of the form
9+
10+
__version__ = "version-string"
11+
12+
in that file. It returns the string version-string, or None if such a
13+
line is not found.
14+
"""
15+
with open("numpy_financial/__init__.py", "r") as f:
16+
for line in f:
17+
s = [w.strip() for w in line.split("=", 1)]
18+
if len(s) == 2 and s[0] == "__version__":
19+
return s[1][1:-1]
20+
21+
422
def configuration(parent_package='', top_path=None):
523
from numpy.distutils.misc_util import Configuration
624
config = Configuration(None, parent_package, top_path)
@@ -12,5 +30,5 @@ def configuration(parent_package='', top_path=None):
1230
from numpy.distutils.core import setup
1331

1432
setup(name='numpy-financial',
15-
version='0.0.1.dev2',
33+
version=get_version(),
1634
configuration=configuration)

0 commit comments

Comments
 (0)