I've been doing a lot of very productive python work recently and have been looking around for the best programmer's editor but still haven't found it.
If you spend you whole day in an application you do start to think about how it could be made more productive, and of course anyone who programs can't help but customise.
Features I'm after are:
- Syntax colouring
- Syntax aware (auto indenting etc)
- Real code completion (I mean language aware like looking into imported modules for possible completions)
- Ease of showing documentation on a module and it's methods
- Code folding might be nice
- A full gui debugger might be nice
- Native MacOS X application
- Handles large projects fast
- Subversion GUI
XCode
I've used XCode of course for Cocoa development and it has python syntax colouring built in. XCode is particularly good with large numbers of source files, it's fast and searching is really great. There's a little Script menu I hadn't played with before now and I want to share what I've discovered with you.
User scripts for that little menu go in ~/Library/Application Support/Apple/Developer Tools/Scripts/ (insane eh?).
Inside that Scripts directory you should copy the default StartupScript and 10-Users Scripts folder from /Library/Application Support/Apple/Developer Tools/Scripts/
Here are my scripts, mostly adapted from the excellent ones that come with TextMate.
10-PyChecker.sh
#! /bin/bash
#
# -- PB User Script Info --
# %%%{PBXName=PyChecker}%%%
# %%%{PBXKeyEquivalent=}%%%
# %%%{PBXInput=None}%%%
# %%%{PBXOutput=None}%%%
#
PYCHECKER=/opt/local/bin/pychecker
TEMPOUT=/tmp/check.txt
${PYCHECKER} --only %%%{PBXFilePath}%%% > ${TEMPOUT}
open -a /Developer/Applications/Xcode.app ${TEMPOUT}
20-run.sh
#! /bin/bash
#
# -- PB User Script Info --
# %%%{PBXName=Python Run...}%%%
# %%%{PBXKeyEquivalent=}%%%
# %%%{PBXInput=None}%%%
# %%%{PBXOutput=SeparateWindow}%%%
#
#
PYTHON=/opt/local/bin/python
TEMPOUT=/tmp/out.txt
echo "Running %%%{PBXFilePath}%%%..." >${TEMPOUT}
${PYTHON} %%%{PBXFilePath}%%% >> ${TEMPOUT}
open -a /Developer/Applications/Xcode.app ${TEMPOUT}
30-pydoc.sh
40-python reference.sh
#! /bin/bash
#
# -- PB User Script Info --
# %%%{PBXName=pydoc}%%%
# %%%{PBXKeyEquivalent=}%%%
# %%%{PBXInput=Selection}%%%
# %%%{PBXOutput=None}%%%
#
#
pydoc -k %%%{PBXSelectedText}%%%
# This command takes the currently selected word and
# displays the python documentation for the module
# corresponding to said word.
#
# It falls back on the current word.
# change to /tmp to avoid possibly overwriting
# an html file in the working directory.
PYDOC=/opt/local/bin/pydoc
cd /tmp
${PYDOC} -w "%%%{PBXSelectedText}%%%" >/dev/null
if [[ -f "%%%{PBXSelectedText}%%%.html" ]]; then
open "%%%{PBXSelectedText}%%%.html"
#rm -f "%%%{PBXSelectedText}%%%.html"
else
echo "No documentation found for:
%%%{PBXSelectedText}%%%This command only looks for Python modules."
fi
#! /bin/bash
#
# -- PB User Script Info --
# %%%{PBXName=Python Reference}%%%
# %%%{PBXKeyEquivalent=}%%%
# %%%{PBXInput=None}%%%
# %%%{PBXOutput=None}%%%
#
#
open http://www.python.org/doc/2.4/modindex.html
9 comments:
Not to beat a horse that is dead all over the internet, but Vim has everything you list, except being a native OSX application.
Komodo? or is that too slow for you?
Eclipse with PyDev.
more open-source options:
* smultron
* the idle variant from http://mashebali.com/?Tal_Einat%27s_IDLE has smart completions
commercial options:
* wing-ide
Komodo for Mac OS X is actually pretty snappy (the x86 4.0beta version, anyway).
It's a great editor / debugger, and I love that I can use it on Windoze and Linux as well.
Thanks for the comments folks. I've tried Komodo, Eclipse with PyDev and Wing in the past but for some reason I feel distanced from the machine if I'm not running a native text editor.
The best experience I've had with an IDE was CodeWarrior developing in PowerPlant. It was so fast and productive.
eric3 runs on os x, although xcode is so hosed its cool. Assuming you don't have ubuntu os x should suffice for baby apps if you like to break your own mind repeatedly.
you can beat a dead horse in the mouth but you can't make him drink. Vim is a native osx application.
VIM - Vi IMproved 6.2 (2003 Jun 1, compiled Feb 16 2006 18:28:54)
Compiled by root@b33.apple.com
Thanks for the scripts! Xcode is the way to go on Macs.
Post a Comment