microsoft / microsoft/pyright

pyright 1.1.409 fails as a pre-commit hook

Open
#11,404 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
15.6k
Forks
1.8k
Avg merge
12h 13m
Merged PRs (30d)
52

Description

Describe the bug
pyright 1.1.409 fails in pre-commit while it works just fine in stand-alone mode. pyright 1.1.408 works fine everywhere.

Code or Screenshots

mkdir Bug
cd Bug
git init
uv venv
.venv\Scripts\activate

uv pip install pyright==1.1.409 pre-commit

echo repos: [{repo: https://github.com/RobertCraigie/pyright-python, rev: v1.1.409, hooks: [{id: pyright}]}] > .pre-commit-config.yaml
pre-commit install

echo p: int ^| None > bug.py
git add bug.py

pyright bug.py
pre-commit run pyright --all-files

Output:

(Bug) C:\Git\Bug>pyright bug.py
0 errors, 0 warnings, 0 informations

(Bug) C:\Git\Bug>pre-commit run pyright --all-files
pyright..................................................................Failed
- hook id: pyright
- exit code: 1

c:\Git\Bug\bug.py
  c:\Git\Bug\bug.py:1:4 - error: Operator "|" not supported for types "type[int]" and "type[Unknown]" (reportOperatorIssue)
1 error, 0 warnings, 0 informations

VS Code extension or command-line
pyright 1.1.409 via pyright-python

This is a regression from 1.1.408.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the standalone and pre-commit commands from the issue using pyright 1.1.409, then compare them with 1.1.408 and inspect the generated .pre-commit-config.yaml hook invocation. Done means the minimal bug.py example produces the same successful result through pre-commit as it does when run directly.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.