Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
What changed in each version of the template, and what a project has to do when `copier update`
brings it.

## Unreleased

- **The dev container keeps the Python tools in `.venv-devcontainer`:** the workspace is the
host's folder, and a `.venv` that uv made on the host names the host's paths in its scripts.
uv took it as current, and in the container clang-tidy, cpplint, copier and the others failed
to start, `make tidy` with `Failed to spawn: clang-tidy`; found in AtmegaTimer, whose `.venv`
came from the host. `UV_PROJECT_ENVIRONMENT` gives the container an environment of its own,
relative, so that each worktree has its own as before. `.gitignore` ignores it.

On the update: rebuild the dev container, whose `postCreateCommand` makes `.venv-devcontainer`. A
`.venv` the container made before can go; one of the host stays the host's.

## v0.11.2

A class may befriend its own CRTP base (C-12), so that `house-no-friend` passes a `friend Base;`
Expand Down
7 changes: 4 additions & 3 deletions template/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ RUN ARCH="$(dpkg --print-architecture)" && \
rm /tmp/gh.deb

# uv makes the environment of the Python tools from pyproject.toml and uv.lock, in the
# workspace's .venv, on the first `uv run` or with `uv sync --frozen` when the container is
# created: clang-format, clang-tidy, cpplint, gcovr, shellcheck, actionlint, ruff and copier,
# at the versions CI checks with. This ARG is the one place uv's version is written:
# workspace's .venv-devcontainer (UV_PROJECT_ENVIRONMENT in shared/devcontainer-feature.json),
# on the first `uv run` or with `uv sync --frozen` when the container is created: clang-format,
# clang-tidy, cpplint, gcovr, shellcheck, actionlint, ruff and copier, at the versions CI checks
# with. This ARG is the one place uv's version is written:
# .github/actions/uv-sync reads it for CI. Pinned with its published checksum, as the tools
# above.
ARG UV_VERSION=0.12.0
Expand Down
8 changes: 7 additions & 1 deletion template/.devcontainer/README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ another container is lost with that container.
{%- endif %}
| `g++`, `gdb` (from the base image) | the tests on the host, and what `tools/project.sh` prepares |
| `cmake`, `ninja`, GoogleTest | the tests on the host: `cmake --workflow --preset default` |
| `uv` | the Python tools that `uv.lock` pins, in `.venv`: clang-format, clang-tidy, cpplint, gcovr, shellcheck, actionlint, ruff, copier |
| `uv` | the Python tools that `uv.lock` pins, in `.venv-devcontainer`: clang-format, clang-tidy, cpplint, gcovr, shellcheck, actionlint, ruff, copier |
| `clang` | the tests a second time, by another compiler: `make clang` |
| `clangd` | IntelliSense, see below |
| LLVM's headers, in `/opt/llvm-23/include` | the checks of our own, `house-*`, a module that `tools/lib/tidy_module.sh` builds and `tools/tidy.sh` loads |
Expand Down Expand Up @@ -67,6 +67,12 @@ clangd does not load the module of the checks of our own, `house-*`: those findi
`make tidy` alone. The module's own sources in `tools/lib/tidy_module/` are read against LLVM's
headers, without the checks of `.clang-tidy`, which are the library's rules and not LLVM's.

uv makes the Python tools' environment in `.venv-devcontainer`, which `UV_PROJECT_ENVIRONMENT` in
`shared/devcontainer-feature.json` names, not in `.venv`: the workspace is the host's folder, and a
`.venv` that uv made on the host names the host's paths in its scripts. uv takes such an
environment as current, and the tools fail to start (`Failed to spawn: clang-tidy`). A `.venv` in
the workspace is the host's, which the container leaves alone.

clangd comes from PyPI at 22.1.1, the newest there, one behind the clang-tidy 23 of CI, which stays
the measure. The package wraps the binary in a Python script whose interpreter would lie in root's
home; `/usr/local/bin/clangd` links to the binary itself.
Expand Down
9 changes: 7 additions & 2 deletions template/.devcontainer/shared/devcontainer-feature.json.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,16 @@
}
}
},
// uv's cache is a volume of its own, another file system than the workspace's .venv, so it
// copies rather than failing to link and saying so on every sync.
// uv's cache is a volume of its own, another file system than the project's environment, so
// it copies rather than failing to link and saying so on every sync.
"containerEnv": {
"GH_HOST": "github.com",
"UV_LINK_MODE": "copy",
// The environment of the Python tools in .venv-devcontainer, not in .venv: the workspace
// is the host's folder, and a .venv that uv made on the host names the host's paths in
// its scripts, which the container does not have; uv takes it as current and the tools
// fail to start. Relative, so that each worktree has its own.
"UV_PROJECT_ENVIRONMENT": ".venv-devcontainer",
// Claude Code keeps .claude.json beside ~/.claude rather than in it; this puts both
// into the volume below, so that a rebuild keeps the login and the settings.
"CLAUDE_CONFIG_DIR": "/home/vscode/.claude",
Expand Down
4 changes: 3 additions & 1 deletion template/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
build/
# The Python tools' environment, which uv makes from uv.lock.
# The Python tools' environment, which uv makes from uv.lock: on the host, and in the dev container,
# where UV_PROJECT_ENVIRONMENT names its own.
.venv/
.venv-devcontainer/
# What PlatformIO keeps beside a platformio.ini, its libraries among it; the builds go to build/.
.pio/
# A dev container variant of the site, such as one on an internal base image, see
Expand Down
4 changes: 2 additions & 2 deletions template/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ docs: ## The reference from the Doxygen blocks, failing on a gap
tools/docs.sh

# What git has, tracked or new, copied into build/arduino-lint/<name>: the Library Manager sees
# the repository, not the working tree with its build/ and .venv, whose links arduino-lint would
# report.
# the repository, not the working tree with its build/ and uv's environments, whose links
# arduino-lint would report.
arduino-lint: ## The rules of the Arduino Library Manager
tools/arduino_lint.sh

Expand Down
8 changes: 4 additions & 4 deletions template/tools/arduino_lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#
# Checks the library against the rules of the Arduino Library Manager, as arduino-lint does in
# CI. Not the working tree: the Library Manager sees the repository, and the working tree has
# build/ and .venv beside it, whose links arduino-lint reports as a library's. So what git has,
# tracked or new and not ignored, is copied into a folder of the library's name in build/, and
# that is checked. CI runs it as a developer does, through `make arduino-lint`, with arduino-lint
# installed by the action arduino-lint-setup at the dev container's version.
# build/ and uv's environments beside it, whose links arduino-lint reports as a library's. So
# what git has, tracked or new and not ignored, is copied into a folder of the library's name in
# build/, and that is checked. CI runs it as a developer does, through `make arduino-lint`, with
# arduino-lint installed by the action arduino-lint-setup at the dev container's version.

set -euo pipefail

Expand Down
Loading