Automatically activate python virtualenv using virtualenvwrapper.el
Clone or download
Latest commit 72cc916 Oct 6, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Feb 19, 2017
README.md Add Melpa installation instrucitions Mar 14, 2017
auto-virtualenvwrapper.el version update Oct 6, 2018

README.md

auto-virtualenvwrapper

Automatically activates python virtualenv on emacs using:

  • python-version file in the project root.
  • .venv or venv directory (or link) in the project root.
  • Try find a virtualenv with the same name of Project Root.

Project root is defined as a parent directory containing auto-virtualenvwrapper-project-root-files. By default the variable equals to (".python-version" ".dir-locals.el" ".projectile" ".emacs-project" "manage.py" ".git" ".hg").

This code is based on auto-virtualenv, but uses tiny virtualenvwrapper library rather then pyenv. This way you avoid additional dependencies: pyenv and elpy.

Installation

MELPA

M-x package-install [RET] auto-virtualenvwrapper [RET]

manual

Clone this repository somewhere and add this directory to you load-path.

Usage

(require 'auto-virtualenvwrapper)
(add-hook 'python-mode-hook #'auto-virtualenvwrapper-activate)

Optionally:

;; Activate on changing buffers
(add-hook 'window-configuration-change-hook #'auto-virtualenvwrapper-activate)
;; Activate on focus in
(add-hook 'focus-in-hook #'auto-virtualenvwrapper-activate)

Alternatives

License

GNU GPL v3.0

View official GNU site http://www.gnu.org/licenses/gpl.html.