-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathscripts.py
More file actions
97 lines (70 loc) · 2.53 KB
/
Copy pathscripts.py
File metadata and controls
97 lines (70 loc) · 2.53 KB
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
import subprocess
import sys
def format():
subprocess.run(["isort", "./langgraph", "./tests/", "--profile", "black"], check=True)
subprocess.run(["black", "./langgraph", "./tests/"], check=True)
def check_format():
subprocess.run(["black", "--check", "./langgraph"], check=True)
def sort_imports():
subprocess.run(["isort", "./langgraph", "./tests/", "--profile", "black"], check=True)
def check_sort_imports():
subprocess.run(
["isort", "./langgraph", "--check-only", "--profile", "black"], check=True
)
def check_lint():
subprocess.run(["pylint", "--rcfile=.pylintrc", "./langgraph"], check=True)
def check_mypy():
subprocess.run(["python", "-m", "mypy", "./langgraph"], check=True)
def test():
test_cmd = ["python", "-m", "pytest", "--log-level=CRITICAL"]
# Get any extra arguments passed to the script
extra_args = sys.argv[1:]
if extra_args:
test_cmd.extend(extra_args)
subprocess.run(test_cmd, check=True)
def test_verbose():
test_cmd = ["python", "-m", "pytest", "-vv", "-s", "--log-level=CRITICAL"]
# Get any extra arguments passed to the script
extra_args = sys.argv[1:]
if extra_args:
test_cmd.extend(extra_args)
subprocess.run(test_cmd, check=True)
def test_coverage():
"""Run tests with coverage reporting."""
test_cmd = [
"python", "-m", "pytest",
"--cov=langgraph",
"--cov-report=html",
"--cov-report=term-missing",
"--cov-report=xml",
"--log-level=CRITICAL"
]
# Get any extra arguments passed to the script
extra_args = sys.argv[1:]
if extra_args:
test_cmd.extend(extra_args)
subprocess.run(test_cmd, check=True)
def coverage_report():
"""Generate coverage report without running tests."""
subprocess.run(["python", "-m", "coverage", "report"], check=True)
def coverage_html():
"""Generate HTML coverage report."""
subprocess.run(["python", "-m", "coverage", "html"], check=True)
print("Coverage HTML report generated in htmlcov/")
def find_dead_code():
"""Find dead code using vulture."""
result = subprocess.run(
["python", "-m", "vulture", "langgraph", "--sort-by-size"],
capture_output=True,
text=True
)
if result.stdout:
print("Dead code found:")
print(result.stdout)
else:
print("No dead code found!")
if result.stderr:
print("Errors:")
print(result.stderr)
# Don't fail the build for dead code detection, just report
return result.returncode