Upgrade to torch 2, piper 1.3

This commit is contained in:
Michael Hansen 2025-08-29 12:19:25 -05:00
parent 9c1019c932
commit 4057c1a620
7 changed files with 243 additions and 134 deletions

View file

@ -8,6 +8,11 @@ _PROGRAM_DIR = _DIR.parent
_VENV_DIR = _PROGRAM_DIR / ".venv"
_SCRIPT = _PROGRAM_DIR / "generate_samples.py"
context = venv.EnvBuilder().ensure_directories(_VENV_DIR)
subprocess.check_call([context.env_exe, "-m", "black", str(_SCRIPT)])
subprocess.check_call([context.env_exe, "-m", "isort", str(_SCRIPT)])
if _VENV_DIR.exists():
context = venv.EnvBuilder().ensure_directories(_VENV_DIR)
python_exe = context.env_exe
else:
python_exe = "python3"
subprocess.check_call([python_exe, "-m", "black", str(_SCRIPT)])
subprocess.check_call([python_exe, "-m", "isort", str(_SCRIPT)])

View file

@ -8,9 +8,14 @@ _PROGRAM_DIR = _DIR.parent
_VENV_DIR = _PROGRAM_DIR / ".venv"
_SCRIPT = _PROGRAM_DIR / "generate_samples.py"
context = venv.EnvBuilder().ensure_directories(_VENV_DIR)
subprocess.check_call([context.env_exe, "-m", "black", str(_SCRIPT), "--check"])
subprocess.check_call([context.env_exe, "-m", "isort", str(_SCRIPT), "--check"])
subprocess.check_call([context.env_exe, "-m", "flake8", str(_SCRIPT)])
subprocess.check_call([context.env_exe, "-m", "pylint", str(_SCRIPT)])
subprocess.check_call([context.env_exe, "-m", "mypy", str(_SCRIPT)])
if _VENV_DIR.exists():
context = venv.EnvBuilder().ensure_directories(_VENV_DIR)
python_exe = context.env_exe
else:
python_exe = "python3"
subprocess.check_call([python_exe, "-m", "black", str(_SCRIPT), "--check"])
subprocess.check_call([python_exe, "-m", "isort", str(_SCRIPT), "--check"])
subprocess.check_call([python_exe, "-m", "flake8", str(_SCRIPT)])
subprocess.check_call([python_exe, "-m", "pylint", str(_SCRIPT)])
subprocess.check_call([python_exe, "-m", "mypy", str(_SCRIPT)])

View file

@ -8,5 +8,10 @@ _DIR = Path(__file__).parent
_PROGRAM_DIR = _DIR.parent
_VENV_DIR = _PROGRAM_DIR / ".venv"
context = venv.EnvBuilder().ensure_directories(_VENV_DIR)
subprocess.check_call([context.env_exe, "generate_samples.py"] + sys.argv[1:])
if _VENV_DIR.exists():
context = venv.EnvBuilder().ensure_directories(_VENV_DIR)
python_exe = context.env_exe
else:
python_exe = "python3"
subprocess.check_call([python_exe, "generate_samples.py"] + sys.argv[1:])

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python3
import argparse
import subprocess
import venv
from pathlib import Path
@ -7,6 +8,9 @@ _DIR = Path(__file__).parent
_PROGRAM_DIR = _DIR.parent
_VENV_DIR = _PROGRAM_DIR / ".venv"
parser = argparse.ArgumentParser()
parser.add_argument("--dev", action="store_true", help="Install dev requirements")
args = parser.parse_args()
# Create virtual environment
builder = venv.EnvBuilder(with_pip=True)
@ -19,4 +23,10 @@ subprocess.check_call(pip + ["install", "--upgrade", "pip"])
subprocess.check_call(pip + ["install", "--upgrade", "setuptools", "wheel"])
# Install requirements
subprocess.check_call(pip + ["install", "-r", str(_PROGRAM_DIR / "requirements.txt")])
subprocess.check_call(pip + ["install", "-e", str(_PROGRAM_DIR)])
if args.dev:
# Install dev requirements
subprocess.check_call(
pip + ["install", "-e", f"{_PROGRAM_DIR}[dev]"]
)