Skip to content

uv Configations

Tip

Official documentation for uv is available at https://docs.astral.sh/uv

Virtual Environment

Set the UV_PROJECT_ENVIRONMENT not to create a virtual environment in the project directory.

.devcontainer/Dockerfile
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
    "name": "uv",
    "build": {
        "context": "..",
        "dockerfile": "Dockerfile",
        "args": {
            "UV_VERSION": "0.5.11",
            "DEBIAN_VERSION": "bookworm"
        }
    },
    "features": {
        "ghcr.io/dhoeric/features/hadolint:1": {}
    },
    "customizations": {
        "vscode": {
            "extensions": [
                "charliermarsh.ruff",
                "exiasr.hadolint",
                "kevinrose.vsc-python-indent",
                "mosapride.zenkaku",
                "ms-azuretools.vscode-docker",
                "ms-python.python",
                "njpwerner.autodocstring",
                "redhat.vscode-yaml",
                "shardulm94.trailing-spaces",
                "tamasfe.even-better-toml"
            ]
        }
    },
    "containerEnv": {
        "DISPLAY": "dummy",
        "PYTHONUNBUFFERED": "True",
        "UV_LINK_MODE": "copy",
        "UV_PROJECT_ENVIRONMENT": "/home/vscode/.venv"
    },
    "postCreateCommand": "uv sync --frozen",
    "postStartCommand": "uv run pre-commit install",
    "remoteUser": "vscode"
}