Skip to content

Commit 4de031a

Browse files
committed
Refactored function to identify latest NumPy version
1 parent e107581 commit 4de031a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

versions.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,9 @@ def get_latest_numpy_version():
224224
"""
225225
Retrieve the latest NumPy version
226226
"""
227-
url = "https://pypi.org/project/numpy/"
228-
req = request.Request(url, data=None, headers=HEADERS)
229-
html = request.urlopen(req).read().decode("utf-8")
230-
match = re.search(r"numpy (\d+\.\d+\.\d+)", html, re.DOTALL)
231-
return match.groups()[0]
227+
url = f'https://pypi.python.org/pypi/numpy/json'
228+
releases = json.loads(request.urlopen(url).read())['releases']
229+
return list(releases.keys())[-1]
232230

233231

234232
def check_python_version(row):

0 commit comments

Comments
 (0)