File tree Expand file tree Collapse file tree 1 file changed +27
-10
lines changed Expand file tree Collapse file tree 1 file changed +27
-10
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22
3- import requests
3+ import pandas as pd
44from packaging .version import Version
55
6- classifiers = (
7- requests .get ("https://pypi.org/pypi/ray/json" ).json ().get ("info" ).get ("classifiers" )
8- )
9-
10- versions = []
11- for c in classifiers :
12- x = c .split ()
13- if "Python" in x :
14- versions .append (x [- 1 ])
6+ os_map = {"linux" : 1 , "macos" : 2 , "windows" : 3 }
7+ versions = None
8+ for os , table_num in os_map .items ():
9+ df = pd .read_html ("https://docs.ray.io/en/latest/ray-overview/installation.html" )[
10+ table_num
11+ ]
12+ mask = df .apply (lambda col : col .astype (str ).str .contains ("beta" )).any (axis = 1 )
13+ df = df .loc [~ mask ]
14+ for col in df .columns :
15+ if versions is None :
16+ versions = set (
17+ df [col ].astype (str ).str .extract (r"(\d+\.\d+)" ).values .flatten ().tolist ()
18+ )
19+ else :
20+ versions .intersection (
21+ (
22+ set (
23+ df [col ]
24+ .astype (str )
25+ .str .extract (r"(\d+\.\d+)" )
26+ .values .flatten ()
27+ .tolist ()
28+ )
29+ )
30+ )
31+ versions = list (versions )
1532
1633versions .sort (key = Version )
1734print (versions [- 1 ])
You can’t perform that action at this time.
0 commit comments