feat(setup): add optional pyright installation and create type-check script

This commit is contained in:
Julian Pawlowski 2025-11-20 10:10:33 +00:00
parent 781286216a
commit 5ff61b6d5c
4 changed files with 62 additions and 7 deletions

View file

@ -10,6 +10,21 @@ requires-python = ">=3.13"
[tool.setuptools]
packages = ["custom_components.tibber_prices"]
[tool.pyright]
include = ["custom_components/tibber_prices"]
exclude = [
"**/node_modules",
"**/__pycache__",
"**/.git",
"**/.github",
"**/docs",
"**/venv",
"**/.venv",
]
venvPath = "."
venv = ".venv"
typeCheckingMode = "basic"
[tool.ruff]
# Based on https://github.com/home-assistant/core/blob/dev/pyproject.toml
target-version = "py313"

14
scripts/check Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
# script/check: Run linting and type checking tools together
set -e
cd "$(dirname "$0")/.."
if [ -z "$VIRTUAL_ENV" ]; then
. "$HOME/.venv/bin/activate"
fi
scripts/type-check
scripts/lint-check

View file

@ -6,6 +6,15 @@ set -e
cd "$(dirname "$0")/.."
# Install optional pyright for type checking
if command -v npm >/dev/null 2>&1; then
echo "==> Installing pyright for type checking..."
npm install -g pyright 2>/dev/null || {
echo " ⚠️ Warning: pyright installation failed (optional)"
echo " You can install it manually: npm install -g pyright"
}
fi
# Install optional release note backend: GitHub Copilot CLI (AI-powered)
if command -v npm >/dev/null 2>&1; then
echo "==> Installing GitHub Copilot CLI for AI-powered release notes..."

17
scripts/type-check Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
# script/type-check: Run type checking tools
set -e
cd "$(dirname "$0")/.."
if [ -z "$VIRTUAL_ENV" ]; then
. "$HOME/.venv/bin/activate"
fi
echo "==> Running type checking tools..."
pyright
echo "==> Type checking completed."