All Projects → robert-zaremba → auto-virtualenvwrapper.el

robert-zaremba / auto-virtualenvwrapper.el

Licence: other
Automatically activate python virtualenv using virtualenvwrapper.el

Programming Languages

emacs lisp
2029 projects

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].