Python: project not recognizing packages installed in the `.venv` specified by `pyproject.toml`
Summary
One of the last few releases broke [tool.pyright] .venv detection in Zed.
I have a monorepo with multiple Python projects that had each project identify the virtual environment via a local pyproject.toml. Now, that behavior no longer works. This is broken on MacOS and Linux.
Description
Steps to reproduce:
- Clean Zed install
- Create a Python project using
uv. E.g.,uv init --lib myproject. Runuv syncfrom themyprojectdirectory to generate the.venv(add whatever package you want). - Add to the
pyproject.toml
[tool.pyright]
venvPath = "."
venv = ".venv"
Expected Behavior: Expect pyright to respect the .venv packages
Actual Behavior: pyright does not respect the .venv
Zed Version and System Specs
Zed: v0.148.8 (Zed) OS: macOS 15.3.2 Memory: 64 GiB Architecture: aarch64
Seems this is because of https://github.com/zed-industries/zed/pull/29662. What is the recommended approach for this use case by the Zed team now? I am currently pinned to v0.183.12, where I can effectively use Zed to manage my codebase.
Probably related: I have basically the same issue now in this repo for example (not a monorepo).
Previously I did not need the [tool.pyright] config for stuff to work (I use mypy, it's nice to not have both mypy and pyright config if possible, although it's only 3 lines), but installed packages are not recognized without it now.
Perhaps related, on a remote session over ssh I cannot detect the local project venv or global venv as an interpreter. It only shows system defaults in the dropdown.
So, I had ‘ruff’ set as the language server in my global configuration, but on the remote host, it always uses ‘pyright’. And here’s the catch: even if I change global configuration settings related to the language and language server on an SSH session, it doesn’t work. I have to make the changes either in the global configuration inside the remote host or in the project-level configuration. Is this the intended behavior?
Hey @haruishi43 and @stockeh, would you please open new issues for the ruff/pyright configuration issues you're describing? Please include your settings json and steps to reproduce in your issues. They may be related, however they are worth tracking separately. Thanks!
I don't want to bloat the issue tracker, so I just commented here with all my settings and how I can reproduce the problem.
This was the approach I was using to get around the lack of support for .venvs in a monrepo or nested project structure and is the underlying reason for this isssue here... https://github.com/zed-industries/zed/issues/30135
This is currently the most painful issue in Zed for me.
@probably-neb sorry for the late reply. Searching other issues again, I think my issue is more related to this one: https://github.com/zed-industries/zed/issues/29705