From ccb70239656b072114912ae718c3765c786a71fe Mon Sep 17 00:00:00 2001 From: emil User Date: Fri, 7 Aug 2026 21:01:06 +0000 Subject: [PATCH] DEVX-151: perf: skip dep resolution in setup-image with --no-deps --- Makefile | 2 +- pyproject.toml | 9 +++++++-- src/devx/tools/setup_image.py | 4 +++- tests/unit/test_setup_image.py | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 85ad96c..8be8422 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,7 @@ setup-release: $(VENV)/bin/activate .env # an older devx.mak that doesn't yet define devx-setup-image. Consumer repos # (grm, infra) can safely alias to devx-setup-image since they install devx from PyPI. setup-image: - @if [ -d /opt/venv ]; then ln -sf /opt/venv $(VENV); . $(VENV)/bin/activate && pip install --no-cache-dir -e . 2>/dev/null; \ + @if [ -d /opt/venv ]; then ln -sf /opt/venv $(VENV); . $(VENV)/bin/activate && pip install --no-cache-dir --no-deps -e . 2>/dev/null; \ else echo "[setup-image] /opt/venv not found — falling back to setup-ci"; $(MAKE) setup-ci; fi install-hooks: diff --git a/pyproject.toml b/pyproject.toml index aba82c6..3ad7e25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,11 +64,16 @@ molecule = [ "ansible-core==2.21.1", ] # Deploy tools (for infra staging/production deployments) +# Versions aligned with infra's pyproject.toml to avoid reinstalls on every CI job. +# bcrypt and PyJWT are infra deps not in devx core — included here so the CI +# image has them and setup-image can use --no-deps (skip dep resolution). deploy = [ "ansible-core==2.21.1", - "boto3==1.43.37", + "boto3==1.43.44", "docker==7.1.0", - "cryptography==49.0.0", + "cryptography==50.0.0", + "bcrypt==5.0.0", + "PyJWT==2.13.0", ] # Full dev environment (local development) dev = [ diff --git a/src/devx/tools/setup_image.py b/src/devx/tools/setup_image.py index c208d38..805c8a0 100644 --- a/src/devx/tools/setup_image.py +++ b/src/devx/tools/setup_image.py @@ -64,9 +64,11 @@ def _install_in_image( link.symlink_to(opt_venv) # Build pip install command + # --no-deps: the CI image already has all dependencies pre-installed. + # We only need to install the project itself in editable mode. spec = f".[{extras}]" if extras else "." pip_bin = str(Path(venv_link) / "bin" / "pip") - cmd = [pip_bin, "install", "--no-cache-dir", "-e", spec] + cmd = [pip_bin, "install", "--no-cache-dir", "--no-deps", "-e", spec] env = os.environ.copy() try: diff --git a/tests/unit/test_setup_image.py b/tests/unit/test_setup_image.py index 213c692..d829dd2 100644 --- a/tests/unit/test_setup_image.py +++ b/tests/unit/test_setup_image.py @@ -52,6 +52,7 @@ class TestInstallInImage: mock_run.assert_called_once() cmd = mock_run.call_args[0][0] assert "--no-cache-dir" in cmd + assert "--no-deps" in cmd assert "-e" in cmd assert "." in cmd # No extras → spec is "."