From f4476d4b2565a6618ab6e8448d01bd6c90b40b3b Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 18 Aug 2026 06:18:27 -0400 Subject: [PATCH] Add devcontainer support Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .devcontainer/Dockerfile | 4 ++++ .devcontainer/devcontainer.json | 41 +++++++++++++++++++++++++++++++++ README.md | 6 +++++ 3 files changed, 51 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..0a334ff --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,4 @@ +ARG VARIANT=3.13-bookworm +FROM mcr.microsoft.com/devcontainers/python:1-${VARIANT} + +RUN python -m pip install --no-cache-dir uv==0.10.7 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..0e46c87 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,41 @@ +{ + "name": "Python Open Source Template", + "build": { + "dockerfile": "Dockerfile", + "args": { + "VARIANT": "3.13-bookworm" + } + }, + "remoteUser": "vscode", + "updateRemoteUserUID": true, + "containerEnv": { + "UV_LINK_MODE": "copy" + }, + "mounts": [ + { + "source": "uv-cache-${devcontainerId}", + "target": "/home/vscode/.cache/uv", + "type": "volume" + } + ], + "postCreateCommand": "uv sync --all-groups --locked && uv run pre-commit install --install-hooks", + "customizations": { + "vscode": { + "extensions": [ + "astral-sh.ty", + "charliermarsh.ruff", + "ms-python.python", + "redhat.vscode-yaml" + ], + "settings": { + "editor.codeActionsOnSave": { + "source.fixAll.ruff": "explicit", + "source.organizeImports.ruff": "explicit" + }, + "editor.formatOnSave": true, + "python.defaultInterpreterPath": "${containerWorkspaceFolder}/.venv/bin/python", + "python.testing.pytestEnabled": true + } + } + } +} diff --git a/README.md b/README.md index 69d3307..0178037 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,12 @@ make verify # Checks, tests, package build, and strict documentation build See [CONTRIBUTING.md](CONTRIBUTING.md) for contributor guidance and [AGENTS.md](AGENTS.md) for agent instructions. +## Dev Container + +Open the repository in a Dev Container to use the pinned Python and uv +environment. It installs all dependency groups and the configured Git hooks on +creation, while retaining the uv download cache between rebuilds. + ## Documentation and Releases Documentation lives in `docs/` and is built with Sphinx using the Palewire