Activate venv on a per file/folder basis #22687
Labels
feature-request
Request for new features or functionality
triage-needed
Needs assignment to the proper sub-team
I'm currently working in a monorepo that contains multiple Python packages and venvs. e.g.
It would be great to have VSCode automatically change the venv based on the current file, so that things like linting work correctly (i.e. no package import errors). As an example:
main_a.py
is opened and is active file ->package_a/.venv
gets activated.main_b.py
the active file ->package_b/.venv
gets activated.Working out which is the correct venv for each file could be tricky, but for me a traversal up the file system looking for .venv would work well.
WolfiesHorizon.python-auto-venv
extension used to do this well but no longer works. Would be great to have this feature in the official extension.My current workflow every time I open a file from a different sub-packages is:
So a very manual workflow and pretty disruptive! I copy path because I have a lot of venvs, and it's easier than finding the correct venv from the existing interpreter drop down.
Sorry if this is a duplicate issue, quite hard to search for this one!
The text was updated successfully, but these errors were encountered: