Anaconda mode |
---|
|
Code navigation, documentation lookup and completion for Python. |
This package support 2.6, 2.7, 3.3 and 3.4 Python versions and provide |
following features |
* context-sensitive code completion |
* jump to definitions |
* find references |
* view documentation |
* virtual environment |
|
Installation |
To use this package you need to install |
package.el |
All you need is install the package from Melpa: |
|
manual |
Clone this repository somewhere and add this directory to you |
|
prelude |
anaconda-mode included into Emacs Prelude distribution. You |
can use it as well. Look at prelude-python module to see more |
details. |
spacemacs |
anaconda-mode included into Spacemacs distribution. You can use |
it as well. Look at |
Configuration |
You can automatically enable anaconda-mode in all python buffers |
with following code in your configuration: |
|
ElDoc |
anaconda-mode provide document function to eldoc-mode . All |
you need is enable |
|
Usage |
To start completion press C-M-i . This is standard emacs binding |
for complete-at-point function. You can use company-mode with |
company-anaconda backend to get more intelligent ui. Or |
auto-complete-mode with ac-anaconda as last try. |
Interactive commands |
Here are interactive commands available with anaconda-mode |
========== ============================== |
Keybinding Description |
========== ============================== |
M-. anaconda-mode-goto-definitions |
M-* anaconda-nav-pop-marker |
M-? anaconda-mode-view-doc |
M-r anaconda-mode-usages |
If goto definitions, assignments or usages cause multiple candidates you'll see advanced anaconda navigator buffer.
Not properly implemented yet
It's possible to use anaconda-mode on remote server when you connect to it using tramp. In case of vagrant you need to use 127.0.0.1
as tramp address.
Anaconda mode comes with anaconda_mode.py
server. This server allow you to use jedi python library over jsonrpc api. Server choice first available port starting from 24970. Anaconda mode will run this server automatically on first call of any anaconda-mode command.
This mean that completion results and reference search depends on your project installation. To make it available for anaconda-mode
you have few options.
Add your project to Emacs PYTHONPATH
. If you store project dependencies somewhere on you machine add its too. :
M-x setenv RET PYTHONPATH RET /path/to/project:/path/to/dependency
Use virtual environment to isolate your project dependencies form other system. You can additionally install you project in editable mode into virtual environment. This will improve usage references search. Then activate this virtual environment inside Emacs.
(setq python-shell-virtualenv-path "/path/to/virtualenv")
I strongly recommended you to use pyenv-mode or similar package to hold python-shell-virtualenv-path
in actual state.
Each action above applies to anaconda-mode
server immediately. Next anaconda-mode
command you call will use this environment for completion candidates search.
Please attach *anaconda-mode*
buffer content to every created issue.
DistutilsOptionError: must supply either home or prefix/exec-prefix -- not both
This occurs due to distutils bug when pip -t
option conflict with distutils.cfg
prefix
option. If you install pip
with homebrew
you are on fire. There are few options to avoid this issue.
- install
anaconda-mode
dependencies manually - remove
prefix
option fromdistutils.cfg
Are very welcome. But any significant change has to be accompanied with tests, both for Emacs Lisp and Python code. To run the test suite, call:
tox
- Dmitry Gutov @dgutov
- Bo Lin @sadboy
- Vasilij Schneidermann @wasamasa
- Fredrik Bergroth @fbergroth
- Fabio Corneti @fabiocorneti
- Tom Davis @tdavis
- Sviridov Alexander @sviridov
- Mario Rodas @marsam