Difference between revisions of "Python"
(pyregexp is deprecated in favor of visual-regexp / visual-regexp-steroids) |
(correct headline formatting) |
||
Line 1: | Line 1: | ||
− | = Default modes = | + | == Default modes == |
There are a number of python modes for Emacs. | There are a number of python modes for Emacs. | ||
fgallina's [https://github.com/fgallina/python.el python.el] is the python.el included in Emacs 24.2 and onwards. | fgallina's [https://github.com/fgallina/python.el python.el] is the python.el included in Emacs 24.2 and onwards. | ||
− | = All-in-one solutions = | + | == All-in-one solutions == |
− | == emacs-for-python == | + | === emacs-for-python === |
'''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. | '''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. | ||
Line 12: | Line 12: | ||
[https://github.com/gabrielelanaro/emacs-for-python/ emacs-for-python at github] | [https://github.com/gabrielelanaro/emacs-for-python/ emacs-for-python at github] | ||
− | == Elpy == | + | === Elpy === |
'''Elpy''' is a collection of elisp packages for Python too. | '''Elpy''' is a collection of elisp packages for Python too. | ||
Line 19: | Line 19: | ||
− | = Refactoring = | + | == Refactoring == |
− | == rope & ropemacs == | + | === rope & ropemacs === |
− | === Presentation === | + | ==== Presentation ==== |
'''rope''' is a library for refactoring and manipulating Python code, '''pymacs''' is an interface between emacs lisp and python, and '''{{ModeLink|ropemacs}}''' is an Emacs interface to the rope library which uses rope and pymacs. | '''rope''' is a library for refactoring and manipulating Python code, '''pymacs''' is an interface between emacs lisp and python, and '''{{ModeLink|ropemacs}}''' is an Emacs interface to the rope library which uses rope and pymacs. | ||
Line 46: | Line 46: | ||
* Generating python elements | * Generating python elements | ||
− | === Installation === | + | ==== Installation ==== |
− | ==== With el-get ==== | + | ===== With el-get ===== |
So an easy way is to use an [[el-get]] recipe: '''M-x el-get-install ropemacs'''. It installs and build Pymacs, rope and ropemacs. The difference from the solution using pip is that it setups the Emacs side of Pymacs correctly. | So an easy way is to use an [[el-get]] recipe: '''M-x el-get-install ropemacs'''. It installs and build Pymacs, rope and ropemacs. The difference from the solution using pip is that it setups the Emacs side of Pymacs correctly. | ||
− | ==== Manually ==== | + | ===== Manually ===== |
You can follow the instructions as given [http://stackoverflow.com/a/22496541/4018217 here] ,if you don't want to use marmalade you can use the following instructions . | You can follow the instructions as given [http://stackoverflow.com/a/22496541/4018217 here] ,if you don't want to use marmalade you can use the following instructions . | ||
Line 91: | Line 91: | ||
use c-xpl to load ropemacs.Read more about it [https://github.com/python-rope/ropemacs#setting-up here] | use c-xpl to load ropemacs.Read more about it [https://github.com/python-rope/ropemacs#setting-up here] | ||
− | == Rope & traad == | + | === Rope & traad === |
[https://github.com/abingham/traad Traad] is a client-server approach to using the rope Python refactory library. It involves two basic components: | [https://github.com/abingham/traad Traad] is a client-server approach to using the rope Python refactory library. It involves two basic components: | ||
Line 100: | Line 100: | ||
So traad aims to simplify communication with rope running in an independent process. HTTP communication and JSON data handling is well supported in many, many languages, so any environment that wants to use rope should be able to easily communicate with traad. | So traad aims to simplify communication with rope running in an independent process. HTTP communication and JSON data handling is well supported in many, many languages, so any environment that wants to use rope should be able to easily communicate with traad. | ||
− | = Auto-Completion = | + | == Auto-Completion == |
− | == Jedi == | + | === Jedi === |
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 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. | ||
Line 113: | Line 113: | ||
Jedi's official page: http://jedi.jedidjah.ch/en/latest/ | Jedi's official page: http://jedi.jedidjah.ch/en/latest/ | ||
− | === Installation === | + | ==== Installation ==== |
Install Jedi.el via el-get, Marmalade or MELPA (see install for more info) and add this to your Emacs configuration: | Install Jedi.el via el-get, Marmalade or MELPA (see install for more info) and add this to your Emacs configuration: | ||
Line 124: | Line 124: | ||
''Note'': it's nice to use it in a python interpreter inside emacs :) | ''Note'': it's nice to use it in a python interpreter inside emacs :) | ||
− | == Anaconda == | + | === Anaconda === |
'''Anaconda-mode''' is a mode for '''code navigation, documentation lookup''' and '''completion''' for Python. | '''Anaconda-mode''' is a mode for '''code navigation, documentation lookup''' and '''completion''' for Python. | ||
Line 140: | Line 140: | ||
The package is available in [[MELPA]]. For more information, [https://github.com/proofit404/anaconda-mode read its documentation]. | The package is available in [[MELPA]]. For more information, [https://github.com/proofit404/anaconda-mode read its documentation]. | ||
− | = Code Checker = | + | == Code Checker == |
− | == Flymake == | + | === Flymake === |
[[Flymake|flymake]] is a on-the-fly syntax checker for Emacs. | [[Flymake|flymake]] is a on-the-fly syntax checker for Emacs. | ||
Line 151: | Line 151: | ||
Don't forget about '''pylint''' too. | Don't forget about '''pylint''' too. | ||
− | = Indexing sources: ctags, cscope, pycscope = | + | == Indexing sources: ctags, cscope, pycscope == |
Indexing sources allows you to do neat things, like going to the definition of a function or finding which functions are calling another one. | Indexing sources allows you to do neat things, like going to the definition of a function or finding which functions are calling another one. | ||
− | == etags, ctags == | + | === etags, ctags === |
'''Etags''' (Exuberant Ctags) generates an index (or tag) file of language objects found in source files that allows these items to be quickly and easily located by a text editor or other utility. A tag signifies a language object for which an index entry is available (or, alternatively, the index entry created for that object). Etags is a multilingual implementation of '''ctags'''. | '''Etags''' (Exuberant Ctags) generates an index (or tag) file of language objects found in source files that allows these items to be quickly and easily located by a text editor or other utility. A tag signifies a language object for which an index entry is available (or, alternatively, the index entry created for that object). Etags is a multilingual implementation of '''ctags'''. | ||
Line 161: | Line 161: | ||
The primary use for the tags files is looking up class/method/function/constant/etc declaration/definitions. Cscope is more powerful (see below). | The primary use for the tags files is looking up class/method/function/constant/etc declaration/definitions. Cscope is more powerful (see below). | ||
− | === usage === | + | ==== usage ==== |
Generate the tags with this command at the root of your project: | Generate the tags with this command at the root of your project: | ||
Line 171: | Line 171: | ||
Note that projects like [[Projectile]] or [[Helm]] provide an integrated use of etags (finding one, re-generating the index, etc). | Note that projects like [[Projectile]] or [[Helm]] provide an integrated use of etags (finding one, re-generating the index, etc). | ||
− | == cscope == | + | === cscope === |
'''cscope''' is a much more powerful beast. While it operates on more or less the same principle (generating a file of useful metadata) it allows you do some fancier things like find all references to a symbol, see where a function is being invoked, etc.+ (you can find definitions as well). | '''cscope''' is a much more powerful beast. While it operates on more or less the same principle (generating a file of useful metadata) it allows you do some fancier things like find all references to a symbol, see where a function is being invoked, etc.+ (you can find definitions as well). | ||
Line 177: | Line 177: | ||
It was originally designed for C and C++, but thanks to version 0.3 of '''pycscope''', pythonistas can make use of it. | It was originally designed for C and C++, but thanks to version 0.3 of '''pycscope''', pythonistas can make use of it. | ||
− | === usage === | + | ==== usage ==== |
The following commands should get you running: | The following commands should get you running: | ||
Line 192: | Line 192: | ||
When done, you can either enable the mode with '''cscope-minor-mode''' (which will add a menu you are free to explore) or call some functions like {{Command|cscope-find-global-definition}}, {{Command|cscope-find-functions-calling-this-function}}, etc. | When done, you can either enable the mode with '''cscope-minor-mode''' (which will add a menu you are free to explore) or call some functions like {{Command|cscope-find-global-definition}}, {{Command|cscope-find-functions-calling-this-function}}, etc. | ||
− | === Interactivity with helm-cscope === | + | ==== Interactivity with helm-cscope ==== |
You can do all that interactively with [https://github.com/sergey-pashaev/helm-cscope helm-cscope]: when you are on symbol, just call {{Command|helm-cscope-find-global-definition}} (for example) and enjoy the nice interactive interface. | You can do all that interactively with [https://github.com/sergey-pashaev/helm-cscope helm-cscope]: when you are on symbol, just call {{Command|helm-cscope-find-global-definition}} (for example) and enjoy the nice interactive interface. | ||
− | = Debugging = | + | == Debugging == |
− | == Ipdb, ipython debugger == | + | === Ipdb, ipython debugger === |
If you call ipdb, the execution will stop and give a nice ipython-looking prompt. | If you call ipdb, the execution will stop and give a nice ipython-looking prompt. | ||
Line 214: | Line 214: | ||
</source> | </source> | ||
− | == pdb track == | + | === pdb track === |
If you use emacs-for-python given above, you can track your source code while debugging with pdbtrack. | If you use emacs-for-python given above, you can track your source code while debugging with pdbtrack. | ||
Line 220: | Line 220: | ||
A tool to use in a non-emacs terminal would be [https://pypi.python.org/pypi/pdbpp/ pdbpp] | A tool to use in a non-emacs terminal would be [https://pypi.python.org/pypi/pdbpp/ pdbpp] | ||
− | = Documentation = | + | == Documentation == |
− | == Eldoc: argument list in the echo area == | + | === Eldoc: argument list in the echo area === |
Eldoc is a MinorMode which shows you, in the echo area, the argument list of the function call you are currently writing. It works out of the box for elisp editing and for modes that implement its support, such as python-mode. You just have to call '''eldoc-mode'''. | Eldoc is a MinorMode which shows you, in the echo area, the argument list of the function call you are currently writing. It works out of the box for elisp editing and for modes that implement its support, such as python-mode. You just have to call '''eldoc-mode'''. | ||
Line 230: | Line 230: | ||
(add-hook 'python-mode-hook 'eldoc-mode) | (add-hook 'python-mode-hook 'eldoc-mode) | ||
− | == helm-pydoc == | + | === helm-pydoc === |
'''helm-pydoc''' is a little utility that lets you interactively select a module you want read the doc and displays it in another buffer. | '''helm-pydoc''' is a little utility that lets you interactively select a module you want read the doc and displays it in another buffer. | ||
− | == pydoc linkification == | + | === pydoc linkification === |
If you've ever used the emacs lisp documentation system, you may find that the pydoc is poorer in functionnalities: | If you've ever used the emacs lisp documentation system, you may find that the pydoc is poorer in functionnalities: | ||
Line 242: | Line 242: | ||
John Kitchin's pydoc aims at fixing that with more enhancements, like a bit of source fontification. See more at [http://kitchingroup.cheme.cmu.edu/blog/2014/12/20/A-new-mode-for-Python-documentation/ his presentation] and [https://github.com/jkitchin/jmax/blob/master/pydoc.el on github]. | John Kitchin's pydoc aims at fixing that with more enhancements, like a bit of source fontification. See more at [http://kitchingroup.cheme.cmu.edu/blog/2014/12/20/A-new-mode-for-Python-documentation/ his presentation] and [https://github.com/jkitchin/jmax/blob/master/pydoc.el on github]. | ||
− | == info format == | + | === info format === |
Another way to read the python documentation is in the texinfo format. You'll need to install the package '''python-info''' [http://melpa.org/#/python-info on MELPA] and go through [https://bitbucket.org/jonwaltman/pydoc-info/ the installation process]. | Another way to read the python documentation is in the texinfo format. You'll need to install the package '''python-info''' [http://melpa.org/#/python-info on MELPA] and go through [https://bitbucket.org/jonwaltman/pydoc-info/ the installation process]. | ||
− | = Other tools = | + | == Other tools == |
− | == Virtual environments == | + | === Virtual environments === |
Some tools allow to apply the changes of virtual environment activation inside emacs. They make '''M-x compile''' aware of the environment, etc. | Some tools allow to apply the changes of virtual environment activation inside emacs. They make '''M-x compile''' aware of the environment, etc. | ||
Line 256: | Line 256: | ||
* [https://github.com/jorgenschaefer/pyvenv pyvenv] sets the python path, uses virtualwrapper's hooks, ... | * [https://github.com/jorgenschaefer/pyvenv pyvenv] sets the python path, uses virtualwrapper's hooks, ... | ||
− | == Pymacs == | + | === Pymacs === |
'''{{ModeLink|Pymacs}}''' is an Emacs extension that enables the use of Python alongside with Emacs Lisp. | '''{{ModeLink|Pymacs}}''' is an Emacs extension that enables the use of Python alongside with Emacs Lisp. | ||
Line 262: | Line 262: | ||
[http://pymacs.progiciels-bpi.ca/index.html Pymacs homepage] | [http://pymacs.progiciels-bpi.ca/index.html Pymacs homepage] | ||
− | == Auto include import statements == | + | === Auto include import statements === |
[[Ropemacs]] (see above) is a plugin for performing python refactorings in emacs. It uses rope library and pymacs. It has '''rope-auto-import''', so if you write | [[Ropemacs]] (see above) is a plugin for performing python refactorings in emacs. It uses rope library and pymacs. It has '''rope-auto-import''', so if you write | ||
Line 276: | Line 276: | ||
Unfortunately Ropemacs can not do non-relative imports, it can only create imports of the "from X import Y" variety (if you type ''shutil.rmtree'' it doesn't write ''import shutil''). | Unfortunately Ropemacs can not do non-relative imports, it can only create imports of the "from X import Y" variety (if you type ''shutil.rmtree'' it doesn't write ''import shutil''). | ||
− | == Sort import statements == | + | === Sort import statements === |
See the '''py-isort''' [[Melpa]] package to automatically sort import statements. | See the '''py-isort''' [[Melpa]] package to automatically sort import statements. | ||
− | == pip-requirements mode == | + | === pip-requirements mode === |
[http://melpa.org/#/pip-requirements pip-requirements] (in MELPA) is a major mode for editing pip requirements files, with the following features: | [http://melpa.org/#/pip-requirements pip-requirements] (in MELPA) is a major mode for editing pip requirements files, with the following features: | ||
Line 287: | Line 287: | ||
* togglable comments | * togglable comments | ||
− | = See also = | + | == See also == |
You'll be certainly interested in the following packages (that you will find on [[ELPA]] or MELPA): | You'll be certainly interested in the following packages (that you will find on [[ELPA]] or MELPA): |
Revision as of 18:59, 6 March 2015
Default modes
There are a number of python modes for Emacs. fgallina's python.el is the python.el included in Emacs 24.2 and onwards.
All-in-one solutions
emacs-for-python
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
Elpy is a collection of elisp packages for Python too.
https://github.com/jorgenschaefer/elpy/wiki/Features
Refactoring
rope & ropemacs
Presentation
rope is a library for refactoring and manipulating Python code, pymacs is an interface between emacs lisp and python, and ropemacs is an Emacs interface to the rope library which uses rope and pymacs.
If you do some search and replace of code objects in your code and find it sometimes tricky, and/or you need to do it in more than one file, then you should consider a good tool of refactoring.
But Rope can do more than this simple example, it can:
- Rename anything
- Extract method/local variable
- Change method signature
- Perform cross-project refactorings
- Support Mercurial, GIT, Darcs and SVN in refactorings
Rope can also help IDE's with:
- Auto-completion
- Finding definition location
- Getting pydoc
- Finding occurrences
- Organizing imports (removing unused and duplicate imports and sorting them)
- Generating python elements
Installation
With el-get
So an easy way is to use an el-get recipe: M-x el-get-install ropemacs. It installs and build Pymacs, rope and ropemacs. The difference from the solution using pip is that it setups the Emacs side of Pymacs correctly.
Manually
You can follow the instructions as given here ,if you don't want to use marmalade you can use the following instructions .
sudo pip install rope ropemacs
As of February 2014 you can't install Pymacs via pip, therefore:
git clone http://github.com/pinard/pymacs cd pymacs make check sudo make install
make check ensures the prerequisites. sudo make install puts Pymacs module in Python local modules path, usually /usr/local/lib/python2.7/dist-packages/. People generally frown upon make install, because if you lose the Makefile, it can become hard to cleanly uninstall. But you shouldn't fear it, as pip uses the same directory, so pip uninstall pymacs will work.
After you do the make install of pymacs do not delete the folder.Copy the file pymacs.el to ~/.emacs.d/site-lisp/
Now add path of pyamcs.el to your ~/.emacs file,using this code:
(setq emacs-config-path "~/.emacs.d/") (setq base-lisp-path "~/.emacs.d/site-lisp/") (setq site-lisp-path (concat emacs-config-path "/site-lisp")) (defun add-path (p) (add-to-list 'load-path (concat base-lisp-path p))) (add-path "") (add-to-list 'load-path "~/.emacs.d")
You can now lazily load ropemacs or load it at runtime.For lazy evaluation add this to your .emacs file:
(defun load-ropemacs () "Load pymacs and ropemacs" (interactive) (require 'pymacs) (pymacs-load "ropemacs" "rope-") ;; Automatically save project python buffers before refactorings (setq ropemacs-confirm-saving 'nil) ) (global-set-key "\C-xpl" 'load-ropemacs)
use c-xpl to load ropemacs.Read more about it here
Rope & traad
Traad is a client-server approach to using the rope Python refactory library. It involves two basic components:
- A HTTP server exposing the rope API via JSON, and
- Client libraries for talking to the server
Since rope is written in Python, any tool that wants to use rope needs to either embed Python, or it needs to find a way to communicate with a Python process running rope. The embedding approach is difficult if the target environment is not written in Python, and it also faces challenges when dealing with more than one Python version.
So traad aims to simplify communication with rope running in an independent process. HTTP communication and JSON data handling is well supported in many, many languages, so any environment that wants to use rope should be able to easily communicate with traad.
Auto-Completion
Jedi
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 works out of the box.
See screenshots and get the full documentation : http://tkf.github.io/emacs-jedi/released/
Jedi's official page: http://jedi.jedidjah.ch/en/latest/
Installation
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
Note: it's nice to use it in a python interpreter inside emacs :)
Anaconda
Anaconda-mode is a mode for code navigation, documentation lookup and completion for Python.
It runs on emacs 24.3 with python >= 2.6.
It provides:
- context-sensitive code completion for Python
- jump to definition
- find references
- view documentation
- virtualenv management
The package is available in MELPA. For more information, read its documentation.
Code Checker
Flymake
flymake is a on-the-fly syntax checker for Emacs. We can use it alongside with flyspell.
To run pep8, pylint, pyflakes and unit-tests (with nose), you can be interested in using flymake-python.
Don't forget about pylint too.
Indexing sources: ctags, cscope, pycscope
Indexing sources allows you to do neat things, like going to the definition of a function or finding which functions are calling another one.
etags, ctags
Etags (Exuberant Ctags) generates an index (or tag) file of language objects found in source files that allows these items to be quickly and easily located by a text editor or other utility. A tag signifies a language object for which an index entry is available (or, alternatively, the index entry created for that object). Etags is a multilingual implementation of ctags.
The primary use for the tags files is looking up class/method/function/constant/etc declaration/definitions. Cscope is more powerful (see below).
usage
Generate the tags with this command at the root of your project:
find . -name "*.py" -print | etags -
it creates the file TAGS.
Note that projects like Projectile or Helm provide an integrated use of etags (finding one, re-generating the index, etc).
cscope
cscope is a much more powerful beast. While it operates on more or less the same principle (generating a file of useful metadata) it allows you do some fancier things like find all references to a symbol, see where a function is being invoked, etc.+ (you can find definitions as well).
It was originally designed for C and C++, but thanks to version 0.3 of pycscope, pythonistas can make use of it.
usage
The following commands should get you running:
apt-get install cscope pip install pycscope # in project base dir: find . -name '*.py' > cscope.files cscope -R
now install the xcscope emacs package with ELPA and require it:
(require 'xcscope)
When done, you can either enable the mode with cscope-minor-mode (which will add a menu you are free to explore) or call some functions like M-x cscope-find-global-definition, M-x cscope-find-functions-calling-this-function, etc.
Interactivity with helm-cscope
You can do all that interactively with helm-cscope: when you are on symbol, just call M-x helm-cscope-find-global-definition (for example) and enjoy the nice interactive interface.
Debugging
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)
pdb track
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
Documentation
Eldoc: argument list in the echo area
Eldoc is a MinorMode which shows you, in the echo area, the argument list of the function call you are currently writing. It works out of the box for elisp editing and for modes that implement its support, such as python-mode. You just have to call eldoc-mode.
To always enable it:
(add-hook 'python-mode-hook 'eldoc-mode)
helm-pydoc
helm-pydoc is a little utility that lets you interactively select a module you want read the doc and displays it in another buffer.
pydoc linkification
If you've ever used the emacs lisp documentation system, you may find that the pydoc is poorer in functionnalities:
- there is no direct link to code source
- there is no "back" button
John Kitchin's pydoc aims at fixing that with more enhancements, like a bit of source fontification. See more at his presentation and on github.
info format
Another way to read the python documentation is in the texinfo format. You'll need to install the package python-info on MELPA and go through the installation process.
Other tools
Virtual environments
Some tools allow to apply the changes of virtual environment activation inside emacs. They make M-x compile aware of the environment, etc.
- virtualenvwrapper emulates much of the functionnality of virtualenvwrapper, integrates well with M-x shell or eshell, is aware of hooks, has an automatic activation by project and integrates in the mode line.
- pyvenv sets the python path, uses virtualwrapper's hooks, ...
Pymacs
Pymacs is an Emacs extension that enables the use of Python alongside with Emacs Lisp.
Auto include import statements
Ropemacs (see above) is a plugin for performing python refactorings in emacs. It uses rope library and pymacs. It has rope-auto-import, so if you write
rmtree
and then execute M-x rope-auto-import,
from shutil import rmtree
is inserted at the top of the file.
Unfortunately Ropemacs can not do non-relative imports, it can only create imports of the "from X import Y" variety (if you type shutil.rmtree it doesn't write import shutil).
Sort import statements
See the py-isort Melpa package to automatically sort import statements.
pip-requirements mode
pip-requirements (in MELPA) is a major mode for editing pip requirements files, with the following features:
- syntax highlighting
- Auto completion of package names from PyPI
- togglable comments
See also
You'll be certainly interested in the following packages (that you will find on ELPA or MELPA):
- Magit, a git interface. Emacs + git is magic : see magit
- Yasnippet, a template system: yasnippet
- helm-pydoc to browse the documentation of installed packages and import one
- pungi to integrate jedi, virtualenv and buildout.
- how to do code folding
- other ELPA packages
If you're running Emacs 24, check out what is available in ELPA:
- M-x list-packages
- and see flymake-pyhon-pyflakes, flymake-shell, abl-mode (a python TDD minor-mode), nose (easy python test-running in emacs), visual-regexp / visual-regexp-steroids, python-magic and more.