From bad820e7d131c71239075567b3cf45c281562da0 Mon Sep 17 00:00:00 2001 From: Atul Aggarwal Date: Fri, 29 Jun 2018 18:40:22 +0530 Subject: [PATCH 1/8] ENH: Adding pd.__git_version__ to point to git sha commit (#21295) --- pandas/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/__init__.py b/pandas/__init__.py index 97ae73174c09c..efe1d96729ced 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['full-revisionid'] del get_versions, v # module level doc-string From 94e9e41c10274773705c8826550403fa6d3b3f48 Mon Sep 17 00:00:00 2001 From: Atul Aggarwal Date: Sat, 30 Jun 2018 08:00:01 +0530 Subject: [PATCH 2/8] ENH: Using .get instead of directly accessing (#21295) --- pandas/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/__init__.py b/pandas/__init__.py index efe1d96729ced..82d28860d9557 100644 --- a/pandas/__init__.py +++ b/pandas/__init__.py @@ -83,7 +83,7 @@ from ._version import get_versions v = get_versions() __version__ = v.get('closest-tag', v['version']) -__git_version__ = v['full-revisionid'] +__git_version__ = v.get['full-revisionid'] del get_versions, v # module level doc-string From 8a4563cb83a9a3f6f7508d6bf95fa6796a025d3f Mon Sep 17 00:00:00 2001 From: Atul Aggarwal Date: Sat, 30 Jun 2018 08:03:03 +0530 Subject: [PATCH 3/8] ENH: Fixing typo in previous commit (#21295) --- pandas/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/__init__.py b/pandas/__init__.py index 82d28860d9557..05b502f8b281b 100644 --- a/pandas/__init__.py +++ b/pandas/__init__.py @@ -83,7 +83,7 @@ from ._version import get_versions v = get_versions() __version__ = v.get('closest-tag', v['version']) -__git_version__ = v.get['full-revisionid'] +__git_version__ = v.get('full-revisionid') del get_versions, v # module level doc-string From 162985b5c60b048fc177d93a6fe6005c69f71a7f Mon Sep 17 00:00:00 2001 From: Atul Aggarwal Date: Sat, 30 Jun 2018 08:21:05 +0530 Subject: [PATCH 4/8] TST: Adding test for __git_version__ (#21295) --- pandas/tests/test_common.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pandas/tests/test_common.py b/pandas/tests/test_common.py index 61f838eeeeb30..bda1090c3f017 100644 --- a/pandas/tests/test_common.py +++ b/pandas/tests/test_common.py @@ -3,6 +3,7 @@ import pytest import os import collections +import string from functools import partial import numpy as np @@ -13,6 +14,7 @@ from pandas.core import ops from pandas.io.common import _get_handle import pandas.util.testing as tm +import pandas as pd def test_mut_exclusive(): @@ -262,3 +264,9 @@ def test_compression_warning(compression_only): check_stacklevel=False): with f: df.to_csv(f, compression=compression_only) + + +def test_git_version(): + git_version = pd.__git_version__ + assert len(git_version) == 40 + assert all(c in string.hexdigits for c in git_version) From 4808f52b7b1dcede359f6d700530962513230dc5 Mon Sep 17 00:00:00 2001 From: Atul Aggarwal Date: Sun, 1 Jul 2018 22:40:14 +0530 Subject: [PATCH 5/8] TST: Adding whatsnews entry and adding issue number in test (#21295) --- doc/source/whatsnew/v0.24.0.txt | 1 + pandas/tests/test_common.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 0ca5b9cdf1d57..a4d653dd2ad62 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -41,6 +41,7 @@ Other Enhancements (:issue:`21627`) - New method :meth:`HDFStore.walk` will recursively walk the group hierarchy of an HDF5 file (:issue:`10932`) - :meth:`Series.nlargest`, :meth:`Series.nsmallest`, :meth:`DataFrame.nlargest`, and :meth:`DataFrame.nsmallest` now accept the value ``"all"`` for the ``keep` argument. This keeps all ties for the nth largest/smallest value (:issue:`16818`) +- New method :meth:`__git_version__` will return git commit sha of current build - .. _whatsnew_0240.api_breaking: diff --git a/pandas/tests/test_common.py b/pandas/tests/test_common.py index bda1090c3f017..ac73dc734ff80 100644 --- a/pandas/tests/test_common.py +++ b/pandas/tests/test_common.py @@ -265,7 +265,7 @@ def test_compression_warning(compression_only): with f: df.to_csv(f, compression=compression_only) - +# GH 21295 def test_git_version(): git_version = pd.__git_version__ assert len(git_version) == 40 From 249d843f52679749257bed3056936b84270fd873 Mon Sep 17 00:00:00 2001 From: Atul Aggarwal Date: Sun, 1 Jul 2018 22:47:16 +0530 Subject: [PATCH 6/8] TST: Fixing PEP8 error (#21295) --- pandas/tests/test_common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/tests/test_common.py b/pandas/tests/test_common.py index ac73dc734ff80..0b42ac48cef5f 100644 --- a/pandas/tests/test_common.py +++ b/pandas/tests/test_common.py @@ -265,6 +265,7 @@ def test_compression_warning(compression_only): with f: df.to_csv(f, compression=compression_only) + # GH 21295 def test_git_version(): git_version = pd.__git_version__ From a78165de12dc585a3044044e434e88c367acf084 Mon Sep 17 00:00:00 2001 From: Atul Aggarwal Date: Fri, 27 Jul 2018 01:28:03 +0530 Subject: [PATCH 7/8] TST: Moving comment of Issue number below def as per review notes (#21295) --- pandas/tests/test_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/test_common.py b/pandas/tests/test_common.py index 303ddf47813cb..7f41058a8c5d5 100644 --- a/pandas/tests/test_common.py +++ b/pandas/tests/test_common.py @@ -169,8 +169,8 @@ def test_compression_warning(compression_only): df.to_csv(f, compression=compression_only) -# GH 21295 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) From 9421725461061b55bc84e388d3952957d9b0cd83 Mon Sep 17 00:00:00 2001 From: Atul Aggarwal Date: Fri, 27 Jul 2018 07:01:57 +0530 Subject: [PATCH 8/8] Fixing whatsnew entry to specify attribute rather than method. --- 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 e8820c78007d3..7eb6204387337 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -180,7 +180,7 @@ Other Enhancements - :func:`~DataFrame.to_csv` and :func:`~DataFrame.to_json` now support ``compression='infer'`` to infer compression based on filename (:issue:`15008`) - :func:`to_timedelta` now supports iso-formated timedelta strings (:issue:`21877`) - :class:`Series` and :class:`DataFrame` now support :class:`Iterable` in constructor (:issue:`2193`) -- New method :meth:`__git_version__` will return git commit sha of current build +- New attribute :attr:`__git_version__` will return git commit sha of current build - .. _whatsnew_0240.api_breaking: