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

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
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

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).

You can maybe try cscope! Wikipedia says that
cscope is often used to search content within C or C++ files, but it can be used to search for content in other languages such as Java, Python, PHP and Perl.[citation needed]
And you can also dig in this project.

Many (or even most, I should say) IDE's help you in this by enabling you do go to variable and function definitions, often by just Ctrl+click, or showing you class overviews where you can see all methods and attributes a class has including those inherited, and letting you go to their definition, etc, etc, etc. I can't recommend such a tool highly enough, it's very time-saving for development.
I personally use WingIDE, which is excellent and has all these features, but you should also check out KomodoEdit and Eclipse+PyDev. There maybe more that I don't know of, and it's fully possible that vim and emacs have some sort of plugins for this.

I think Komodo Edit and PyDev allows you to jump to python function defs.

is there a tool that given a function x(), lists the functions that call x() and that are called by x()?
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.
For normal Python development personally I use GNU Emacs with rope/ropemacs (found a video showing the features) and sometimes Eclipse with PyDev.

This is subjective so I think it should probably be a community wiki. That said, the best thing you can probably do to make browsing large projects is to be familiar with hotkeys provided in your favourite IDE. Using the keyboard to browse through large source code is much easier than manually scrolling through text, highlighting text and fumbling through an IDE with a mouse.

Document it as you go. Leave trails, improve the structure, and keep notes. By the time you've found you way around the enter codebase, you'll have a good map.

I like Eclipse and the PyDev plugin. This combination has been very useful to me.

You should notice that cscope targets only the UNIX, Linux OSs.

Related

Python simulator recommendation [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Anyone has any python simulator to recommend? am new to python programming. is there any program similar to codeblocks for C++ programming? Thanks
I think you might be slightly confused over terminology.
The term "simulator" doesn't really mean much in the context of programming. A simulator is something which pretends to be some other platform so you can test code on it. For example, I might use an Android simulator or a Gameboy simulator on my computer so I can test code without having to transfer it all the time.
You might mean "IDE" instead. Codeblocks is an example of an IDE. It stands for "Integrated Development System". It combines a "compiler" (something which turns what you write into executable code) and a specialized "text editor" (a program which lets you write text). It also includes a wide variety of convenient features to make programming in C++ more easy.
Note that you technically don't need an IDE to write code. An IDE combines a compiler (or an interpreter, in the case of Python) with a text editor, and a bunch of extra features for convenience, but this is by no means "necessary", strictly speaking. All you need in order to write code is a text editor of some sort, and a compiler or interpreter.
For example, I typically use either Notepad++ or Vim to write my Python code, and run it directly from the command line.
Regardless, Python has a wide variety of IDEs you can look at. Here is a comparison of the most popular ones.
However, you don't necessarily need a fancy IDE to program in Python! If you just directly install Python, it comes with a simple IDE called "IDLE" which you can use to write and run Python code. If you're new to Python, I recommend you use IDLE for now, until you get the hang of things.
tl;dr
To summarize:
A simulator is a program that pretends to be some other kind of computer/platform. Simulators are used to test code.
An IDE stands for "Integrated Development System" and is used to write and run code.
It combines a compiler or interpreter with a text editor.
There are many IDES for Python. Here is a list.
However, I recommend you use IDLE, which is included by default when you install Python.
Codeblocks does have a plugin for Python: http://wiki.codeblocks.org/index.php?title=Python_plugin . Though, I am not sure, how popular that is!
There was a similar discussion on SO: What IDE to use for Python?

Intellisense for Ruby, Ruby on Rails, Python

Are there any intellisense options for languages like Ruby, Ruby on Rails, Python, etc?
This could include an IDE, if necessary. I'm looking for something like Visual Studio's c# or Eclipse's java intellisense.
Sure are!!
jetbrains has full line of ide's.
PyCharm and RubyMine
http://www.jetbrains.com/ruby/
Because of the dynamic nature of these languages, implementing things like auto-completion is quite difficult, and only works for some cases.
Examples for Python: pydev (eclipse plug-in), rope (this is a refactoring library that can easily be used into emacs),anyting with ipython (again, an emacs mode).
Anyways, don't expect them to be as powerful as the tools you have for Java or C#.
Rope for example, does a bit of type inference to figure out parameter types in order to give you completion suggestions. This might take an awfully long amount of time for big codebases, thus making the feature useless on such codebases.
anyting with ipython on the other hand actually spawns a background python process that imports your current module and any modules it references, and does runtime checking on entities (classes, functions, global variables...) in those modules. Because it doesn't do type inference, it can't give you any auto-completion suggestions for variables passed as parameters or local variables.
My vim setup uses the supertabcomplete, snipmate, and python-mode plugins for mostly intellisense completion.
It's windows centric, because that is what I develop on, but just change the paths in the vimrc file after cloning and you should be up and functional.
Sublime Text 2 also supports this to a limited extent. Auto-completion is very difficult for dynamic languages, so this will display recently use variables/methods, and anything else that is nearby that matches the fuzzy text filter.
Use vim with dot files which includes syntax highlight, smart indentation, auto-complete for Ruby among other features. Although it had been worked for MacOS, but you can easily adapt to your OS if you're using other.
Another option includes Aptana for Eclipse or Jetbrains RubyMine. So try all the solutions and decide what best fits your needs.

How to become productive using Vim/Emacs [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I've been an Eclipse user for the last 3 years or more. I do Java EE (and Spring) development in it and so far I've done 90% of my tasks without having to touch the mouse. Typically my Eclipse setup is as follow:
Subclipse (or alternatively I use command line)
m2clipse (Maven Eclipse plugin)
Data Source Explorer (dealing with SQL)
The typical Eclipse activities I do (and would like to transfer that to Vim/Emacs) are (this is for multi-module/multi-projects/multi-folder source code):
Refactor (rename method throughout the whole "open project")
Jump to class implementation
Search for all usage of a particular class or method
Updating dependencies (3rd party JARs) via maven pom.xml
Jump to the 3rd party library implementation (maven can download the source.jar if local repository does not have it, eclipse will bring me to the actual Java code for let say, Hibernate entity manager implementation).
Write and run unit-test
All of the above activities would not require me to use mouse. There are a few activities where I would need to use a little bit of mouse such as Global Search file
Lately I've been wanting to try development using VMs. The idea here is to create a barebone VM (let's say to use Ubuntu Server) and start coding there or use Putty/SSH.
I have a MacBook Pro 13" which would benefit of using VIM/Emacs or any lightweight editor.
There are 2 major goals:
Mobility (as in, travelling and coding)
VM as development environment
Tools I'd like to use are as follow:
Linux
Ruby, Python, PHP (and occasionally maybe even Java but definitely not Microsoft .NET)
Any RDBMS
Any build/dependency system
Unit-testing framework
What would you recommend: VIM? Emacs? Others? What about other tools? Gnu Screen, ctags, etc.
Help me build my dream environment: lightweight, productive, easily replicable :)
Thanks!
If you ask a question which involves "vim OR emacs" you will never get an useful answer. It's a religious question, which does not have a correct answer! That said, you should clearly use Vim! ;-)
But seriously: Vim is much more lightweight, so it might better suite the scenario you are describing. Vim can be scripted in different languages and you can find many useful scripts at www.vim.org.
Emacs is "heavier", but Lisp is a very powerful scripting languages. So Emacs is much more of a general tool than just a text editor. IDE functionality (like project management) is something I'm missing from time to time in Vim. There are some scripts to do that, but I don't like them. If you need that, I would go for Emacs.
I am an Emacs guy (using vi only to edit configuration files under /etc). I think that with Emacs, you should start it at most daily (and it is very different with vim), and you should configure it in your .emacs file. For example, I compile using the F12 key, with (global-set-key [f12] 'recompile) in my .emacs.
I am vim guy, using it for Perl scripting for around 6 years - and happy with it still - so using it for writing any scripts you said should also be easy & interesting in vim. Once start learning vim - you will definitely like it very much because of the tons of features it has !
I would like to highlight a couple of vim plugins which can give you an IDE feel ! ( but cant make it as real IDE ! )
Make Vim as Your Perl IDE Using perl-support.vim Plugin
Ctags and Taglist: Convert Vim Editor to Beautiful Source Code Browser for Any Programming Language
Tutorial: Make Vim as Your C/C++ IDE Using c.vim Plugin
And I believe vim definitely doesn't need mouse !
And you can find a couple of other features explained here in series of articles vim tips and tricks ( some of them were written by me. )
For Java development Eclipse has lots of features which you'll miss from Emacs or VIM. However, there is a project which makes it possible to access these features from other editors. You may find it useful to make up for missing features.
By the way, if you approach other editors with an Eclipse mindset then almost certainly you will be disappointed, because these editors are built on different philosophies. Their strengths lay elsewhere than the strengths of Eclipse.
Either of those text editors will have a learning curve. That being said I have successfully used emacs to do the following tasks that are in line w/ what you've asked:
Write PL/SQL and execute it on an oracle DB all from the editor.
Write, Compile, Run java.
Edit pom files.
Keep a pretty good TODO list in org mode.
You can launch a shell in emacs, and that feature alone does MOST of what you've asked for (SVN, make/ant/mvn/etc).
If you're jumping into one of these editors and hoping for pretty eclipse and vis studio features such as the green junit bar, i'm not sure that they exist. Eclipse' refactor tool works pretty well too and I don't know what is possible in emacs. Though with emacs, I've found that someone has typically written some extension to do what i want, you just need to be able to find it and learn how to use it. I'm an emacs neophyte at best but in scaled down projects I've found it to be pretty efficient and I don't have to take my hands off the keyboard very much.
Disclaimer(java/ee/spring eclipse developer by day that messes around with lua and the love framework using emacs at night)

Looking for a bare-bones open-source editor written in python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm looking for a bare bones cross platform editor written in python that I can pick up and customize. The fewer dependencies the better.
Please note: I'm not looking for a python editor or python IDE. Just a no-frills editor, that
I can use as a base for an app that I'm starting on.
Must be open source and free to modify for commercial use since I intend to use this for work.
There is a complete editor written in wxPython here:
http://wiki.wxpython.org/WxHowtoSmallEditor
Only 104 lines, should be easy to customize.
EDIT:
To address some of your requirements, here is a copy and paste from the wxPython wiki:
A GUI Toolkit
wxPython is a GUI toolkit for the Python programming language. It allows Python programmers to create programs with a robust, highly functional graphical user interface, simply and easily. It is implemented as a Python extension module (native code) that wraps the popular wxWindows cross platform GUI library, which is written in C++.
Open Source
Like Python and wxWindows, wxPython is Open Source which means that it is free for anyone to use and the source code is available for anyone to look at and modify. Anyone can contribute fixes or enhancements to the project.
Cross Platform
wxPython is a cross-platform toolkit. This means that with a little care that the same program will run on multiple platforms without modification. Currently supported platforms are Microsoft Windows, and most Unix or unix-like systems with GTK available, and OS X 10.3.9 or above.
How about IDLE? IDLE is included in the standard Python distro. From the docs:
"
IDLE has the following features:
coded in 100% pure Python, using the tkinter GUI toolkit
cross-platform: works on Windows and Unix
multi-window text editor with multiple undo, Python colorizing and many other features, e.g. smart indent and call tips
Python shell window (a.k.a. interactive interpreter)
debugger (not complete, but you can set breakpoints, view and step)
"
With some work, you could probably rip out the editor component from IDLE.
Have a look in the idlelib directory of your Python standard library.
check out:
Scitilla/SciTE
http://www.scintilla.org/SciTE.html
Editra
http://editra.org/
both are cross platform and written in Python. They are full featured editors, but barebones compared to an IDE or such.
Here's a complete editor written in wxPython. It has more functionality than the editor suggested by Andre. It does not yet have a stable release though. https://github.com/0b0bby0/wxEditor.git
It depends on how much functionality you want.

What's a good IDE for Python on Mac OS X? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm about to start a new job where the coding practices are heavily centered around TDD and refactoring, and whose primary development language is Python. I come from the Java world, and have been a confident user of Eclipse for a good, long time. When not working in Java, I use emacs.
I'm looking for an IDE for Python that will give me a lot of the capabilities I've grown used to with Eclipse, not only for refactoring but in terms of code completion, project management, SCM integration (currently CVS, but likely to switch to git one of these days) et al.
What IDE should I use?
My 2 pennies, check out PyCharm
http://www.jetbrains.com/pycharm/
(also multi-platform)
Have tried many different (Kate, Eclipse, Scite, Vim, Komodo): each one have some glitches, either limited functions, or slow and unresponsive. Final choice after many years: Emacs + ropemacs + flymake. Rope project file open dialog is extremely quick. Rope refactoring and code assist functions are super helpful. Flymake shows syntax mistakes. Emacs is the most configurable editor. I am very happy with this config. Python related part of config is here: public.halogen-dg.com browser/alex-emacs-settings/configs/cfg_python.el
I use TextMate for all my Python programming needs. It's not an IDE per se, but it does a lot of stuff that an IDE does (without all the cruft of an IDE). It has syntax highlighting, code folding, integration with various SCMs through the use of additional bundles (I know it supports SVN, Git, Mercurial, Darcs, and probably a few others). It's also quite extensible and customizable (again, through the use of bundles). It also has a basic concept of projects. One place where it doesn't shine, though, is in code completion; some bundles have limited support for code completion, but it's generally not as amazing as that of most language-specific IDEs. Given how awesome TextMate is, though, I don't know sacrificing that. TextMate's definitely made me much more productive.
Pydev for Eclipse, as others have mentioned, is good.
Netbeans has a beta Python plugin that is a little rough around the edges, but could turn into something really cool.
Additionally there is a long list of programming centric text editors for the mac, that may or may not fit your needs.
Textmate - costs money, people love this program, but I haven't used it enough to see what all the fuss is about.
Jedit - Java based text editor, has some nice features, but the startup time isn't great (due to Java).
CarbonEmacs - Decent Emacs port.
AquaEmacs - Better Emacs port.
TextWrangler - Lite, free (as in beer) verision of BBEdit.
BBEdit - The old guard. The defacto editor before Textmate stole its limelight. Expensive.
Smultron - Very nice editor, the UI is similar to Textmate.
Idle - Python's own little editor, has some nice features, but also some major problems. I've personally found it too unstable for my usage.
Sublime Text - This is really sweet text editor that has some surprisingly good Python support.
Pycharm - Another solid full on IDE for Python.
Eclipse with Pydev works best for me on any platform.
I really enjoy using PyCharm. http://www.jetbrains.com/pycharm/
macvim + pyflakes.vim
I like Spyder, it has many tools, such as profiling, intelligent indentation helper and a good autocompletion support
https://code.google.com/p/spyderlib/
I usually use either komodo edit or aquamacs with ropemacs. Although I should warn you, IDE features won't be what you're used to if you're coming from a Java or C# background. I personally find that powerful IDEs get in my way more than they help.
UPDATE: I should also point out that if you have the money Komodo IDE is worth it. It's the paid version of Komodo Edit.
If you have a budget for your IDE, you should give Wingware Professional a try, see wingware.com .
I've used WingIDE and have been very happy. Intellisense is pretty good, some other things are a bit wacky but overall it's a very productive tool
If you are looking for an interactive environment and not needing to code modules, I would suggest IPython. Though this is developed with scientists/statisticians in mind, it will run just as well without any of the scientific packages installed. The features are powerful, with code completion, integrated help, integrated debugging, etc., and it functions as a notebook with Markdown and MathJax integration. By far the best choice for those that need powerful features without wishing to load megabytes of GUI into RAM--since it is browser based, it is used in your always loaded chrome/safari instance. ;-)
Eclipse PyDev plugin.
http://pydev.sourceforge.net/
since you are familiar with Eclipse maybe you are interested in Pydev
Python support on netbeans is surprisingly good, and comes with most of the features you're looking for.
TextMate or Panic's Coda. NetBeans works very well, if you want a full-blown kitchen sink IDE.
"Which editor/IDE for ...?" is a longstanding way to start a "My dog is too prettier than yours!" slapfest. Nowadays most editors from vim upwards can be used, there are multiple good alternatives, and even IDEs that started as C or Java tools work pretty well with Python and other dynamic languages.
That said, having tried a bunch of IDEs (Eclipse, NetBeans, XCode, Komodo, PyCharm, ...), I am a fan of ActiveState's Komodo IDE. I use it on Mac OS X primarily, though I've used it for years on Windows as well. The one license follows you to any platform.
Komodo is well-integrated with popular ActiveState builds of the languages themselves (esp. for Windows), works well with the fabulous (and Pythonic) Mercurial change management system (among others), and has good-to-excellent abilities for core tasks like code editing, syntax coloring, code completion, real-time syntax checking, and visual debugging. It is a little weak when it comes to pre-integrated refactoring and code-check tools (e.g. rope, pylint), but it is extensible and has a good facility for integrating external and custom tools.
Some of the things I like about Komodo go beyond the write-run-debug loop. ActiveState has long supported the development community (e.g. with free language builds, package repositories, a recipes site, ...), since before dynamic languages were the trend. The base Komodo Edit editor is free and open source, an extension of Mozilla's Firefox technologies. And Komodo is multi-lingual. I never end up doing just Python, just Perl, or just whatever. Komodo works with the core language (Python, Perl, Ruby, PHP, JavaScript) alongside supporting languages (XML, XSLT, SQL, X/HTML, CSS), non-dynamic languages (Java, C, etc.), and helpers (Makefiles, INI and config files, shell scripts, custom little languages, etc.) Others can do that too, but Komodo puts them all in once place, ready to go. It's a Swiss Army Knife for dynamic languages. (This is contra PyCharm, e.g., which is great itself, but I'd need like a half-dozen of JetBrains' individual IDEs to cover all the things I do).
Komodo IDE is by no means perfect, and editors/IDEs are the ultimate YMMV choice. But I am regularly delighted to use it, and every year I re-up my support subscription quite happily. Indeed, I just remembered! That's coming up this month. Credit card: Out. I have no commercial connection to ActiveState--just a happy customer.
I've searched on Google for an app like this for a while, and I've found only options with heavy and ugly interfaces.
Then I opened Mac App Store and found CodeRunner. Very nice and clean interface. Support many languages like Python, Lua, Perl, Ruby, Javascript, etc. The price is U$10, but it's worth it!
I've been using an Evaluation copy of Sublime Text. What's good is it doesn't really expire.
It's been good so far and was really easy to get started with.
I may be a little late for this, but I would recommend Aptana Studio 3.x . Its a based on eclipse and has everything ready-to-go for python. It has very good support for DJango, HTML5 and JQuery. For me its a perfect web-development tool. I do HTML5 and Android development too, this way I do not need to keep switching different IDE's. It my all-in-one solution.
Note: you need a good amount of RAM for this to be snazzy !! 4+ GB is awesome !!
Visual Studio Code + Official Python Plugin
Here you see an overview of its current Python features:
https://code.visualstudio.com/docs/languages/python
Chocolat
http://chocolatapp.com
It's lightweight and offers Code Completion. Costs money.
EDIT:
Apparently Chocolat was an interesting option in 2013 but since then many others came up and development stalled. Nowadays I recommend Visual Studio Code + Python Plugin.
You might want to look into Eclim, an Eclipse server that allows you to use Eclipse functionality from within your favorite text editor. For python-related functionality, it uses Rope, PyFlakes, and PyLint under the hood.

Categories

Resources