Open ashwinvis opened 2 years ago
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 apt search
, cargo search
, and so on). I would assume others would like to have that information before they install the package. I don't see the benefit of a third party tool just to query the JSON API.
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 pip install unknown-and-maybe-dodgy-package
except maybe doing pip download
beforehand. What I'd like is to be able to run
pip info unknown-and-maybe-dodgy-package
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.
see at least
* name of package * checksum of package to be installed * url of documentation for package
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 pip-compile --generate-hashes
.
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 obtainedSay,
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