|
7 | 7 | }, |
8 | 8 | "remoteEnv": { |
9 | 9 | // Allow X11 apps to run inside the container |
10 | | - "DISPLAY": "${localEnv:DISPLAY}" |
| 10 | + "DISPLAY": "${localEnv:DISPLAY}", |
| 11 | + // Do the equivalent of "activate" the venv so we don't have to "uv run" everything |
| 12 | + "PATH": "/workspaces/${localWorkspaceFolderBasename}/.venv/bin:${containerEnv:PATH}" |
11 | 13 | }, |
12 | 14 | "customizations": { |
13 | 15 | "vscode": { |
14 | 16 | // Set *default* container specific settings.json values on container create. |
15 | 17 | "settings": { |
16 | | - "python.defaultInterpreterPath": "/venv/bin/python" |
| 18 | + "python.defaultInterpreterPath": "/workspaces/${localWorkspaceFolderBasename}/.venv/bin/python", |
| 19 | + "python.terminal.activateEnvInCurrentTerminal": false, |
| 20 | + "python.terminal.activateEnvironment": false, |
| 21 | + "remote.autoForwardPorts": false |
17 | 22 | }, |
18 | 23 | // Add the IDs of extensions you want installed when the container is created. |
19 | 24 | "extensions": [ |
|
27 | 32 | ] |
28 | 33 | } |
29 | 34 | }, |
30 | | - "features": { |
31 | | - // add in eternal history and other bash features |
32 | | - "ghcr.io/diamondlightsource/devcontainer-features/bash-config:1": {} |
33 | | - }, |
34 | | - // Create the config folder for the bash-config feature |
35 | | - "initializeCommand": "mkdir -p ${localEnv:HOME}/.config/bash-config", |
| 35 | + // Create the config folder for the bash-config feature and uv cache |
| 36 | + "initializeCommand": "mkdir -p ${localEnv:HOME}/.config/terminal-config ${localEnv:HOME}/.cache/uv", |
36 | 37 | "runArgs": [ |
37 | 38 | // Allow the container to access the host X11 display and EPICS CA |
38 | 39 | "--net=host", |
39 | 40 | // Make sure SELinux does not disable with access to host filesystems like tmp |
40 | 41 | "--security-opt=label=disable" |
41 | 42 | ], |
| 43 | + "mounts": [ |
| 44 | + // Mount in the user terminal config folder so it can be edited |
| 45 | + { |
| 46 | + "source": "${localEnv:HOME}/.config/terminal-config", |
| 47 | + "target": "/user-terminal-config", |
| 48 | + "type": "bind" |
| 49 | + }, |
| 50 | + // Keep a persistent cross container cache for uv |
| 51 | + { |
| 52 | + "source": "${localEnv:HOME}/.cache/uv", |
| 53 | + "target": "/root/.cache/uv", |
| 54 | + "type": "bind" |
| 55 | + }, |
| 56 | + // Use a volume mount for the uv venv so it is local to the container |
| 57 | + { |
| 58 | + "target": "/workspaces/${localWorkspaceFolderBasename}/.venv", |
| 59 | + "type": "volume" |
| 60 | + } |
| 61 | + ], |
42 | 62 | // Mount the parent as /workspaces so we can pip install peers as editable |
43 | 63 | "workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind", |
44 | 64 | // After the container is created, install the python project in editable form |
45 | | - "postCreateCommand": "pip install $([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e '.[dev]' && pre-commit install" |
| 65 | + "postCreateCommand": "uv sync && uv run pre-commit install --install-hooks" |
46 | 66 | } |
0 commit comments