pypi-command-line icon indicating copy to clipboard operation
pypi-command-line copied to clipboard

[Feature Request] JSON output

Open ryan-williams opened this issue 7 months ago • 1 comments

Describe the solution you'd like.

pypi [--json] wheels <package> <version>
# or
pypi wheels [--json <field,...>] <package> <version>

I'm trying to estimate the total size of all wheels in a testpypi release (it's one of the q's on the quota-increase request template).

Describe alternatives you've considered if there are any.

I see in the README you mention qypi has JSON output, but this tool's latest release is a couple years more recent, and it has other nice ergonomics, so adding JSON output here would be great.

Additional context if applicable

Here's my current "one-liner":

pypi --repository testpypi wheels tiledbsoma 1.15.0rc0.post386.dev1013776864 \
| perl -ne 'print "$1$2\n" while /Size: ([\d.]+) ([KM])iB/g' \
| numfmt --from=iec \
| jq -n '[inputs]|add' \
| numfmt --to=iec
# 438M

Edit: previous version didn't account for multiple columns of output:

Example

Image

ryan-williams avatar Apr 03 '25 19:04 ryan-williams

Since this project relies on the pypi json api wouldn't using the api directly be a better option rather than using the cli to get a json output? How the cli works is that it gets the json data from the pypi api and simply formats it for the terminal. if the cli gave out json output then I think it would just add an unnecessary middle man to your program and it would be better to just use the api directly instead

wasi-master avatar Apr 13 '25 10:04 wasi-master