MCPcopy Create free account
hub / github.com/AI45Lab/Code / _bootstrap_a3s_code

Function _bootstrap_a3s_code

examples/test_ahp_agent_monitors_agent.py:21–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19
20
21def _bootstrap_a3s_code():
22 try:
23 import a3s_code # noqa: F401
24 return
25 except ImportError:
26 pass
27 examples_dir = Path(__file__).parent
28 sdk_root = examples_dir.parent / "sdk" / "python"
29 for version in ("3.9", "3.10", "3.11", "3.12"):
30 site = sdk_root / ".venv" / "lib" / f"python{version}" / "site-packages"
31 if (site / "a3s_code").exists():
32 sys.path.insert(0, str(site))
33 return
34 raise RuntimeError(
35 "a3s_code 未找到。请先构建:\n"
36 " cd crates/code/sdk/python && maturin develop"
37 )
38
39
40_bootstrap_a3s_code()

Calls 2

existsMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected