Monday, December 11, 2017

Emacs, Python, virtualenvwrapper, and Jedi references

https://github.com/tkf/emacs-jedi/issues/123

Read the virtualenvwrapper documentation for an alternative way of automatically activating project virtual evironments. In short you can create a .dir-locals.el file in the root of your project, with the following content:
((python-mode . ((project-venv-name . "myproject-env"))))
Change "myproject-env" to the name of your virtualenv and activate the virtualenvironment using the python-mode hook:
(add-hook 'python-mode-hook (lambda ()
                              (hack-local-variables)
                              (venv-workon project-venv-name)))
(add-hook 'python-mode-hook 'jedi:setup)

No comments:

Post a Comment