pre-commit never installs from the repository under test as it makes caching intractable (it only uses the contents of the configuration and installs in such a way that your repository is intentionally inaccessible)

requiring repository-local state usually indicates it isn't a good fit for the framework and you may be trying to do too much

that said, you can hack around this by using language: system / repo: local -- but these are the unsupported escape hatch where setting up the "correct state" for your tools is on the burden of your users rather than the framework


disclaimer: I wrote pre-commit

Answer from anthony sottile on Stack Overflow
🌐
GitHub
github.com › microsoft › pyright › blob › main › docs › ci-integration.md
pyright/docs/ci-integration.md at main · microsoft/pyright
You can run pyright as a pre-commit hook using the community-maintained Python wrapper for pyright.
Author   microsoft
🌐
PyPI
pypi.org › project › pyright
pyright · PyPI
repos: - repo: https://github.com/RobertCraigie/pyright-python rev: v1.1.410 hooks: - id: pyright · Pre-commit will install pyright-python in its own virtual environment which can cause pyright to not be able to detect your installed dependencies.
      » pip install pyright
    
Published   Jun 01, 2026
Version   1.1.410
Discussions

pre-commit-config adding local dependencies - Stack Overflow
I'm setting up pre-commit hooks on my project and I'm working with self-developped packages that happen to be in root of the project and I can't seem to add them as additional_dependencies in my config file making my pyright hook unhappy when committing in the repository. More on stackoverflow.com
🌐 stackoverflow.com
Add an official pre-commit hook
It would be great if there was an official pre-commit hook for pyright. The only one I have been able to find is this, but it seems it is not maintained anymore. More on github.com
🌐 github.com
9
June 23, 2022
I don't like mypy, and pyright (i like) does not integrate with project.toml
What are you talking about? Pyright, like 99% of other python tooling, integrates with pyproject.toml. If you are using vscode however, pylance will always take precedent first -> https://github.com/microsoft/pyright/blob/main/docs/configuration.md More on reddit.com
🌐 r/learnpython
6
1
June 19, 2024
python - Pyright not detect current pyenv environment - Stack Overflow
How can I make the pyright to dynamically detect current pyenv environment while running pre-commit based on pyproject.toml? More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com › ComPWA › pyright-pre-commit
GitHub - ComPWA/pyright-pre-commit: Pre-commit hook for Pyright · GitHub
Pre-commit hook for Pyright. Contribute to ComPWA/pyright-pre-commit development by creating an account on GitHub.
Author   ComPWA
🌐
GitHub
github.com › RobertCraigie › pyright-python
GitHub - RobertCraigie/pyright-python: Python command line wrapper for pyright, a static type checker · GitHub
repos: - repo: https://github.com/RobertCraigie/pyright-python rev: v1.1.409 hooks: - id: pyright · Pre-commit will install pyright-python in its own virtual environment which can cause pyright to not be able to detect your installed dependencies.
Starred by 272 users
Forked by 26 users
Languages   Python 96.0% | Dockerfile 4.0%
🌐
Basedpyright
docs.basedpyright.com › v1.31.1 › installation › pre-commit hook
pre-commit hook - basedpyright
repos: - repo: https://github.com/DetachHead/basedpyright-pre-commit-mirror rev: v1.13.0 # or whatever the latest version is at the time hooks: - id: basedpyright
Find elsewhere
🌐
GitHub
github.com › microsoft › pyright › issues › 3612
Add an official pre-commit hook · Issue #3612 · microsoft/pyright
June 23, 2022 - It would be great if there was an official pre-commit hook for pyright. The only one I have been able to find is this, but it seems it is not maintained anymore.
Author   microsoft
🌐
Medium
gatlenculp.medium.com › effortless-code-quality-the-ultimate-pre-commit-hooks-guide-for-2025-57ca501d9835
Effortless Code Quality: The Ultimate Pre-Commit Hooks Guide for 2025
February 9, 2025 - - repo: <https://github.com/astral-sh/ruff-pre-commit> rev: v0.9.1 hooks: - id: ruff-format name: "🐍 python · Format with Ruff" # STRICT - id: ruff args: [ --fix ] Microsoft’s Pyright handles Python type checking:
🌐
Stack Overflow
stackoverflow.com › questions › 77732629 › pyright-not-detect-current-pyenv-environment
python - Pyright not detect current pyenv environment - Stack Overflow
repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.2.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files - repo: https://github.com/pycqa/isort rev: 5.11.5 hooks: - id: isort name: isort (python) - repo: https://github.com/psf/black-pre-commit-mirror rev: 23.12.1 hooks: - id: black language_version: python3.11 - repo: https://github.com/RobertCraigie/pyright-python rev: v1.1.343 hooks: - id: pyright
🌐
GitHub
raw.githubusercontent.com › microsoft › pyright › main › docs › ci-integration.md
Integrating Pyright into Continuous Integration
You can run pyright as a pre-commit hook using the community-maintained Python wrapper for pyright.
🌐
Docker
docs.docker.com › guides › python › linting, formatting, and type checking for python
Linting, formatting, and type checking for Python | Docker Docs
November 19, 2025 - Pyright is a fast static type checker for Python that works well with modern Python features. ... Pre-commit hooks automatically run checks before each commit.
🌐
nathanv@blog
blog.nathanv.me › posts › python-tooling-vol-2
Python Tooling Volume 2 :: nathanv@blog — Adventures in programming and tech
January 22, 2023 - 1repos: 2 - hooks: 3 - id: pyright 4 repo: https://github.com/RobertCraigie/pyright-python 5 rev: v1.1.289 · However, since pre-commit installs tools into their own virtual environment, this means pyright needs to be told where the actual virtual environment is.
🌐
Lemonyte
lemonyte.com › blog › adopting-ty
Adopting ty in pre-commit hooks and CI | Lemonyte
December 18, 2025 - I’ve long been a fan of code quality management tools like pre-commit and Ruff. Some years ago, I started setting up my Python repos with Flake8 for linting, Black for formatting, and Pyright for type checking, all wrapped into pre-commit hooks that run both locally before each commit and in GitHub Actions for that shiny green checkmark.
🌐
DataCamp
datacamp.com › tutorial › pyright
Pyright Guide: Fast Static Type Checking for Python Code | DataCamp
January 30, 2026 - Absolutely. Use the pyright-python hook from the official repo. Just make sure to configure venvPath in your config file so pre-commit can find your dependencies.
🌐
Ministry of Intrigue
andrlik.org › dispatches › til-bump-my-version-uv
TIL - Using pre-commit hooks with Bump My Version, pre-commit, and uv · Ministry of Intrigue
October 14, 2024 - However, I recently ran into an annoying snag when prepping a new version because I had the following in my .pre-commit-config.yaml: - repo: local hooks: - id: ruff name: Run ruff entry: uv run ruff check src/ language: system files: \.py$ - id: pyright name: Run pyright type checking entry: ...
🌐
GitHub
github.com › DetachHead › basedpyright-prek-mirror
GitHub - DetachHead/basedpyright-prek-mirror · GitHub
Contribute to DetachHead/basedpyright-prek-mirror development by creating an account on GitHub.
Author   DetachHead
🌐
GitHub
github.com › Quantco › pre-commit-mirrors-pyright
GitHub - Quantco/pre-commit-mirrors-pyright
pre-commit hook of pyright with conda as a language / package manager.
Author   Quantco