From a6e2d6425140cbe58965a514887c87cccbd4b513 Mon Sep 17 00:00:00 2001 From: alimcmaster1 Date: Tue, 18 Sep 2018 00:31:22 +0100 Subject: [PATCH 1/4] Add git version attr --- pandas/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/__init__.py b/pandas/__init__.py index 97ae73174c09c..05b502f8b281b 100644 --- a/pandas/__init__.py +++ b/pandas/__init__.py @@ -83,6 +83,7 @@ from ._version import get_versions v = get_versions() __version__ = v.get('closest-tag', v['version']) +__git_version__ = v.get('full-revisionid') del get_versions, v # module level doc-string From f07d3986b1ae4838b3331fba84580101e55b24b1 Mon Sep 17 00:00:00 2001 From: alimcmaster1 Date: Tue, 18 Sep 2018 19:37:50 +0100 Subject: [PATCH 2/4] Add git version attr test --- doc/source/whatsnew/v0.24.0.txt | 2 +- pandas/tests/test_common.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 649629714c3b1..8714130f38c7e 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -185,7 +185,7 @@ Other Enhancements - :class:`Resampler` now is iterable like :class:`GroupBy` (:issue:`15314`). - :meth:`Series.resample` and :meth:`DataFrame.resample` have gained the :meth:`Resampler.quantile` (:issue:`15023`). - :meth:`Index.to_frame` now supports overriding column name(s) (:issue:`22580`). - +- New attribute :attr:`__git_version__` will return git commit sha of current build (:issue:`21295` ). .. _whatsnew_0240.api_breaking: Backwards incompatible API changes diff --git a/pandas/tests/test_common.py b/pandas/tests/test_common.py index 868525e818b62..858e82d7f094a 100644 --- a/pandas/tests/test_common.py +++ b/pandas/tests/test_common.py @@ -1,11 +1,13 @@ # -*- coding: utf-8 -*- import collections +import string from functools import partial import numpy as np import pytest +import pandas as pd from pandas import Series, Timestamp from pandas.core import ( common as com, @@ -110,3 +112,9 @@ def test_standardize_mapping(): dd = collections.defaultdict(list) assert isinstance(com.standardize_mapping(dd), partial) + +def test_git_version(): + # GH 21295 + git_version = pd.__git_version__ + assert len(git_version) == 40 + assert all(c in string.hexdigits for c in git_version) \ No newline at end of file From 937d7dd3e9a83acc86abb9776829e23088e83ad4 Mon Sep 17 00:00:00 2001 From: alimcmaster1 Date: Tue, 18 Sep 2018 19:51:35 +0100 Subject: [PATCH 3/4] Pep8 fixes --- pandas/tests/test_common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/tests/test_common.py b/pandas/tests/test_common.py index 858e82d7f094a..ae46bee901ff2 100644 --- a/pandas/tests/test_common.py +++ b/pandas/tests/test_common.py @@ -113,8 +113,9 @@ def test_standardize_mapping(): dd = collections.defaultdict(list) assert isinstance(com.standardize_mapping(dd), partial) + def test_git_version(): # GH 21295 git_version = pd.__git_version__ assert len(git_version) == 40 - assert all(c in string.hexdigits for c in git_version) \ No newline at end of file + assert all(c in string.hexdigits for c in git_version) From b5f70481988171428a9e052f79809341b9caf555 Mon Sep 17 00:00:00 2001 From: alimcmaster1 Date: Tue, 18 Sep 2018 20:52:28 +0100 Subject: [PATCH 4/4] Remove whitespace --- doc/source/whatsnew/v0.24.0.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 8714130f38c7e..7fb87d31fb469 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -185,7 +185,7 @@ Other Enhancements - :class:`Resampler` now is iterable like :class:`GroupBy` (:issue:`15314`). - :meth:`Series.resample` and :meth:`DataFrame.resample` have gained the :meth:`Resampler.quantile` (:issue:`15023`). - :meth:`Index.to_frame` now supports overriding column name(s) (:issue:`22580`). -- New attribute :attr:`__git_version__` will return git commit sha of current build (:issue:`21295` ). +- New attribute :attr:`__git_version__` will return git commit sha of current build (:issue:`21295`). .. _whatsnew_0240.api_breaking: Backwards incompatible API changes