Skip to content

Instantly share code, notes, and snippets.

@Behoston
Last active March 1, 2020 17:17
Show Gist options
  • Save Behoston/c9f79b3436f6f759898e48ffdbf03e5e to your computer and use it in GitHub Desktop.
Save Behoston/c9f79b3436f6f759898e48ffdbf03e5e to your computer and use it in GitHub Desktop.
Print out package name and version used when package has no wheel. Code works only with versions equals - I don't care about other cases.
import requests
def check_wheel(package: str, version: str) -> bool:
response = requests.get(f'https://pypi.org/pypi/{package}/json')
for release in response.json()['releases'][version]:
if release['packagetype'] == 'bdist_wheel':
return True
return False
def print_wheels(file):
with open(file) as f:
for line in f:
if line.startswith('#'):
continue
line = line.strip().rsplit('#', 1)[0]
package, version = line.split('==')
wheel = check_wheel(package.strip(), version.strip())
if not wheel:
print(f'{package} {version}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment