perf/pipeline-improvements #2

Merged
jknapp merged 11 commits from perf/pipeline-improvements into main 2026-03-21 05:29:36 +00:00
2 changed files with 16 additions and 11 deletions
Showing only changes of commit 4a4402f71a - Show all commits

View File

@@ -32,13 +32,17 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Create Python toolcache directory (macOS)
if: matrix.platform == 'macos'
run: sudo mkdir -p /Users/runner && sudo chown $USER /Users/runner
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: ${{ env.PYTHON_VERSION }} python-version: ${{ env.PYTHON_VERSION }}
- name: Install Python build tools - name: Install Python build tools
run: pip install --upgrade pip setuptools wheel run: python -m pip install --upgrade pip setuptools wheel
- name: Build sidecar - name: Build sidecar
working-directory: python working-directory: python

View File

@@ -68,32 +68,33 @@ def create_venv_and_install(cpu_only: bool) -> Path:
print(f"[build] Creating venv at {venv_dir}") print(f"[build] Creating venv at {venv_dir}")
subprocess.run([sys.executable, "-m", "venv", str(venv_dir)], check=True) subprocess.run([sys.executable, "-m", "venv", str(venv_dir)], check=True)
# Determine pip and python paths inside venv # Determine python path inside venv — use `python -m pip` instead of
# calling pip directly to avoid permission errors on Windows
if sys.platform == "win32": if sys.platform == "win32":
pip = str(venv_dir / "Scripts" / "pip")
python = str(venv_dir / "Scripts" / "python") python = str(venv_dir / "Scripts" / "python")
else: else:
pip = str(venv_dir / "bin" / "pip")
python = str(venv_dir / "bin" / "python") python = str(venv_dir / "bin" / "python")
def pip_install(*args: str) -> None:
subprocess.run([python, "-m", "pip", *args], check=True)
# Upgrade pip # Upgrade pip
subprocess.run([pip, "install", "--upgrade", "pip"], check=True) pip_install("install", "--upgrade", "pip", "setuptools", "wheel")
# Install torch (CPU-only to avoid bundling ~2GB of CUDA libs) # Install torch (CPU-only to avoid bundling ~2GB of CUDA libs)
if cpu_only: if cpu_only:
print("[build] Installing PyTorch (CPU-only)") print("[build] Installing PyTorch (CPU-only)")
subprocess.run( pip_install(
[pip, "install", "torch", "torchaudio", "install", "torch", "torchaudio",
"--index-url", "https://download.pytorch.org/whl/cpu"], "--index-url", "https://download.pytorch.org/whl/cpu",
check=True,
) )
else: else:
print("[build] Installing PyTorch (default, may include CUDA)") print("[build] Installing PyTorch (default, may include CUDA)")
subprocess.run([pip, "install", "torch", "torchaudio"], check=True) pip_install("install", "torch", "torchaudio")
# Install project and dev deps (includes pyinstaller) # Install project and dev deps (includes pyinstaller)
print("[build] Installing project dependencies") print("[build] Installing project dependencies")
subprocess.run([pip, "install", "-e", f"{SCRIPT_DIR}[dev]"], check=True) pip_install("install", "-e", f"{SCRIPT_DIR}[dev]")
return Path(python) return Path(python)