Skip to content

Commit 657c11d

Browse files
committed
Make version available to Python without dependencies; and to Sphinx metadata
1 parent e32e363 commit 657c11d

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

numpydoc/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22

33
__version__ = '0.8.0.dev0'
44

5-
from .numpydoc import setup
5+
6+
def setup(*args, **kwargs):
7+
from .numpydoc import setup
8+
return setup(*args, **kwargs)

numpydoc/numpydoc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
raise RuntimeError("Sphinx 1.0.1 or newer is required")
3030

3131
from .docscrape_sphinx import get_doc_object, SphinxDocString
32+
from . import __version__
3233

3334
if sys.version_info[0] >= 3:
3435
sixu = lambda s: s
@@ -140,7 +141,8 @@ def setup(app, get_doc_object_=get_doc_object):
140141
app.add_domain(NumpyPythonDomain)
141142
app.add_domain(NumpyCDomain)
142143

143-
metadata = {'parallel_read_safe': True}
144+
metadata = {'version': __version__,
145+
'parallel_read_safe': True}
144146
return metadata
145147

146148
# ------------------------------------------------------------------------------

setup.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010
if sys.version_info[:2] < (2, 7) or (3, 0) <= sys.version_info[0:2] < (3, 4):
1111
raise RuntimeError("Python version 2.7 or >= 3.4 required.")
1212

13-
with open('numpydoc/__init__.py') as fid:
14-
for line in fid:
15-
if line.startswith('__version__'):
16-
version = line.strip().split()[-1][1:-1]
17-
break
13+
from numpydoc import __version__ as version
1814

1915
def read(fname):
2016
"""Utility function to get README.rst into long_description.

0 commit comments

Comments
 (0)