From c60ff42b853fa358d1ec956fdc07b28df93ee6ad Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 14 Apr 2022 09:02:18 -0400 Subject: [PATCH 1/4] MAINT: Dont import for version --- numpydoc/__init__.py | 2 +- setup.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/numpydoc/__init__.py b/numpydoc/__init__.py index 508591d8..42836ff6 100644 --- a/numpydoc/__init__.py +++ b/numpydoc/__init__.py @@ -2,7 +2,7 @@ This package provides the numpydoc Sphinx extension for handling docstrings formatted according to the NumPy documentation format. """ -__version__ = '1.2.2.dev0' +from ._version import __version__ def _verify_sphinx_jinja(): diff --git a/setup.py b/setup.py index 4b946e0a..c6c10f09 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,15 @@ from setuptools import setup -from numpydoc import __version__ as version +# Adapted from MNE-Python (BSD) +version = None +with open(op.path.join('numpydoc', '_version.py'), 'r') as fid: + for line in (line.strip() for line in fid): + if line.startswith('__version__'): + version = line.split('=')[1].strip().strip('\'') + break +if version is None: + raise RuntimeError('Could not determine version') if sys.version_info < (3, 7): raise RuntimeError("Python version >= 3.7 required.") From 0a1cc174e6bee53656e74679fe904fbddec4bd47 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 14 Apr 2022 09:07:26 -0400 Subject: [PATCH 2/4] FIX: Sp --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c6c10f09..871ed9a3 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ # Adapted from MNE-Python (BSD) version = None -with open(op.path.join('numpydoc', '_version.py'), 'r') as fid: +with open(os.path.join('numpydoc', '_version.py'), 'r') as fid: for line in (line.strip() for line in fid): if line.startswith('__version__'): version = line.split('=')[1].strip().strip('\'') From caf644460f5b89d724f80fc2b78e719a8e233287 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 14 Apr 2022 09:13:25 -0400 Subject: [PATCH 3/4] FIX: Add --- numpydoc/_version.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 numpydoc/_version.py diff --git a/numpydoc/_version.py b/numpydoc/_version.py new file mode 100644 index 00000000..cafbb04c --- /dev/null +++ b/numpydoc/_version.py @@ -0,0 +1 @@ +__version__ = '1.2.2.dev0' From e29ae583552e95c089d1a3bc106466263ffbed34 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 14 Apr 2022 09:15:36 -0400 Subject: [PATCH 4/4] STY: PEP --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 871ed9a3..96245316 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ # Adapted from MNE-Python (BSD) version = None -with open(os.path.join('numpydoc', '_version.py'), 'r') as fid: +with open(os.path.join('numpydoc', '_version.py')) as fid: for line in (line.strip() for line in fid): if line.startswith('__version__'): version = line.split('=')[1].strip().strip('\'')