If I run the pre-commit
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
based on pyproject.toml:
[tool.isort]
profile = "black"
[tool.black]
line-length=120
[tool.pyright]
#venvPath = "envs_path"
#venv="env_name"
include = ["stories"]
exclude = [
"**/__pycache__",
"scripts",
"ml"
]
with pre-commit run --all-files I keep getting like 200+ import errors, eg. :
error: Import "sqlmodel" could not be resolved (reportMissingImports)
The only workaround is to uncomment the path and env name lines in the above toml snippet to run it, but then this can't be pushed to repo as everyoser can have arbitraty path.
How can I make the pyright to dynamically detect current pyenv environment while running pre-commit based on pyproject.toml?