End User Usage

If you are a not an IDE Developer, the odds are that you just want to use Jedi as a browser plugin or in the shell. Yes that’s also possible!

Jedi is relatively young and can be used in a variety of Plugins and Software. If your Editor/IDE is not among them, recommend Jedi to your IDE developers.

Editor Plugins

Vim:

Emacs:

Sublime Text 2/3:

SynWrite:

TextMate:

  • Textmate (Not sure if it’s actually working)

Kate:

Visual Studio Code:

Atom:

SourceLair:

GNOME Builder:

Gedit:

Eric IDE:

Web Debugger:

and many more!

Tab Completion in the Python Shell

Starting with Ipython 6.0.0 Jedi is a dependency of IPython. Autocompletion in IPython is therefore possible without additional configuration.

There are two different options how you can use Jedi autocompletion in your Python interpreter. One with your custom $HOME/.pythonrc.py file and one that uses PYTHONSTARTUP.

Using PYTHONSTARTUP

To use Jedi completion in Python interpreter, add the following in your shell setup (e.g., .bashrc):

export PYTHONSTARTUP="$(python -m jedi repl)"

Then you will be able to use Jedi completer in your Python interpreter:

$ python
Python 2.7.2+ (default, Jul 20 2012, 22:15:08)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.join().split().in<TAB>                     # doctest: +SKIP
os.path.join().split().index   os.path.join().split().insert

Using a custom $HOME/.pythonrc.py

jedi.utils.setup_readline(namespace_module=<module '__main__' from '/home/docs/checkouts/readthedocs.org/user_builds/jedi/envs/latest/bin/sphinx-build'>)[source]

Install Jedi completer to readline.

This function setups readline to use Jedi in Python interactive shell. If you want to use a custom PYTHONSTARTUP file (typically $HOME/.pythonrc.py), you can add this piece of code:

try:
    from jedi.utils import setup_readline
    setup_readline()
except ImportError:
    # Fallback to the stdlib readline completer if it is installed.
    # Taken from http://docs.python.org/2/library/rlcompleter.html
    print("Jedi is not installed, falling back to readline")
    try:
        import readline
        import rlcompleter
        readline.parse_and_bind("tab: complete")
    except ImportError:
        print("Readline is not installed either. No tab completion is enabled.")

This will fallback to the readline completer if Jedi is not installed. The readline completer will only complete names in the global namespace, so for example:

ran<TAB>

will complete to range

with both Jedi and readline, but:

range(10).cou<TAB>

will show complete to range(10).count only with Jedi.

You’ll also need to add export PYTHONSTARTUP=$HOME/.pythonrc.py to your shell profile (usually .bash_profile or .profile if you use bash).