From 4262cf83ac635a09db6b7ea94c54e9f08ba96502 Mon Sep 17 00:00:00 2001 From: otaj <6065855+otaj@users.noreply.github.com> Date: Fri, 16 Sep 2022 15:26:04 +0200 Subject: [PATCH] Use valid pypi versions for install in assistant (#14750) Co-authored-by: Kushashwa Ravi Shrimali --- .actions/assistant.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.actions/assistant.py b/.actions/assistant.py index 85a1b5879e..38c3d8cebd 100644 --- a/.actions/assistant.py +++ b/.actions/assistant.py @@ -1,7 +1,6 @@ import datetime import glob import json -import logging import os import re import shutil @@ -17,7 +16,6 @@ from urllib.request import Request, urlopen import fire import pkg_resources -from packaging.version import parse as version_parse REQUIREMENT_FILES = { "pytorch": ( @@ -124,10 +122,8 @@ class AssistantCLI: url = f"https://pypi.org/pypi/{PACKAGE_MAPPING[package]}/json" data = json.load(urlopen(Request(url))) if not version: - versions = list(data["releases"].keys()) - versions = sorted(versions, key=lambda x: version_parse(x)) - logging.debug(f"Available versions: {versions}") - version = versions[-1] + pypi_vers = pypi_versions(PACKAGE_MAPPING[package]) + version = pypi_vers[-1] releases = list(filter(lambda r: r["packagetype"] == "sdist", data["releases"][version])) assert releases, f"Missing 'sdist' for this package/version aka {package}/{version}" release = releases[0]