'''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 is originally designed for C and C++, but thanks to version 0.3 of '''pycscope''', pythonista can make use of it.

+

+

=== usage ===

−

== Pymacs ==

+

The following commands should get you running:

−

'''{{ModeLink|Pymacs}}''' is an Emacs extension that enables the use of Python alongside with Emacs Lisp.

+

apt-get install cscope

+

pip install pycscope

+

# in project base dir:

+

find . -name '*.py' > cscope.files

+

cscope -R

−

[http://pymacs.progiciels-bpi.ca/index.html Pymacs homepage]

+

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 {{Command|cscope-find-global-definition}}, {{Command|cscope-find-functions-calling-this-function}}, etc.

= Debugging =

= Debugging =

Line 91:

Line 121:

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]

+

+

= Other tools =

+

+

== Pymacs ==

+

+

'''{{ModeLink|Pymacs}}''' is an Emacs extension that enables the use of Python alongside with Emacs Lisp.

+

+

[http://pymacs.progiciels-bpi.ca/index.html Pymacs homepage]

Line 96:

Line 134:

= See also =

= See also =

−

You'll be certainly interested in :

+

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]]

* '''Magit''', a git interface. Emacs + git is magic : see [[magit]]

Line 104:

Line 142:

* '''virtualenvwrapper''', to load a virtualenv (so than you can use it with M-x compile) (available through ELPA)

* '''virtualenvwrapper''', to load a virtualenv (so than you can use it with M-x compile) (available through ELPA)

−

* '''ELPA packages'''

+

* '''helm-pydoc''' to browse the documentation of installed packages and import one

Auto-Completion

rope & ropemacs

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.

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

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 is originally designed for C and C++, but thanks to version 0.3 of pycscope, pythonista can make use of it.

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.

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()`