-
Notifications
You must be signed in to change notification settings - Fork 3.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
Log the resolved commit SHA when installing package via Git URI to make it easier to debug #10135
Comments
I believe this is by design. When a wheel is built, the package is no longer a Git repository, so installing from it won't provide any Git information. If you need to preserve that information, you need to encode it into the wheel (e.g. in the version string, a few projects are already doing this, and there are helper tools like setuptools-scm). |
@uranusjr Thanks for the feedback! Can we just show the current commit hash (which I think is useful for debugging) after $ pip {install | wheel} git+https://github.com/scikit-learn/scikit-learn.git
Collecting git+https://github.com/scikit-learn/scikit-learn.git
Cloning https://github.com/scikit-learn/scikit-learn.git to /tmp/pip-req-build-lna_339q
Running command git clone -q https://github.com/scikit-learn/scikit-learn.git /tmp/pip-req-build-lna_339q
+ # Just show the current commit SHA here |
IIRC (didn't check) it's already available in debug mode, and moving it to A PR would be very welcomed! |
@uranusjr Thanks for the reply!
|
Yeah, it does not seem to have logged to debug right now (thanks for the link!) so we should just add it. I think it should be done a few stacks above |
@uranusjr Thanks! I'm taking a look at def fetch_new(self, dest, url, rev_options):
# type: (str, HiddenText, RevOptions) -> None
rev_display = rev_options.to_display()
logger.info('Cloning %s%s to %s', url, rev_display, display_path(dest))
self.run_command(make_command('clone', '-q', url, dest))
if rev_options.rev:
# Then a specific revision was requested.
rev_options = self.resolve_revision(dest, url, rev_options)
...
##### NEW LINES #####
else:
sha = self.get_revision(dest)
rev_options = rev_options.make_new(sha)
logger.info('Commit SHA: %s' rev_options.rev)
##### NEW LINES #####
#: repo may contain submodules
self.update_submodules(dest) |
Yeah I think that makes sense. We’ll probably need some tests, and if possible, add the same to other vcs backends as well, but we can discuss that after the pull request is created. |
Got it, I'll file a PR! |
What's the problem this feature will solve?
Currently, when we install a package via Git URI,
pip
doesn't tell us what the current commit SHA is:Let's say we run the command above in CI to run tests against the dev version of scikit-learn. If the current commit hash was shown, it would help us indetify commits/changes that break the tests.
Describe the solution you'd like
Just show the current commit SHA after cloning the repo.
Alternative Solutions
Additional context
The text was updated successfully, but these errors were encountered: