Pyright uv virtual env
EDIT (February 7, 2026): I’m using ruff and mypy without pyright for now.
Adding a [tool.pyright] section to pyproject.toml seems to work:
[tool.pyright]
venvPath = "."
venv = ".venv"
A possible better approach suggested in https://github.com/astral-sh/uv/issues/8040 is to just activate the virtual environment:
$ . .venv/bin/activate
(venv) $ nvim .
From a quick test, it seems that the [tool.pyright] pyproject.toml approach is working for me —
it’s not having the issue with incorrectly resolving standard library imports that was mentioned in
the GitHub issue. (I only looked at it briefly though.)