Skip to content

syohex/pyenv-mode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

Pyenv mode

Melpa

Integrate Fabián E. Gallina python.el with pyenv tool. This allow packages which already use python.el (like python-django) got pyenv virtual environments support out-of-the-box.

Pyenv mode does...

  • Setup PYENV_VERSION environment variable and python-shell-virtualenv-path custom variable based on user input

Pyenv mode doesn't...

  • Override your exec-path
  • Run external shell scripts
  • Manage your pyenv installation
  • Deal with virtualenvwrapper

Installation

You can simply install package from Melpa:

M-x package-install RET pyenv-mode

Usage

Add following block to your emacs configuration

(pyenv-mode)

Now you are available to specify pyenv python version:

M-x pyenv-mode-set

So now when you run inferior python with:

M-x run-python

process will start inside specified python installation. You can unset current version with:

M-x pyenv-mode-unset

Goodies

When you set python version with pyenv-mode following changes happens automatically

  • compile commands use proper python version and environment
  • flycheck perform syntax checking according to python version you use
  • anaconda-mode search completions, definitions and references in chosen environment

Projectile integration

You can switch python version together with current project. Drop following lines into emacs init file. When use projectile switch project with C-c p p key binding pyenv-mode will activate environment matched project name.

(defun projectile-pyenv-mode-set ()
  "Set pyenv version matching project name.
Version must be already installed."
  (pyenv-mode-set (projectile-project-name)))

(add-hook 'projectile-switch-project-hook 'projectile-pyenv-mode-set)

About

Integrate pyenv with python-mode.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Emacs Lisp 100.0%