-
Notifications
You must be signed in to change notification settings - Fork 3k
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
pip index show
command which fetches the package information via the JSON API
#10470
Comments
The JSON API is not standardised, and our current principle is to only implements new features with a backing standard (old features are kept for compatibility). So you should push for the JSON API’s standardisation first. See https://discuss.python.org/t/9205 for discussion on this. |
Also, why is it necessary to implement this in pip when a 1-liner using curl and jq like you show gives the results so easily? (For people without curl or jq, a few lines of Python would give something similar). |
@uranusjr Then we wait for the standard. @pfmoore Displaying package description is a common feature of all package managers (not just pacman, but |
I guess that begs the question of whether pip is a "package manager". I've always thought of it as an "installer" rather than a broader tool. But I can see why framing it as a package manager makes sense. |
The reason for this command is that I would like to know what pip would do on an install before I do it. Right now I know of no way to predict the result of
and see at least
so that I have enough information to go away and check that this package is the one that I meant to install. BTW. I would propose "info" as an alias (or even primary name) for this which would match with RedHat's dnf command. For apt, show uses the network. |
To do all of that the only way seems to be making a JSON API call (as I showed above) or visiting the PyPI project page (for example https://pypi.org/project/numpy/#files). If you only care about the dependencies and the checksums / hashes, you could use "pip-tools" by creating a requirements.in file and executing I know this is not the answer @mikedlr or me is looking for, but as a stop gap measure, hope it helps. |
What's the problem this feature will solve?
Now that
pip search
is not working and would be removed in favour ofpip index versions
in #10431 , there is short description is not accessible from the command line. This is an opportunity to re-imagine the command.Describe the solution you'd like
If
numpy
is installed in the environment, the following description is obtained$ pip show numpy Name: numpy Version: 1.21.2 Summary: NumPy is the fundamental package for array computing with Python. Home-page: https://www.numpy.org Author: Travis E. Oliphant et al. Author-email: License: BSD Location: /home/avmo/.pyenv/versions/3.8.9/envs/snek/lib/python3.8/site-packages Requires: Required-by: xarray, pandas, matplotlib, h5py
Say,
numpy
is not installed in the user environment.The user would like to read the documentation, but only knows the name of the package. An output like this would be helpful
Such an output can be populated from the JSON API
Alternative Solutions
Alternatively, simply pretty print the JSON after fetching it.
Right now I use https://github.com/jeffmm/pypi-simple-search/ to mimic the old
pip search
behaviour.Additional context
The inspiration for this command is how
pacman
in ArchLinux works.pacman -Qi <package>
: to query an installed package for informationpacman -Si <package>
: to query the package index for informationCode of Conduct
The text was updated successfully, but these errors were encountered: