badges / shields

Concise, consistent, and legible badges in SVG and raster format
https://shields.io
Creative Commons Zero v1.0 Universal
22.98k stars 5.47k forks source link

generalize py-pi-versions-from-framework-classifiers? #10248

Open 1ucian0 opened 3 weeks ago

1ucian0 commented 3 weeks ago

:clipboard: Description

Would it be possible to query requires_dist in https://pypi.python.org/pypi/<pkg>/json (or https://www.wheelodex.org/json/projects/%3Cpkg%3E or similar) to create a badge with the version of a particular dependency?

Some sort of generic py-pi-versions-from-framework-classifiers

For example: https://img.shields.io/pypi/dependency_versions/qiskit/numpy generate numpy compatibility based on query https://pypi.org/pypi/qiskit/json

chris48s commented 2 weeks ago

PyPI dependency version is a reasonable request. We have this for some other package registries.

One thing that makes this a bit challenging in python is that whereas with npm for example, the dependencies are expressed as an object mapping package names to versions e.g:

{
  "glob": "^10.4.1",
  "global-agent": "^3.0.0",
  "got": "^14.4.1",
  "graphql": "16.8.2"
}

This makes it easy to take a package and return a version range.

With PyPI, requires_dist is an array of strings expressing a package constraint (which may or may not include a version, and may include a bunch of other stuff) e.g:

[
  "python-dateutil>=2.8.0",
  "qiskit[crosstalk-pass,csp-layout-pass,qasm3-import,visualization]; extra == \"all\"",      
  "typing-extensions",
  "importlib-metadata>=4.6; python_version < '3.10'",
  "isort==5.13.2 ; extra == \"dev\""
]

That requires a bit more work to parse correctly.