mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-19 20:05:00 +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.specifiers import SpecifierSet
|
||||
|
||||
|
||||
def get_versions_supporting_python38_or_lower(package_name):
|
||||
url = f"https://pypi.org/pypi/{package_name}/json"
|
||||
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")
|
||||
|
||||
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:
|
||||
try:
|
||||
spec = SpecifierSet(requires_python)
|
||||
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:
|
||||
print(f"Invalid requires_python specifier for version {release}: {requires_python}")
|
||||
|
||||
return compatible_versions
|
||||
|
||||
|
||||
def main():
|
||||
package_name = "aider-chat" # Replace with your 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:")
|
||||
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}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue