- 1 Default modes
- 2 All-in-one solutions
- 3 Auto-Completion
- 4 Code Checker
- 5 Other tools
- 6 Debugging
- 7 See also
There are a number of python modes for Emacs. fgallina's python.el is the python.el included in Emacs 24.2 and onwards.
emacs-for-python is a bundle of the above modes (and more), and it's an easy way to turn Emacs into a Python IDE.
Elpy is a collection of elisp packages for Python too.
rope & ropemacs
rope is a library for refactoring and manipulating Python code. ropemacs is an Emacs interface to the rope library.
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 is simple to install and it just works.
See screenshots and get the full documentation : http://tkf.github.io/emacs-jedi/released/
Jedi's official page: http://jedi.jedidjah.ch/en/latest/
Install Jedi.el via el-get, Marmalade or MELPA (see install for more info) and add this to your Emacs configuration:
(add-hook 'python-mode-hook 'jedi:setup) (setq jedi:setup-keys t) ; optional (setq jedi:complete-on-dot t) ; optional
or call M-x jedi:setup
To run pep8, pylint, pyflakes and unit-tests (with nose), you can be interested in using flymake-python.
Don't forget about pylint too.
Pymacs is an Emacs extension that enables the use of Python alongside with Emacs Lisp.
Ipdb, ipython debugger
If you call ipdb, the execution will stop and give a nice ipython-looking prompt. Just add `import ipdb; ipdb.set_trace()`
You can use the following to highlight this line, and not forget it :
; Highlight the call to ipdb ; src http://pedrokroger.com/2010/07/configuring-emacs-as-a-python-ide-2/ (defun annotate-pdb () (interactive) (highlight-lines-matching-regexp "import ipdb") (highlight-lines-matching-regexp "ipdb.set_trace()")) (add-hook 'python-mode-hook 'annotate-pdb)
If you use emacs-for-python given above, you can track your source code while debugging with pdbtrack.
A tool to use in a non-emacs terminal would be pdbpp
You'll be certainly interested in :
Magit, a git interface
Emacs + git is magic : magit
Yasnippet, a template system
If you're running Emacs 24, check out some ELPA packages:
- M-x list-packages
- and see flymake-pyhon-pyflakes, flymake-shell, virtualenv, abl-mode (a python TDD minor-mode), jedi (a python auto-completion for emacs), nose (easy python test-running in emacs), pyregexp, python-magic and more.