pydantic-zod-codegen 1.0.0
Imports subprocess modulesys.path mutation (alters module search path)
SHA-2566c1432b3fe4d5b254d893434cc05f086e1fe32ee1bd402ba009ccb9f1185cede
MaleculeO(C₂)H₂(OsPo₂)Md(Pt)
Evidence
27import json
28import shutil
29import subprocess
30import tempfile
31from pathlib import Path
32from typing import Any
57 if shutil.which("bunx") is None:
58 raise RuntimeError(
59 "bunx not found on PATH. Install bun via `brew install bun` or `curl -fsSL https://bun.sh/install | bash`."
60 )
66 with tempfile.TemporaryDirectory() as tmp:
67 in_path = Path(tmp) / "schema.json"
68 in_path.write_text(json.dumps(payload), encoding="utf-8")
69 try:
70 result = subprocess.run(
71 [
72 "bunx",
85 if result.returncode != 0:
86 raise RuntimeError(f"bunx json2ts failed (returncode={result.returncode}): {result.stderr.strip()}")
87 return result.stdout
92 # `ModuleNotFoundError`. Prepending cwd is the KISS equivalent of running the
93 # CLI under `python -m`.
94 cwd = os.getcwd()
95 if cwd not in sys.path:
96 sys.path.insert(0, cwd)
No evidence locations were recorded for this file. Raw result