'pip list --not-required' and 'pip show' don't handle extra requirements
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
- $ pip install pip_audit
- $ grep "Requires-Dist:" /usr/local/lib/python3.9/site-packages/pip_audit-2.4.14.dist-info/METADATA | grep CacheControl
- $ grep "Requires-Dist:" /usr/local/lib/python3.9/site-packages/CacheControl-0.12.11.dist-info/METADATA | grep filecache
- $ pip list --not-required | grep lockfile
- $ 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
- [X] I agree to follow the PSF Code of Conduct.