Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more accessible version information #6086

Merged
merged 1 commit into from
Aug 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions numba/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,35 @@
import re
import sys
import warnings
from collections import namedtuple

from ._version import get_versions
__version__ = get_versions()['version']
del get_versions

_version_info = namedtuple('version_info',
('major minor patch short full '
'string tuple git_revision'))
def _gen_v_info():
parts = __version__.split('.')
def try_int(x):
try:
return int(x)
except ValueError:
return None
major = try_int(parts[0])
minor = try_int(parts[1])
patch = try_int(parts[2])
short = (major, minor)
full = (major, minor, patch)
string = __version__
tup = tuple(string.split('.'))
git_revision = tup[3] if len(tup) >= 4 else None
return _version_info(major, minor, patch, short, full, string, tup,
git_revision)
version_info = _gen_v_info()
del _gen_v_info

from numba.core import config
from numba.testing import _runtests as runtests
from numba.core import types, errors
Expand Down