diff --git a/.devcontainer.json b/.devcontainer.json index 120bfc3..1c0abe8 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -1,5 +1,5 @@ { - "name": "ludeeus/ttlock_ble", + "name": "roquerodrigo/ha-ttlock-ble", "image": "mcr.microsoft.com/devcontainers/base:debian", "postCreateCommand": "scripts/setup", "forwardPorts": [ @@ -40,6 +40,7 @@ "ghcr.io/devcontainers/features/python:1": { "version": "3.14" }, + "ghcr.io/va-h/devcontainers-features/uv:1": {}, "ghcr.io/devcontainers-extra/features/apt-packages:1": { "packages": "ffmpeg,libturbojpeg0,libpcap-dev" } diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ad551d7..fbe162f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,28 @@ # Run with: pre-commit install (after scripts/setup) -# CI mirrors these checks via .github/workflows/lint.yml +# CI mirrors these checks via .github/workflows/ci.yml repos: - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.12 + - repo: local hooks: - - id: ruff-check - args: [--fix] - id: ruff-format + name: ruff format + entry: uv run ruff format + language: system + types_or: [python, pyi] + require_serial: true + + - id: ruff-check + name: ruff check + entry: uv run ruff check --fix + language: system + types_or: [python, pyi] + require_serial: true + + - id: mypy + name: mypy + entry: uv run mypy custom_components/ttlock_ble + language: system + pass_filenames: false + types: [python] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 diff --git a/scripts/setup b/scripts/setup index bee3d47..188cc82 100755 --- a/scripts/setup +++ b/scripts/setup @@ -4,10 +4,4 @@ set -e cd "$(dirname "$0")/.." -# Auto-use ./.venv if present so callers don't need to `source activate`. -if [ -d "${PWD}/.venv" ]; then - export PATH="${PWD}/.venv/bin:${PATH}" - export VIRTUAL_ENV="${PWD}/.venv" -fi - -python3 -m pip install --requirement requirements.txt +uv sync --group dev --group lint