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 a "pip debug" command #6638

Merged
merged 4 commits into from
Jul 2, 2019
Merged

Add a "pip debug" command #6638

merged 4 commits into from
Jul 2, 2019

Conversation

cjerdonek
Copy link
Member

@cjerdonek cjerdonek commented Jun 23, 2019

This PR implements an initial pip debug command, as suggested / discussed e.g. recently here (in issue #4228) and much earlier here (in issue #5813).

The initial implementation is focused mainly on listing the compatible tags (e.g. the output of pep425tags.get_supported()), since that need has come up in a number of issues. One feature of the current implementation is that it accepts the same --platform, --python-version, --implementation, and --abi options that pip download and install accept. This will help with issues like that expressed in #6121, where currently people have no way of knowing what tags result when they provide certain options. This command gives people a way to experiment and try different things.

The command also gives people a way to experiment in response to failures to match candidate wheels, e.g. using the new log messages introduced in PR #6540.

Also, by default the command shows only the first 10 tags (though we can change this number). Passing --verbose shows all of them (which can be in the several hundreds). Either way, the total count is shown in the first line next to "Compatible tags," along with the tag-related option values that were provided explicitly by the user.

$ pip debug --platform linux_x86_64
pip version: pip 19.2.dev0 from /.../pip/src/pip (python 3.6) (i.e. same output as pip --version)
sys.version: ...
sys.executable: /.../pip/bin/python3.6
sys.platform: darwin
sys.implementation
  name: cpython
Compatible tags: 18 (target: platform='linux_x86_64')
  cp36-cp36m-linux_x86_64
  cp36-abi3-linux_x86_64
  cp36-none-linux_x86_64
  cp35-abi3-linux_x86_64
  cp34-abi3-linux_x86_64
  cp33-abi3-linux_x86_64
  cp32-abi3-linux_x86_64
  py3-none-linux_x86_64
  cp36-none-any
  cp3-none-any
  ...
  [First 10 tags shown. Pass --verbose to show all.]

@cjerdonek cjerdonek added C: cli Command line interface related things (optparse, option grouping etc) type: enhancement Improvements to functionality labels Jun 23, 2019
@cjerdonek cjerdonek force-pushed the debug-command branch 3 times, most recently from 64a719d to fe933d2 Compare June 23, 2019 08:54
src/pip/_internal/commands/debug.py Outdated Show resolved Hide resolved
src/pip/_internal/models/target_python.py Outdated Show resolved Hide resolved
src/pip/_internal/utils/misc.py Show resolved Hide resolved
src/pip/_internal/commands/debug.py Outdated Show resolved Hide resolved
@cjerdonek cjerdonek force-pushed the debug-command branch 2 times, most recently from 536c295 to 3b35cfd Compare June 23, 2019 16:06
@cjerdonek
Copy link
Member Author

Thanks for the quick review, @pradyunsg! I incorporated all of your suggestions (all great).

@cjerdonek
Copy link
Member Author

cjerdonek commented Jun 23, 2019

I also added a few functional tests.

@cjerdonek
Copy link
Member Author

@xavfernandez Any thoughts? We can grow this output over time as I'm sure there are many things missing.

Copy link
Member

@xavfernandez xavfernandez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really good start 👍
It would also need basic documentation (at least a docs/html/reference/pip_debug.rst) and most importantly (IMHO), strongly emphasize that the output and the options of this command are provisional and might change without notice.

@cjerdonek cjerdonek merged commit a8510bc into pypa:master Jul 2, 2019
@cjerdonek cjerdonek deleted the debug-command branch July 2, 2019 09:00
@cjerdonek
Copy link
Member Author

Thanks again, @pradyunsg and @xavfernandez. I merged this and added issue #6672 for the docs suggestion that @xavfernandez made.

@pradyunsg
Copy link
Member

Hurrah! :D

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Aug 1, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation C: cli Command line interface related things (optparse, option grouping etc) type: enhancement Improvements to functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants