Skip to content

Commit 4a71706

Browse files
committed
Added new function to get latest python compatible with pkg
1 parent f112dde commit 4a71706

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

versions.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,23 @@ def get_latest_scipy_python_version():
241241
"""
242242
Retrieve the latest Python version that is supported by SciPy
243243
"""
244+
python_version = get_latest_pkg_python_version("scipy")
245+
return f"<={python_version}"
246+
247+
248+
def get_latest_pkg_python_version(pkg):
249+
"""
250+
Retrieve the latest Python version that is supported by <pkg>
251+
"""
244252
python_versions = []
245-
response = _get_pypi_json("scipy")
253+
response = _get_pypi_json(pkg)
246254
for classifier in response.get("info").get("classifiers"):
247255
if "Python" in classifier:
248256
match = re.search(r"Python\s+\:\:\s+(\d+\.\d+)", classifier)
249257
if match is not None:
250258
python_versions.append(match.groups()[0])
251259
python_version = sorted(python_versions, key=Version)[-1]
252-
return f"<={python_version}"
260+
return python_version
253261

254262

255263
def _get_pypi_json(pkg):

0 commit comments

Comments
 (0)