Add a "pip debug" command by cjerdonek · Pull Request #6638 · pypa/pip (original) (raw)

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.]