PyPi provides a JSON API to query information about packages. It includes a field with the package's dependencies called info
/requires_dist
.
Sample data (from requests
package):
urllib3 (<1.27,>=1.21.1)
certifi (>=2017.4.17)
chardet (<5,>=3.0.2) ; python_version < "3"
idna (<3,>=2.5) ; python_version < "3"
charset-normalizer (~=2.0.0) ; python_version >= "3"
idna (<4,>=2.5) ; python_version >= "3"
PySocks (!=1.5.7,>=1.5.6) ; extra == 'socks'
win-inet-pton ; (sys_platform == "win32" and python_version == "2.7") and extra == 'socks'
chardet (<5,>=3.0.2) ; extra == 'use_chardet_on_py3'
What is the format of that data? Is there any documentation on it?
And more specifically: What does exactly ~=
mean? And what is set of supported "variables" (like sys_platform
and python_version
)?
The spec is in https://www.python.org/dev/peps/pep-0508/.
An explanation of ~=
is in In requirements.txt, what does tilde equals (~=) mean?.