Skip to content

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

Open
@HubTou

Description

@HubTou

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: extrasHandling optional dependenciesC: list/show'pip list' or 'pip show'type: enhancementImprovements to functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions