-
-
Notifications
You must be signed in to change notification settings - Fork 141
/
Copy pathrun.py
102 lines (74 loc) · 2.41 KB
/
run.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from pathlib import Path
import subprocess
import sys
def mypy_src():
cmd = ["mypy", "pandas-stubs", "tests", "--no-incremental"]
subprocess.run(cmd, check=True)
def pyright_src():
cmd = ["pyright"]
subprocess.run(cmd, check=True)
def pytest():
cmd = ["pytest", "--cache-clear"]
subprocess.run(cmd, check=True)
def style():
cmd = ["pre-commit", "run", "--all-files", "--verbose"]
subprocess.run(cmd, check=True)
def stubtest(allowlist: str = "", check_missing: bool = False):
cmd = [
sys.executable,
"-m",
"mypy.stubtest",
"pandas",
"--concise",
"--mypy-config-file",
"pyproject.toml",
]
if not check_missing:
cmd += ["--ignore-missing-stub"]
if allowlist:
cmd += ["--allowlist", allowlist]
subprocess.run(cmd, check=True)
def build_dist():
cmd = ["poetry", "build", "-f", "wheel"]
subprocess.run(cmd, check=True)
def install_dist():
path = sorted(Path("dist/").glob("pandas_stubs-*.whl"))[-1]
cmd = [sys.executable, "-m", "pip", "install", "--force-reinstall", str(path)]
subprocess.run(cmd, check=True)
def rename_src():
if Path(r"pandas-stubs").exists():
Path(r"pandas-stubs").rename("_pandas-stubs")
else:
raise FileNotFoundError("'pandas-stubs' folder does not exists.")
def mypy_dist():
cmd = ["mypy", "tests", "--no-incremental"]
subprocess.run(cmd, check=True)
def pyright_dist():
cmd = ["pyright", "tests"]
subprocess.run(cmd, check=True)
def uninstall_dist():
cmd = [sys.executable, "-m", "pip", "uninstall", "-y", "pandas-stubs"]
subprocess.run(cmd, check=True)
def restore_src():
if Path(r"_pandas-stubs").exists():
Path(r"_pandas-stubs").rename("pandas-stubs")
else:
raise FileNotFoundError("'_pandas-stubs' folder does not exists.")
def nightly_pandas():
cmd = [sys.executable, "-m", "pip", "uninstall", "-y", "pandas"]
subprocess.run(cmd, check=True)
cmd = [
sys.executable,
"-m",
"pip",
"install",
"-i",
"https://pypi.anaconda.org/scipy-wheels-nightly/simple",
"pandas",
]
subprocess.run(cmd, check=True)
def released_pandas():
cmd = [sys.executable, "-m", "pip", "uninstall", "-y", "pandas"]
subprocess.run(cmd, check=True)
cmd = [sys.executable, "-m", "pip", "install", "pandas"]
subprocess.run(cmd, check=True)