@@ -230,6 +230,29 @@ def get_minor_versions_between(start_version_str, end_version_str):
230230 return versions
231231
232232
233+ def _get_scipy_pypi ():
234+ url = "https://pypi.org/project/scipy/"
235+ req = request .Request (
236+ url ,
237+ data = None ,
238+ headers = HEADERS
239+ )
240+ return request .urlopen (req ).read ().decode ("utf-8" )
241+
242+
243+ def get_latest_scipy_version ():
244+ html = _get_scipy_pypi ()
245+ match = re .search (r'scipy\s+(\d+\.\d+\.\d+)' , html , re .DOTALL )
246+ return match .groups ()[0 ]
247+
248+
249+ def get_latest_scipy_python_version ():
250+ html = _get_scipy_pypi ()
251+ python_versions = list (set (re .findall (r'Python\s+\:\:\s+(\d+\.\d+)' , html , re .DOTALL )))
252+ python_version = sorted (python_versions , key = Version )[- 1 ]
253+ return f"<={ python_version } "
254+
255+
233256def get_latest_numpy_version ():
234257 """
235258 Retrieve the latest NumPy version
@@ -317,8 +340,8 @@ def get_all_max_versions():
317340 )
318341 )
319342 .assign (NUMPY = lambda row : row .apply (check_numpy_version , axis = 1 ))
320- .assign (SCIPY = get_scipy_version_df (). iloc [ 0 ]. SciPy_version )
321- .assign (SCIPY_PYTHON_SPEC = get_scipy_version_df (). iloc [ 0 ]. Python_versions )
343+ .assign (SCIPY = get_latest_scipy_version () )
344+ .assign (SCIPY_PYTHON_SPEC = get_latest_scipy_python_version () )
322345 .pipe (
323346 lambda df : df .assign (
324347 SCIPY_PYTHON_SPEC = df .SCIPY_PYTHON_SPEC .apply (SpecifierSet )
0 commit comments