Check if wheel exists on pypi befor installing build dependencies

I have a CI job that builds my project for many architectures. In this process I install pygit2 with pip which depends on libgit2. In some cases the pip installs the wheel from pypi and no other build dependencies are required. But, for some architectures no wheel exists so pygit2‘s setup is executed, which requires the libgit2 sources on the system. In this case I have to compile libgit2 from the sources. As this is a resource intense process, I would like to perform it only for the case, that no wheel exists for the specific architecture.

How do I check (maybe with pip) if a wheel exists for the currently used system/architecture exists on pypi.


Look into the following pip install and/or pip download options:

Maybe something like the following could come close enough to a reliable way to check if a wheel is available or not (either check the exit code or check if a wheel has actually been downloaded):

pip download --no-deps --only-binary :all: pygit2