forked from stumpy-dev/stumpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathray_python_version.py
More file actions
executable file
·34 lines (31 loc) · 1003 Bytes
/
ray_python_version.py
File metadata and controls
executable file
·34 lines (31 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
import pandas as pd
from packaging.version import Version
os_map = {"linux": 1, "macos": 2, "windows": 3}
versions = None
for os, table_num in os_map.items():
df = pd.read_html("https://docs.ray.io/en/latest/ray-overview/installation.html")[
table_num
]
mask = df.apply(lambda col: col.astype(str).str.contains("beta")).any(axis=1)
df = df.loc[~mask]
for col in df.columns:
if versions is None:
versions = set(
df[col].astype(str).str.extract(r"(\d+\.\d+)").values.flatten().tolist()
)
else:
versions.intersection(
(
set(
df[col]
.astype(str)
.str.extract(r"(\d+\.\d+)")
.values.flatten()
.tolist()
)
)
)
versions = list(versions)
versions.sort(key=Version)
print(versions[-1])