Skip to content

AndreaCrotti/emacs-jedi

 
 

Repository files navigation

Jedi.el - Python auto-completion for Emacs

Links:

What is it?

Jedi.el is a Python auto-completion package for Emacs. It aims at helping your Python coding in a non-destructive way. It also helps you to find information about Python objects, such as docstring, function arguments and code location.

Jedi.el uses jedi (an awesome Python auto-completion library) and EPC (an RPC stack for Emacs Lisp) and its Python binding to communicate with Python process. It also uses excellent Emacs auto-complete module to start completion automatically. As Jedi.el always calls Python function asynchronously (thanks to EPC), it will not block your Emacs while your are editing.

Requirements

Emacs

If your completion popup is broken when width of completion candidates is wide, try the newest version of popup.el.

Jedi.el is currently tested against Emacs 24.3-devel, 24.2 and 23.1.

Python

Jedi.el is tested against Python 2.6, 2.7 and 3.2.

Optional dependencies for automatic installation:

Install

el-get

The easiest way to install Jedi.el is to use el-get: just do M-x el-get-install jedi. You need to have virtualenv to automatically install Python module dependencies. If your el-get does not have the recipes for Jedi.el yet, get them from this pull request.

package.el (MELPA)

You can install Jedi.el using package.el interface from MELPA. As package.el does not support installing non-elisp packages, you need to install Python part manually (see the next section).

Manual install

  1. Install EPC and auto-complete.
  2. Install Jedi.el. Download the repository of Jedi.el and add it to load-path.
  3. Install Jedi and python-epc by
    • make requirements (no need for root privileges1) or
    • pip install -r requirements.txt if you want to determine where to install Python modules. You need root privileges (i.e., sudo) to install it in system directory.
  4. Add (autoload 'jedi:setup "jedi" nil t) in your Emacs configuration.

Setup

All you need to do is to call jedi:setup in python buffer. To do that, add the following in your Emacs configuration:

(add-hook 'python-mode-hook 'jedi:setup)

If auto-completion is all you need, use jedi:ac-setup instead:

(add-hook 'python-mode-hook 'jedi:ac-setup)

To setup recommended keybinds for Jedi.el, add this to your Emacs configuration. Note that you must set jedi:setup-keys before loading jedi.el. See its docstring (<f1> v jedi:setup-keys) for more information.:

(setq jedi:setup-keys t)

Extension

IPython integration

Sometimes it is useful to find completion using Python interpreter. To do that in a seamless manner, you can use IPython and its Emacs binding EIN (Emacs IPython Notebook). See ein:jedi-setup in the EIN manual. Using this setup, you can run auto-completion command in Jedi.el and EIN simultaneously.


  1. You need virtualenv for make requirements. It installs all requirements for Jedi EPC server in an isolated Python environment in env/ directory under the directory where jedi.el locates. Note that you don't need to worry about if you want to use Jedi.el to complete modules in another virtualenv you made. Jedi EPC server recognize the virtualenv it is in (i.e., the environment variable VIRTUAL_ENV in your Emacs) and then add modules in that environment to its sys.path.

About

Python auto-completion for Emacs

Resources

Stars

Watchers

Forks

Packages

No packages published