Spaces:
Running on Zero
Running on Zero
Download scripts/export_requirements.py from ronedgecomb/VRMBG-3.0: direct link, hf CLI and curl.
- Browser
- Download file 1.85 kB
-
https://huggingface.co/spaces/ronedgecomb/VRMBG-3.0/resolve/main/scripts/export_requirements.py
- Command line
-
hf download hf://spaces/ronedgecomb/VRMBG-3.0/scripts/export_requirements.py
-
curl -L -o export_requirements.py https://huggingface.co/spaces/ronedgecomb/VRMBG-3.0/resolve/main/scripts/export_requirements.py
1.85 kB
| """Export locked dependencies for the Linux/Python 3.12 HF Spaces runtime.""" | |
| import argparse | |
| from pathlib import Path | |
| import subprocess | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def export_requirements() -> str: | |
| locked = subprocess.run( | |
| [ | |
| "uv", | |
| "export", | |
| "--locked", | |
| "--no-dev", | |
| "--no-hashes", | |
| "--no-emit-project", | |
| "--no-annotate", | |
| "--no-header", | |
| ], | |
| cwd=ROOT, | |
| check=True, | |
| text=True, | |
| stdout=subprocess.PIPE, | |
| ).stdout | |
| # The lock already contains the full graph. Only select the target platform; | |
| # do not expand dependencies or carry Windows CUDA pins into ZeroGPU config. | |
| return subprocess.run( | |
| [ | |
| "uv", | |
| "pip", | |
| "compile", | |
| "-", | |
| "--no-deps", | |
| "--python-platform=x86_64-unknown-linux-gnu", | |
| "--python-version=3.12", | |
| "--only-binary=:all:", | |
| "--no-annotate", | |
| "--custom-compile-command=uv run --locked python scripts/export_requirements.py", | |
| ], | |
| cwd=ROOT, | |
| input=locked, | |
| check=True, | |
| text=True, | |
| stdout=subprocess.PIPE, | |
| ).stdout | |
| if __name__ == "__main__": | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--check", action="store_true", help="Check without writing") | |
| args = parser.parse_args() | |
| requirements = export_requirements() | |
| destination = ROOT / "requirements.txt" | |
| if args.check: | |
| if destination.read_text(encoding="utf-8") != requirements: | |
| parser.exit( | |
| 1, "requirements.txt is stale; run scripts/export_requirements.py\n" | |
| ) | |
| else: | |
| destination.write_text(requirements, encoding="utf-8", newline="\n") | |