From 7122e2fced4ed8879442c08b9e97752c4b250f7c Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:32 +0100 Subject: chore(python): add basedpyright type-checking ruff (format + check) was already wired into fmt/check-fmt/lint. Add basedpyright as the type-checker for python so 'just lint' covers correctness too. Pyright config sets standard mode (lenient enough to not flood on stdlib edges) and excludes ipython_config.py whose 'c' is injected by IPython at config load time. --- justfile | 6 ++++-- pyrightconfig.json | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 pyrightconfig.json diff --git a/justfile b/justfile index f05b825..01894f2 100644 --- a/justfile +++ b/justfile @@ -211,6 +211,7 @@ lint *target: _lint_sh() { _need shellcheck shellcheck; shellcheck "$@"; } _lint_zsh() { _need shellcheck shellcheck; shellcheck --shell=bash "$@"; } _lint_py() { _need ruff ruff; ruff check "$@"; } + _lint_pytype() { _need basedpyright basedpyright; basedpyright "$@"; } _lint_toml() { _need taplo taplo-cli; taplo lint "$@"; } target='{{ target }}' @@ -228,6 +229,7 @@ lint *target: mapfile -t files < <(_find_by_ext py) [ ${#files[@]} -gt 0 ] && { _lint_py "${files[@]}" || rc=$?; } + [ ${#files[@]} -gt 0 ] && { _lint_pytype "${files[@]}" || rc=$?; } mapfile -t files < <(_find_by_ext toml) [ ${#files[@]} -gt 0 ] && { _lint_toml "${files[@]}" || rc=$?; } @@ -244,7 +246,7 @@ lint *target: case "$target" in *.lua) _lint_lua "$target" ;; *.sh) _lint_sh "$target" ;; - *.py) _lint_py "$target" ;; + *.py) _lint_py "$target"; _lint_pytype "$target" ;; *.toml) _lint_toml "$target" ;; *.md|*.json|*.jsonc|*.yaml|*.yml|*.css) echo "skip: $target (no linter; use check-fmt)" >&2; exit 0 ;; *) @@ -264,7 +266,7 @@ lint *target: doctor: #!/usr/bin/env bash rc=0 - for tool in stylua selene shfmt shellcheck ruff taplo prettier just; do + for tool in stylua selene shfmt shellcheck ruff basedpyright taplo prettier just; do if command -v "$tool" >/dev/null 2>&1; then printf ' ✓ %s (%s)\n' "$tool" "$(command -v "$tool")" else diff --git a/pyrightconfig.json b/pyrightconfig.json new file mode 100644 index 0000000..7b59b39 --- /dev/null +++ b/pyrightconfig.json @@ -0,0 +1,11 @@ +{ + "typeCheckingMode": "standard", + "include": ["**/*.py"], + "exclude": [ + "**/.git/**", + "**/.venv/**", + "**/node_modules/**", + "dot_config/ipython/profile_default/ipython_config.py" + ], + "reportMissingTypeStubs": false +} -- cgit v1.3.1