From 7ed2546e3be7ab72ad5ebaafb1546fe5e5f09eb9 Mon Sep 17 00:00:00 2001 From: Laurent Sorber Date: Wed, 19 Aug 2026 10:10:51 +0200 Subject: [PATCH] perf: avoid redundant setup on Dev Container restarts --- .devcontainer/devcontainer.json | 5 +++-- template/.devcontainer/devcontainer.json.jinja | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7bbfd5c3..fe621d17 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -16,7 +16,8 @@ "UV_PROJECT_ENVIRONMENT": "/opt/venv" }, "onCreateCommand": "echo 'eval \"$(starship init bash)\"' >> ~/.bashrc", - "postCreateCommand": "uv sync && pre-commit install --install-hooks", + "updateContentCommand": "uv sync", + "postCreateCommand": "pre-commit install --install-hooks", "customizations": { "vscode": { "extensions": [ @@ -70,4 +71,4 @@ } } } -} \ No newline at end of file +} diff --git a/template/.devcontainer/devcontainer.json.jinja b/template/.devcontainer/devcontainer.json.jinja index c6445e02..db9afd5e 100644 --- a/template/.devcontainer/devcontainer.json.jinja +++ b/template/.devcontainer/devcontainer.json.jinja @@ -15,7 +15,9 @@ }, "overrideCommand": true, "remoteUser": "user", - "postStartCommand": "sudo chown -R user:user /opt/ && uv sync --python ${localEnv:PYTHON_VERSION:{{ python_version }}} {% if project_type == 'package' %}--resolution ${localEnv:RESOLUTION_STRATEGY:highest} {% endif %}--all-extras && pre-commit install --install-hooks", + "onCreateCommand": "sudo chown -R user:user /opt/", + "updateContentCommand": "uv sync --python ${localEnv:PYTHON_VERSION:{{ python_version }}} {% if project_type == 'package' %}--resolution ${localEnv:RESOLUTION_STRATEGY:highest} {% endif %}--all-extras", + "postCreateCommand": "pre-commit install --install-hooks", "customizations": { "jetbrains": { "backend": "PyCharm", @@ -79,4 +81,4 @@ } } } -} \ No newline at end of file +}