mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 12:24:59 +00:00
style: Run linter on Python script
This commit is contained in:
parent
c2a35fef05
commit
3e594877d7
1 changed files with 12 additions and 3 deletions
|
@ -2,6 +2,7 @@ import requests
|
||||||
from packaging import version
|
from packaging import version
|
||||||
from packaging.specifiers import SpecifierSet
|
from packaging.specifiers import SpecifierSet
|
||||||
|
|
||||||
|
|
||||||
def get_versions_supporting_python38_or_lower(package_name):
|
def get_versions_supporting_python38_or_lower(package_name):
|
||||||
url = f"https://pypi.org/pypi/{package_name}/json"
|
url = f"https://pypi.org/pypi/{package_name}/json"
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
|
@ -19,24 +20,32 @@ def get_versions_supporting_python38_or_lower(package_name):
|
||||||
requires_python = release_data[0].get("requires_python")
|
requires_python = release_data[0].get("requires_python")
|
||||||
|
|
||||||
if requires_python is None:
|
if requires_python is None:
|
||||||
compatible_versions[release] = "Unspecified (assumed compatible with Python 3.8 and lower)"
|
compatible_versions[release] = (
|
||||||
|
"Unspecified (assumed compatible with Python 3.8 and lower)"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
spec = SpecifierSet(requires_python)
|
spec = SpecifierSet(requires_python)
|
||||||
if version.parse("3.8") in spec:
|
if version.parse("3.8") in spec:
|
||||||
compatible_versions[release] = f"Compatible with Python 3.8 (spec: {requires_python})"
|
compatible_versions[release] = (
|
||||||
|
f"Compatible with Python 3.8 (spec: {requires_python})"
|
||||||
|
)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print(f"Invalid requires_python specifier for version {release}: {requires_python}")
|
print(f"Invalid requires_python specifier for version {release}: {requires_python}")
|
||||||
|
|
||||||
return compatible_versions
|
return compatible_versions
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
package_name = "aider-chat" # Replace with your package name
|
package_name = "aider-chat" # Replace with your package name
|
||||||
compatible_versions = get_versions_supporting_python38_or_lower(package_name)
|
compatible_versions = get_versions_supporting_python38_or_lower(package_name)
|
||||||
|
|
||||||
print(f"Versions of {package_name} compatible with Python 3.8 or lower:")
|
print(f"Versions of {package_name} compatible with Python 3.8 or lower:")
|
||||||
for release, support in sorted(compatible_versions.items(), key=lambda x: version.parse(x[0]), reverse=True):
|
for release, support in sorted(
|
||||||
|
compatible_versions.items(), key=lambda x: version.parse(x[0]), reverse=True
|
||||||
|
):
|
||||||
print(f"{release}: {support}")
|
print(f"{release}: {support}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue