Skip to content

fix: skip pyright on pre-commit.ci (#3)#7

Merged
PythonFZ merged 1 commit into
mainfrom
worktree-fix-pyright-precommit-ci
Jun 18, 2026
Merged

fix: skip pyright on pre-commit.ci (#3)#7
PythonFZ merged 1 commit into
mainfrom
worktree-fix-pyright-precommit-ci

Conversation

@PythonFZ

Copy link
Copy Markdown
Owner

Closes #3.

Problem

The pyright hook runs entry: uv run pyright with language: system. On pre-commit.ci this can't work:

  • No uv on PATHlanguage: system uses whatever the pre-commit.ci image provides; uv isn't installed.
  • No network at hook runtime — pre-commit.ci disables network access while running hooks (only the env-install phase has network). So even with uv, uv run/uv sync can't install the package + fastapi/pydantic that pyright needs to resolve imports.

The only "in-service" workaround is the node-based pyright hook with every dependency hand-listed in additional_dependencies — brittle, duplicates the dep list, and still can't install the local package. So there's no clean fix on pre-commit.ci; disabling it there (the issue's own suggestion) is the right call.

Change

Add a top-level ci.skip: [pyright] to .pre-commit-config.yaml. This is scoped to pre-commit.ci only:

  • ✅ Still runs locally (uvx prek / pre-commit), where uv is present.
  • ✅ Still runs in GitHub Actions CIuv run pyright already executes in .github/workflows/ci.yaml, which stays authoritative for type-checking.
  • ✅ Skipped on pre-commit.ci, where it cannot run.

Verification

  • uvx prek run --all-filespyright ... Passed (local run unaffected).
  • SKIP=pyright uvx prek run --all-files (the local equivalent of ci.skip) → only ruff hooks run, pyright skipped.

🤖 Generated with Claude Code

pyright runs via `uv run pyright`, which needs uv on PATH plus network
access to install the package and its deps so imports resolve. pre-commit.ci
provides neither at hook runtime, so the hook can't work there.

Skip it on pre-commit.ci via `ci.skip`; it still runs locally (uv present)
and in GitHub Actions CI (`uv run pyright` in .github/workflows/ci.yaml),
which stays authoritative for type-checking.

Closes #3

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@PythonFZ PythonFZ merged commit 034f9b0 into main Jun 18, 2026
4 checks passed
@PythonFZ PythonFZ deleted the worktree-fix-pyright-precommit-ci branch June 18, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix pyright pre-commit.ci

1 participant