Last active
March 1, 2020 17:17
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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