From: Augusto Stoffel <[email-masked]>
Date: Sat, 28 Aug 2021 12:05:00 +0200

> When reading Python.el source code, I see it's support Python virtual
> environment by setting the variable 'python-shell-vertualenv-root'

> It would be more discoverable if we have an interactive function to do
> that. Somthing like 'python-virtualenv' or similar. The must would be to
> have a key binding for it and eplained it in mode help.

This is just an opinion, but I think the virtualenv support in the
Python shell is a misguided feature.  The problem is that it merely sets
up the shell to run in a given virtualenv; it has no influence on other
external tools such as language servers or, say, ‘M-x compile RET pytest
RET’.

Instead, it would be better to embrace the idea of setting the
‘process-environment’ and ‘exec-path’ variables buffer-locally.  There
are some rough edges to be polished, cf [1].  But at least there are
packages, such as envrc, direnv and buffer-env (on MELPA) to help
managing env vars in Emacs.

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=46345