Using Python Virtualenvs Over Emacs TRAMP Is Getting Simpler

, Wellesley, MA

Since my original post on using remote virtualenvs from Emacs, the process has gotten a lot simpler.

First, Michael Albinus fixed the python.el that ships with Emacs 24 nightly builds, eliminating the need for my hack to it.

Next, I put the Python support code from the Emacs distribution on PyPI, so you can add it to a remote virtualenv with pip install emacs.

Finally, I improved tramp-virtualenv.el and the example .dir-locals.el so that Emacs can change to a configured virtualenv when you switch buffers.

The implementation of tramp-virtualenv.el is an ugly hack, but it worked well enough for coding on two Python projects last night. I’m starting to wonder if something like it would be a good addition to virtualenv.el.

The improvements in tramp-virtualenv also made obsolete its wrapper script and the need to set directory local values of python-command and gud-pdb-command-name, since TRAMP finds the active virtualenv’s python from the PATH now.

Next up, another attempt at using Python’s refactoring tools over TRAMP.

Enjoyed reading this post? Discuss it on Reddit, or follow me on Twitter.