Repository navigation
Adopt a Root uv Workspace and Trim the EasyStart Docs #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| { | ||
| "name": "ESPHome-Config (Python)", | ||
| "image": "mcr.microsoft.com/devcontainers/python:1-3.14-bookworm", | ||
|
|
||
| "features": { | ||
| "ghcr.io/devcontainers/features/common-utils:2": {}, | ||
| "ghcr.io/devcontainers/features/github-cli:1": {} | ||
| }, | ||
|
|
||
| "mounts": [ | ||
| { | ||
| "source": "${localEnv:HOME}${localEnv:USERPROFILE}/.ssh/id_ed25519.pub", | ||
| "target": "/home/vscode/.ssh/id_ed25519.pub", | ||
| "type": "bind", | ||
| "readonly": true | ||
| }, | ||
| { | ||
| "source": "${localEnv:HOME}${localEnv:USERPROFILE}/.config/git/allowed_signers", | ||
| "target": "/home/vscode/.config/git/allowed_signers", | ||
| "type": "bind", | ||
| "readonly": true | ||
| }, | ||
| { | ||
| "source": "${localEnv:HOME}${localEnv:USERPROFILE}/.config/gh", | ||
| "target": "/home/vscode/.config/gh", | ||
| "type": "bind", | ||
| "readonly": false | ||
| } | ||
| ], | ||
|
ptr727 marked this conversation as resolved.
Resolved
|
||
|
|
||
| "remoteUser": "vscode", | ||
|
|
||
| // The bind-mount on macOS hosts surfaces /home/vscode/.ssh as root-owned. | ||
| // Chown it back so writes from inside the container land cleanly. | ||
| // Those include the known_hosts updates gh and git make. | ||
| // Idempotent on Linux and WSL2. | ||
| "onCreateCommand": "sudo install -d -m 700 -o vscode -g vscode /home/vscode/.ssh", | ||
|
|
||
| // Install pinned uv and pre-warm the project environment. | ||
| "postCreateCommand": ".devcontainer/python/post-create.sh", | ||
|
|
||
| "customizations": { | ||
| "vscode": { | ||
| // Python tooling for the uv workspace, beside the ESPHome container one level up. | ||
| "extensions": [ | ||
| "arahata.linter-actionlint", | ||
| "charliermarsh.ruff", | ||
| "davidanson.vscode-markdownlint", | ||
| "editorconfig.editorconfig", | ||
| "github.vscode-github-actions", | ||
| "gruntfuggly.todo-tree", | ||
| "ms-azuretools.vscode-docker", | ||
| "ms-python.python", | ||
| "streetsidesoftware.code-spell-checker", | ||
| "timonwong.shellcheck", | ||
| "yzhang.markdown-all-in-one" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/usr/bin/env bash | ||
| set -Eeuo pipefail | ||
|
|
||
| script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) | ||
| repository_dir=$(cd -- "$script_dir/../.." && pwd) | ||
|
|
||
| # Install uv (Astral) for the Python project. | ||
| # It is idempotent, since re-running overwrites in place. | ||
| # The installer drops the binary in $HOME/.local/bin. | ||
| # It also updates user shell init to add it to PATH for new shells. | ||
| # We add it to the current PATH explicitly so the rest of this script can invoke `uv`. | ||
| # | ||
| # The uv version is pinned via the version-prefixed install URL. | ||
| # That URL is https://astral.sh/uv/<version>/install.sh. | ||
| # A broken or compromised upstream `latest` script therefore cannot silently change what runs. | ||
| # Bump UV_VERSION when you've reviewed release notes. | ||
| # | ||
| # We re-install when uv is missing OR when the installed version doesn't match the pin. | ||
| # The latter handles a contributor or an earlier pin leaving another uv version on PATH. | ||
| # The pin is what's reproducible and what the lockfile is generated against. | ||
| UV_VERSION="0.11.8" | ||
| installed_uv_version="" | ||
| if command -v uv >/dev/null 2>&1; then | ||
| installed_uv_version="$(uv --version | awk '{print $2}')" | ||
| fi | ||
| if [[ "$installed_uv_version" != "$UV_VERSION" ]]; then | ||
| # Download the pinned installer to a temp file first instead of piping `curl ... | sh`. | ||
| # This produces a logged sha256 of exactly the bytes we ran. | ||
| # A compromised installer therefore leaves a forensic trail. | ||
| # It also lets a future change pin a known-good checksum (set EXPECTED_SHA below). | ||
| installer=$(mktemp -t uv-install.XXXXXX.sh) | ||
|
ptr727 marked this conversation as resolved.
Resolved
|
||
| trap 'rm -f "$installer"' EXIT | ||
| curl -LsSf "https://astral.sh/uv/${UV_VERSION}/install.sh" -o "$installer" | ||
| actual_sha=$(sha256sum "$installer" | awk '{print $1}') | ||
| echo "uv installer (v${UV_VERSION}) sha256: ${actual_sha}" >&2 | ||
| # EXPECTED_SHA="<paste-from-trusted-source>" # set to enforce | ||
| if [[ -n "${EXPECTED_SHA:-}" && "${actual_sha}" != "${EXPECTED_SHA}" ]]; then | ||
| echo "uv installer sha256 mismatch - refusing to run" >&2 | ||
| exit 1 | ||
| fi | ||
| sh "$installer" | ||
| export PATH="$HOME/.local/bin:$PATH" | ||
| fi | ||
|
|
||
| if [[ -f "$repository_dir/pyproject.toml" && -f "$repository_dir/uv.lock" ]]; then | ||
| uv sync --frozen --project "$repository_dir" | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,9 @@ __pycache__/ | |
| *.pyc | ||
| .ruff_cache/ | ||
| .mypy_cache/ | ||
| .venv/ | ||
| .coverage | ||
| coverage.xml | ||
|
|
||
| # ESPHome | ||
| logs/ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Codecov configuration. | ||
| # Codecov's coverage statuses are advisory: they report and trend coverage, never gating a PR. | ||
| # - informational: true makes project and patch statuses advisory (always pass), so a coverage delta never blocks a PR. | ||
| # - Distinct from the upload step's fail_ci_if_error: false, which only guards upload errors. | ||
| # - A repo may override this to enforce a coverage threshold. | ||
| coverage: | ||
| status: | ||
| project: | ||
| default: | ||
| informational: true | ||
| patch: | ||
| default: | ||
| informational: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.