Download scripts/verify_wheel.py from guicybercode/br-sovereign-llm-research: direct link, hf CLI and curl.
- Browser
- Download file 2.15 kB
-
https://huggingface.co/guicybercode/br-sovereign-llm-research/resolve/main/scripts/verify_wheel.py
- Command line
-
hf download hf://guicybercode/br-sovereign-llm-research/scripts/verify_wheel.py
-
curl -L -o verify_wheel.py https://huggingface.co/guicybercode/br-sovereign-llm-research/resolve/main/scripts/verify_wheel.py
2.15 kB
| #!/usr/bin/env python3 | |
| """Install the built wheel in a clean environment and run the public CLI.""" | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import subprocess | |
| import sys | |
| import tempfile | |
| from pathlib import Path | |
| def main() -> int: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--project-root", type=Path, default=Path.cwd()) | |
| parser.add_argument("--dist", type=Path, default=Path("dist")) | |
| arguments = parser.parse_args() | |
| project_root = arguments.project_root.resolve(strict=True) | |
| wheels = sorted(arguments.dist.resolve(strict=True).glob("*.whl")) | |
| if len(wheels) != 1: | |
| raise RuntimeError(f"expected one wheel, found {len(wheels)}") | |
| with tempfile.TemporaryDirectory(prefix="brslm-wheel-check-") as temporary: | |
| environment = Path(temporary) / "venv" | |
| subprocess.run( | |
| [sys.executable, "-m", "venv", str(environment)], | |
| check=True, | |
| ) | |
| executable_directory = "Scripts" if sys.platform == "win32" else "bin" | |
| python = environment / executable_directory / "python" | |
| command = environment / executable_directory / "br-sovereign-llm" | |
| subprocess.run( | |
| [str(python), "-m", "pip", "install", str(wheels[0])], | |
| check=True, | |
| capture_output=True, | |
| text=True, | |
| ) | |
| completed = subprocess.run( | |
| [ | |
| str(command), | |
| "--project-root", | |
| str(project_root), | |
| "validate-project", | |
| ], | |
| check=True, | |
| capture_output=True, | |
| text=True, | |
| ) | |
| payload = json.loads(completed.stdout) | |
| if payload.get("ok") is not True: | |
| raise RuntimeError("installed wheel validation did not report success") | |
| print( | |
| json.dumps( | |
| { | |
| "ok": True, | |
| "wheel": wheels[0].name, | |
| "configuration_count": payload["configurations"]["configuration_count"], | |
| }, | |
| indent=2, | |
| sort_keys=True, | |
| ) | |
| ) | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |