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

programmatically convenient output of pip index versions #10983

Open
1 task done
C-nit opened this issue Mar 23, 2022 · 3 comments
Open
1 task done

programmatically convenient output of pip index versions #10983

C-nit opened this issue Mar 23, 2022 · 3 comments
Labels
S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature

Comments

@C-nit
Copy link

C-nit commented Mar 23, 2022

What's the problem this feature will solve?

pip index versions is an experimental command that scratches the itch to check latest and available versions from index servers.

The output is clearly readable for humans but inconvenient to parse programmatically.

The two questions I think someone might want to query are:

  • is a specific version equal to the latest version?
  • is a specific version available?

To answer these, one has to resort to parsing the current output, and that depends on current formatting of the output.

Describe the solution you'd like

There should be at least an option/flag to provide the output in a machine readable format. For example as json that one could conveniently parse with jq.

Alternatively there could be other subcommands to pip index that answer the two questions I noted directly.

Alternative Solutions

is PACKAGE_VERSION in available versions?

echo "$index_versions_output, " | grep -q "${PACKAGE_VERSION}, "

get latest version

echo ${index_versions_output} | grep -o "${package_name} \(.*\)" | sed -E -n "s/.*\((.*)\).*$/\1/p"

Additional context

Code of Conduct

@C-nit C-nit added S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature labels Mar 23, 2022
@YarivFishman1
Copy link

YarivFishman1 commented Mar 25, 2022

Hey!

I just opened a PR(#10985) which adds a new flag to the command that prints only the latest version of a given package without the need of parsing the output with commands like awk.

@Archmonger
Copy link

Archmonger commented May 6, 2023

Agreed that a formatted output would be nice. Am currently trying to programmatically use pip index versions, and it is slightly inconvenient to parse via regex.

@sigma67 sigma67 mentioned this issue Oct 12, 2023
1 task
@Jgfrausing
Copy link

Aside from regex being inconvenient, it also sucks to have to do on an experimental feature.
Can we consider reopening #10985 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

4 participants