File size: 1,304 Bytes
96695f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# FILE: setup_checks.py
import sys
import subprocess
import importlib
import os

print("=== Setup Checks ===")

# Python version
if sys.version_info < (3, 10):
    print(f"[ERROR] Python >= 3.10 required, found {sys.version}")
    sys.exit(1)
print(f"[OK] Python version: {sys.version}")

# Check installed packages
with open("requirements.txt") as f:
    for line in f:
        pkg = line.strip().split("==")[0]
        try:
            importlib.import_module(pkg)
            print(f"[OK] Package '{pkg}' installed")
        except ImportError:
            print(f"[ERROR] Package '{pkg}' missing. Run: pip install -r requirements.txt")
            sys.exit(1)

# Static analysis (flake8 optional)
try:
    subprocess.run(["flake8", "app.py"], check=False)
except Exception:
    print("[WARNING] flake8 not installed, skipping static analysis.")

# Smoke test
try:
    import app
    state = app.reset_state()
    chat_history, state, _ = app.on_user_message("Привет!", state)
    if not chat_history or not isinstance(chat_history, list):
        print("[ERROR] Smoke test failed: chat_history empty or invalid")
        sys.exit(1)
    print("[OK] Smoke test passed")
except Exception as e:
    print(f"[ERROR] Smoke test failed: {e}")
    sys.exit(1)

print("=== Setup Checks Completed ===")