pip icon indicating copy to clipboard operation
pip copied to clipboard

'pip list --not-required' and 'pip show' don't handle extra requirements

Open HubTou opened this issue 2 years ago • 0 comments

Description

'pip list --not-required' lists as not required packages that are required from package[extra] dependencies.

Furthermore 'pip show' doesn't show these dependencies either.

Here's a simple example below with pip_audit, CacheControl and lockfile.

Expected behavior

They should not :-)

I deleted some of my 'not required' packages and broke requiring packages.

pip version

23.0.1

Python version

3.9.16

OS

FreeBSD 13.1-RELEASE

How to Reproduce

  1. $ pip install pip_audit
  2. $ grep "Requires-Dist:" /usr/local/lib/python3.9/site-packages/pip_audit-2.4.14.dist-info/METADATA | grep CacheControl
  3. $ grep "Requires-Dist:" /usr/local/lib/python3.9/site-packages/CacheControl-0.12.11.dist-info/METADATA | grep filecache
  4. $ pip list --not-required | grep lockfile
  5. $ pip show CacheControl

Output

Step 2:

Requires-Dist: CacheControl[filecache]>=0.12.10

Step 3:

Provides-Extra: filecache Requires-Dist: lockfile (>=0.9) ; extra == 'filecache'

Step 4: lockfile should not appear

lockfile 0.12.2

Step 5: lockfile should appear on the 'Requires:' line

Name: CacheControl Version: 0.12.11 Summary: httplib2 caching for requests Home-page: https://github.com/ionrock/cachecontrol Author: Eric Larson Author-email: [email protected] License: UNKNOWN Location: /usr/local/lib/python3.9/site-packages Requires: msgpack, requests Required-by: pip_audit

Code of Conduct

HubTou avatar Mar 02 '23 18:03 HubTou