summaryrefslogtreecommitdiff
path: root/numpy/version.py
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-09-22 17:09:47 -0600
committerAaron Meurer <asmeurer@gmail.com>2021-09-22 17:09:47 -0600
commitdaea42f3e68c4a9ae3cc977f14030082fbb856c5 (patch)
tree454fd285cf9aaf95f9498a521d29d3faf0919f32 /numpy/version.py
parent24c4436b38b0507d757b996a4bd54ce2a9585dd0 (diff)
downloadnumpy-daea42f3e68c4a9ae3cc977f14030082fbb856c5.tar.gz
BUG: Only call the get_versions() function once on import
When using an in-place build, this function calls various git commands to get the version number. Previously it was called three times, making 'import numpy' take over 3 seconds on my machine (it could be even slower on a slow filesystem). The code has been refactored to only call this function once in versions.py. Now 'import numpy' on an in-place build only takes 500 ms, which is still slower than importing the installed version, but that is expected when using versioneer.
Diffstat (limited to 'numpy/version.py')
-rw-r--r--numpy/version.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/version.py b/numpy/version.py
index 4159a1c0e..2b076349d 100644
--- a/numpy/version.py
+++ b/numpy/version.py
@@ -1,9 +1,10 @@
from ._version import get_versions
-__ALL__ = ['version', 'full_version', 'git_revision', 'release']
+__ALL__ = ['version', '__version__', 'full_version', 'git_revision', 'release']
vinfo = get_versions()
version: str = vinfo["version"]
+__version__ = vinfo.get("closest-tag", vinfo["version"])
full_version: str = vinfo['version']
git_revision: str = vinfo['full-revisionid']
release = 'dev0' not in version and '+' not in version