diff options
| author | Aaron Meurer <asmeurer@gmail.com> | 2021-09-22 17:09:47 -0600 |
|---|---|---|
| committer | Aaron Meurer <asmeurer@gmail.com> | 2021-09-22 17:09:47 -0600 |
| commit | daea42f3e68c4a9ae3cc977f14030082fbb856c5 (patch) | |
| tree | 454fd285cf9aaf95f9498a521d29d3faf0919f32 /numpy/__init__.py | |
| parent | 24c4436b38b0507d757b996a4bd54ce2a9585dd0 (diff) | |
| download | numpy-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/__init__.py')
| -rw-r--r-- | numpy/__init__.py | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py index 27bedb6c1..ebb124738 100644 --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -135,11 +135,7 @@ else: 'VisibleDeprecationWarning'] # get the version using versioneer - from ._version import get_versions - vinfo = get_versions() - __version__ = vinfo.get("closest-tag", vinfo["version"]) - __git_version__ = vinfo.get("full-revisionid") - del get_versions, vinfo + from .version import __version__, git_revision as __git_version__ # mapping of {name: (value, deprecation_msg)} __deprecated_attrs__ = {} @@ -407,7 +403,3 @@ else: # We do this from python, since the C-module may not be reloaded and # it is tidier organized. core.multiarray._multiarray_umath._reload_guard() - -from ._version import get_versions -__version__ = get_versions()['version'] -del get_versions |
