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

[FeatureRequest] add wheel info subcommand #639

Open
yjqg6666 opened this issue Oct 25, 2024 · 18 comments
Open

[FeatureRequest] add wheel info subcommand #639

yjqg6666 opened this issue Oct 25, 2024 · 18 comments

Comments

@yjqg6666
Copy link

Add wheel info [./path/to/file.whl / package name from pypi] to show wheel package metadata.

@agronholm
Copy link
Contributor

I could be persuaded to add such a command to be used with local wheel files, but what would it actually show? This request is kind of light on details.

@yjqg6666
Copy link
Author

For example, mitmproxy package, wheel info requires mitmproxy could show the "Requires-Dist:" values of the unpacked file mitmproxy-11.0.0.dist-info/METADATA via wheel unpack mitmproxy-<latest-version>-py3-none-any.whl, the metadata files should be download automatically and unpacked somewhere, or query the remote server like pypi.org if such an API could be provided. wheel info all could show all the content of the unpacked METADATA file.

@agronholm
Copy link
Contributor

What is the practical use case for this? Just so you know, I'm not going to make wheel do any networking operations.

@yjqg6666
Copy link
Author

The package manager tools for OS, like apt/yum/dnf/pkg, have the similar feature. apt/yum/pkg info .

@agronholm
Copy link
Contributor

pip show <package> already does this for installed packages, and there are online tools like libraries.io that let you see the dependencies of any package on the PyPI. I'm asking what practical need you have for wheel to show this information on a wheel file that hasn't been installed?

@yjqg6666
Copy link
Author

yjqg6666 commented Nov 10, 2024

What is the practical use case for this? Just so you know, I'm not going to make wheel do any networking operations.

Like check the dependencies before installing it for porting the package to BSD OS.

If no networking operations, local files are ok.

pip show will not show the version ranges of dependencies.

@yjqg6666
Copy link
Author

yjqg6666 commented Nov 10, 2024

$ pip show mitmproxy

Requires: aioquic, asgiref, Brotli, certifi, cryptography, flask, h11, h2, hyperframe, kaitaistruct, ldap3, mitmproxy-rs, msgpack, passlib, protobuf, publicsuffix2, pyOpenSSL, pyparsing, pyperclip, ruamel.yaml, sortedcontainers, tornado, urwid, wsproto, zstandard

$ cat METADATA

...
Requires-Dist: aioquic <=1.2.0,>=1.1.0
Requires-Dist: asgiref <=3.8.1,>=3.2.10
Requires-Dist: Brotli <=1.1.0,>=1.0
Requires-Dist: certifi >=2019.9.11
Requires-Dist: cryptography <43.1,>=42.0
Requires-Dist: flask <=3.0.3,>=3.0
Requires-Dist: h11 <=0.14.0,>=0.11
Requires-Dist: h2 <=4.1.0,>=4.1
Requires-Dist: hyperframe <=6.0.1,>=6.0
Requires-Dist: kaitaistruct <=0.10,>=0.10
...

Submit an issue to pip project?

@agronholm
Copy link
Contributor

Alright, I'll take this into consideration. But yes, it's strange that pip show doesn't show the versions, or even extras.

Meanwhile, could you draft a sample output for wheel info?

@yjqg6666
Copy link
Author

pip show <package> already does this for installed packages, and there are online tools like libraries.io that let you see the dependencies of any package on the PyPI.

Thanks for the info.

@yjqg6666
Copy link
Author

$ cat METADATA

Name: mitmproxy
Version: 11.0.0
Summary: An interactive, SSL/TLS-capable intercepting proxy for HTTP/1, HTTP/2, and WebSockets.
Author-email: Aldo Cortesi [email protected]
Project-URL: Homepage, https://mitmproxy.org
Project-URL: Source, https://github.com/mitmproxy/mitmproxy/
Project-URL: Documentation, https://docs.mitmproxy.org/stable/
Project-URL: Issues, https://github.com/mitmproxy/mitmproxy/issues
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console :: Curses
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Testing
Classifier: Typing :: Typed

Requires-Python: >=3.10
Requires-Dist: aioquic <=1.2.0,>=1.1.0
Requires-Dist: asgiref <=3.8.1,>=3.2.10
Requires-Dist: typing-extensions <=4.11.0,>=4.3 ; python_version < "3.11"
Requires-Dist: pydivert <=2.1.0,>=2.0.3 ; sys_platform == "win32"

Provides-Extra: dev
Requires-Dist: click <=8.1.7,>=7.0 ; extra == 'dev'
Requires-Dist: types-pyOpenSSL <=24.1.0.20240722,>=23.3.0.0 ; extra == 'dev'

@agronholm
Copy link
Contributor

So you just want it to dump the metadata to console as-is?

@agronholm
Copy link
Contributor

And not show, for example, the wheel version or generator from WHEEL?

@yjqg6666
Copy link
Author

yjqg6666 commented Nov 10, 2024

$ wheel info all mitmproxy-xxx.whl

the content of the metadata file.

$ wheel info name xxx.whl
the value of the name field

$wheel info require xxx.whl

aioquic <=1.2.0,>=1.1.0;asgiref <=3.8.1,>=3.2.10;typing-extensions <=4.11.0,>=4.3 ;

@agronholm
Copy link
Contributor

I think the output of pip show is much more user friendly – it just needs to have all the information and not omit the version ranges

@yjqg6666
Copy link
Author

@agronholm
Copy link
Contributor

I don't feel like the complication of subcommands is necessary here. Or do you see a pressing need for that?

@yjqg6666
Copy link
Author

wheel info xx.whl to show the full content. no subcommand is simpler.

@yjqg6666
Copy link
Author

In this case I'd prefer wheel meta xx.whl?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants