Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tools to aid in browsing/following (large) python projects' source code [closed]

Tags:

python

django

ide

A specific example: becoming familiar with django's project source code (core, contrib, utils, etc.). Example of a useful tool: ctags - it allows you to "jump" to the file+location where a function/method is defined. Wondering about other tools that developers use (example: is there a tool that given a function x(), lists the functions that call x() and that are called by x()?). Thanks.

Edit: added an answer with an aggregate of tools mentioned so far in other answers

like image 995
jd. Avatar asked Jul 02 '09 23:07

jd.


People also ask

What tool does a programmer use to produce Python source code?

Cog is a simple code generation tool written in Python. We use it or its results every day in the production of Kubi. Kubi is a collaboration system embodied in a handful of different products.

How do you write a high quality Python code?

Start writing your code with a bottom-up approach; write independent Python functions that implement focused tasks. Do not hesitate to refactor your code regularly. If your code is becoming too complicated, think about how you can simplify it. Avoid classes when you can.


1 Answers

The following is an aggregate of tools mentioned in other answers...

cscope

http://cscope.sourceforge.net/

wikipedia entry: http://en.wikipedia.org/wiki/Cscope

cscope is a console mode or text-based graphical interface ... It is often used on very large projects to find source code, functions, declarations, definitions and regular expressions given a text string.

pycscope

http://pypi.python.org/pypi/pycscope/

generates a cscope index of Python source trees

ctags and exuberant ctags

http://ctags.sourceforge.net/

http://ctags.sourceforge.net/ctags.html

wikipedia entry: http://en.wikipedia.org/wiki/Ctags

Ctags is a program that generates an index (or tag) file of names found in source and header files of various programming languages. Depending on the language, functions, variables, class members, macros and so on may be indexed. These tags allow definitions to be quickly and easily located by a text editor or other utility.

Eclipse:

http://www.eclipse.org/

wikipedia entry: http://en.wikipedia.org/wiki/Eclipse_%28software%29

Eclipse is a multi-language software development platform comprising an IDE and a plug-in system to extend it. It is written primarily in Java and can be used to develop applications in Java and, by means of the various plug-ins, in other languages as well, including C, C++, COBOL, Python, Perl, PHP, and others.

PyDev

http://pydev.sourceforge.net/

"Pydev is a plugin that enables users to use Eclipse for Python and Jython development -- making Eclipse a first class Python IDE"

Komodo Edit

http://www.activestate.com/komodo_edit/

wikipedia entry: http://en.wikipedia.org/wiki/ActiveState_Komodo

Komodo Edit is a free text editor for dynamic programming languages introduced in January 2007. With the release of version 4.3, Komodo Edit is built on top of the Open Komodo project.

It was developed for programmers who need a multi-language editor with broad functionality, but not the features of an IDE, like debugging, DOM viewer, interactive shells, and source code control integration.

Prashanth's call graph (visualization) tool

http://blog.prashanthellina.com/2007/11/14/generating-call-graphs-for-understanding-and-refactoring-python-code/

Just thought I'd share a link to an interesting small fun script I've found long time ago, that draws a graph of function calls. It works only for simple cases, so "as is" it's more fun than useful.

rope/ropemacs

http://rope.sourceforge.net/ropemacs.html

Ropemacs is a plugin for performing python refactorings in emacs. It uses rope library and pymacs.

http://www.enigmacurry.com/2008/05/09/emacs-as-a-powerful-python-ide/

Wing IDE

http://www.wingware.com/

Wing IDE has goto-definition, find uses, a source browser, refactoring, and other code intelligence features that should help. Another good way to understand unfamiliar Python code is to set a breakpoint, run to it in the debugger, and then go up and down the stack. In Wing Professional you can also use the Debug Probe to interact with and try out things in the debug runtime state (it's a Python shell that runs in the context of the current debug stack frame).

like image 136
8 revs, 3 users 98% Avatar answered Nov 11 '22 14:11

8 revs, 3 users 98%