-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
ENH: Adding pd.__git_version__ to point to git sha commit (#21295) #21680
Conversation
pandas/__init__.py
Outdated
@@ -83,6 +83,7 @@ | |||
from ._version import get_versions | |||
v = get_versions() | |||
__version__ = v.get('closest-tag', v['version']) | |||
__git_version__ = v['full-revisionid'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this won’t work for released version
use .get
pls add a test for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding test to check if it returns valid sha should be okay?
Codecov Report
@@ Coverage Diff @@
## master #21680 +/- ##
=======================================
Coverage 92.05% 92.05%
=======================================
Files 170 170
Lines 50708 50708
=======================================
Hits 46677 46677
Misses 4031 4031
Continue to review full report at Codecov.
|
we have a once a day CI - https://github.com/pandas-dev/pandas-ci as git_version would be None can u verify? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add a release note in 0.24 other enhancements
pandas/tests/test_common.py
Outdated
|
||
|
||
def test_git_version(): | ||
git_version = pd.__git_version__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can u add the issue number here
Hello @atulagrwl! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on July 27, 2018 at 01:32 Hours UTC |
I am not sure how to do that. This is my first commit to pandas and would appreciate if you tell me help me. |
# Conflicts: # doc/source/whatsnew/v0.24.0.txt
Merged latest master to resolve conflict in whatsnew file. |
pandas/tests/test_common.py
Outdated
@@ -262,3 +264,10 @@ def test_compression_warning(compression_only): | |||
check_stacklevel=False): | |||
with f: | |||
df.to_csv(f, compression=compression_only) | |||
|
|||
|
|||
# GH 21295 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Pls put comment below def line.
@atulagrwl one more rebase, almost over the finish line. |
@jbrockmendel - Did the rebase and minor refactoring as suggested in test. |
doc/source/whatsnew/v0.24.0.txt
Outdated
@@ -180,6 +180,8 @@ 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an attribute, not a method, right?
@jreback looks about right. |
|
||
def test_git_version(): | ||
# GH 21295 | ||
git_version = pd.__git_version__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail when built (which we test on pandas-ci), as the git_version will be None.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this actually run when pandas is installed after tagging?
iow need to tag (locally) then build a release and install and pd.test()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it will, I ran:
python setup.py bdist_wheel
and installed that wheel in a fresh virtual env.
pd.__git_version__
then return the git sha of commit
@@ -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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this what dask does? this will be None in the built version I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way I can create a built version locally and test it out? @jreback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python setup.py bdist_wheel, and then install that wheel in a new env.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created wheel from above command (https://www.dropbox.com/s/3ieyl07ctcsja9u/pandas-0.24.0.dev0%2B373.g942172546-cp36-cp36m-macosx_10_7_x86_64.whl?dl=0) and it showed git_version correctly
>>> import pandas as pd
>>> pd.__version__
'0.24.0.dev0+373.g942172546'
>>> pd.__git_version__
'9421725461061b55bc84e388d3952957d9b0cd83'
@@ -180,6 +180,8 @@ 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 attribute :attr:`__git_version__` will return git commit sha of current build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the issue ref here
@atulagrwl this is almost there, mind merging in the latest changes to these files? And updating the issue ref as per @jreback comment. |
Im happy to take this over the line, since we haven't heard back from @atulagrwl . Will reopen a new PR and we can close this. CC. @jangorecki |
Closing in favor of #22745 |
git diff upstream/master -u -- "*.py" | flake8 --diff