diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ac60286b24..3e50430439 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -54,11 +54,12 @@ RUN groupadd $USERNAME \ && useradd -g $USERNAME -m $USERNAME \ && echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers -# Create venv using uv -RUN uv venv /opt/venv --python 3.11 \ - && chown -R vscode:vscode /opt/venv \ - && ls -la /opt/venv/bin/activate -ENV PATH="/opt/venv/bin:$PATH" +# Remove any existing venv and create fresh uv venv +RUN rm -rf /opt/pyrit-dev \ + && uv venv /opt/pyrit-dev --python 3.11 \ + && chown -R vscode:vscode /opt/pyrit-dev \ + && ls -la /opt/pyrit-dev/bin/activate +ENV PATH="/opt/pyrit-dev/bin:$PATH" # Pre-create common user caches and fix permissions RUN mkdir -p /home/vscode/.cache/pre-commit \ @@ -74,8 +75,8 @@ RUN mkdir -p /home/vscode/.cache/pre-commit \ USER vscode # Create bash configuration files and activate the venv in bash sessions RUN touch /home/vscode/.bashrc /home/vscode/.bash_profile \ - && echo "[ -f /opt/venv/bin/activate ] && source /opt/venv/bin/activate" >> /home/vscode/.bashrc \ - && echo "[ -f /opt/venv/bin/activate ] && source /opt/venv/bin/activate" >> /home/vscode/.bash_profile + && echo "[ -f /opt/pyrit-dev/bin/activate ] && source /opt/pyrit-dev/bin/activate" >> /home/vscode/.bashrc \ + && echo "[ -f /opt/pyrit-dev/bin/activate ] && source /opt/pyrit-dev/bin/activate" >> /home/vscode/.bash_profile # Configure Git for better performance with bind mounts RUN git config --global core.preloadindex true \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6a827e3434..ee8731042f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -11,7 +11,8 @@ "customizations": { "vscode": { "settings": { - "python.defaultInterpreterPath": "/opt/venv/bin/python", + "terminal.integrated.defaultProfile.linux": "bash", + "python.defaultInterpreterPath": "/opt/pyrit-dev/bin/python", "python.analysis.extraPaths": [ "/workspace" ], @@ -32,7 +33,7 @@ "pyrit/**" ], "python.analysis.exclude": [ - "/opt/venv/**", + "/opt/pyrit-dev/**", "**/.venv/**", "**/site-packages/**", "**/doc/**", diff --git a/.devcontainer/devcontainer_setup.sh b/.devcontainer/devcontainer_setup.sh index d5d7275238..6259d7e3fc 100644 --- a/.devcontainer/devcontainer_setup.sh +++ b/.devcontainer/devcontainer_setup.sh @@ -38,8 +38,8 @@ if [ -f "$HASH_FILE" ]; then chmod 666 "$HASH_FILE" fi -uv venv /opt/venv --python 3.11 \ - && . /opt/venv/bin/activate +# Activate the uv venv created in the Dockerfile +source /opt/pyrit-dev/bin/activate # Compute current hash CURRENT_HASH=$(sha256sum /workspace/pyproject.toml | awk '{print $1}') diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 58719dbcfb..f1337fc494 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -11,7 +11,6 @@ services: memory: "16G" volumes: - ..:/workspace:delegated - - pyrit-env:/opt/venv:cached - pip-cache:/home/vscode/.cache/pip:cached - uv-cache:/home/vscode/.cache/uv:cached - precommit-cache:/home/vscode/.cache/pre-commit:cached @@ -24,7 +23,6 @@ services: command: "sleep infinity" volumes: - pyrit-env: pip-cache: uv-cache: precommit-cache: