Jedi.el - Python auto-completion for Emacs
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.
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.
Jedi.el is tested against Python 2.6, 2.7 and 3.2.
Optional dependencies for automatic installation:
The easiest way to install Jedi.el is to use el-get:
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.
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).
- Install EPC and auto-complete.
- Install Jedi.el. Download the repository of Jedi.el and add it to load-path.
- Install Jedi and python-epc by
make requirements(no need for root privileges ) or
pip install -r requirements.txtif you want to determine where to install Python modules. You need root privileges (i.e.,
sudo) to install it in system directory.
(autoload 'jedi:setup "jedi" nil t)in your Emacs configuration.
|||You need virtualenv for |
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
(setq jedi:setup-keys t)
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.