Skip to content

Commit 9eb6f9b

Browse files
authored
MAINT: Dont import for version (#382)
* MAINT: Dont import for version * FIX: Sp * FIX: Add * STY: PEP
1 parent 4aea3d2 commit 9eb6f9b

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

numpydoc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This package provides the numpydoc Sphinx extension for handling docstrings
33
formatted according to the NumPy documentation format.
44
"""
5-
__version__ = '1.2.2.dev0'
5+
from ._version import __version__
66

77

88
def _verify_sphinx_jinja():

numpydoc/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '1.2.2.dev0'

setup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33

44
from setuptools import setup
55

6-
from numpydoc import __version__ as version
6+
# Adapted from MNE-Python (BSD)
7+
version = None
8+
with open(os.path.join('numpydoc', '_version.py')) as fid:
9+
for line in (line.strip() for line in fid):
10+
if line.startswith('__version__'):
11+
version = line.split('=')[1].strip().strip('\'')
12+
break
13+
if version is None:
14+
raise RuntimeError('Could not determine version')
715

816
if sys.version_info < (3, 7):
917
raise RuntimeError("Python version >= 3.7 required.")

0 commit comments

Comments
 (0)