Introduction to MacPython

Python is an interpreted, interactive, object-oriented programming language. It is often compared to Tcl, Perl, Scheme or Java. Python runs on almost any machine and operating system available. MacPython is a packaging of that language with tools and extensions that are tailored to the Macintosh.

Python, the language

The main Python website has a list of Introductory material that will give you an idea what Python is all about. If you want something really concise there is an executive summary entitled What is Python?, which is about as short as it gets.

If you want to get started with programming in Python your first stop should be Python for Beginners, which lists tutorials, suggested reading and other resources.

When reading through Python material that is not Macintosh-specific you should keep in mind that Python has its roots in Unix (even though the very first implementation was actually done on a Macintosh!), and that today the majority of Python users run on Windows. So you will see a lot of references to building the interpreter from source, or editing the registry or all sorts of things Macintosh users usually don't have to bother with. In most cases, you can safely ignore these. Also, when there is an unqualified reference to Macintosh there is a good chance that the information is for Mac OS 9 or earlier, and may not apply to Python on Mac OS X.

MacPython, the package

MacPython integrates Python into the Macintosh environment. This means that you can create Python scripts and run these as easily as you can use other documents. You can use the Integrated Development Environment (IDE), which includes an editor and debugger and other tools to help you create Python programs. Alternatively, you can use your favorite text editor and double click your scripts to run them outside of the IDE. If you think you are going to continue using a script longer you can convert it to an applet, a mini-application that allows drag and drop, etc.

Integration also means that a MacPython script has access to all sorts of Macintosh technology: you program can control other applications just like you can from AppleScript, it can play or modify movies through QuickTime, create windows and dialogs with the standard Carbon calls and much more. An optional package PyObjC is available that allows full access to the Cocoa toolkit, so you can write complete Cocoa applications in Python (or, if you need it, in a mix of Python and Objective-C).

Python has always been known for the large number of add-on packages that are available to extend its functionality, but installation of these packages often required developer tools such as C compilers, and the knowledge to use them. MacPython partially solves this through the Package Manager: a tool that allows you to download and install a number of key extensions at a click of the mouse, without requiring the developer tools. These extensions have been prebuilt and tested by the Package Manager maintainer, so you have someone to blame if things don't work. Actually: you are explicitly requested to contact the maintainer, so things can be fixed.

Current add-on packages include PyObjC, the ObjC bridge mentioned above, Numeric for scientific computing, PyOpenGL for creating 3D-graphics, Imaging for processing image files, wxPython and Tkinter for creating cross-platform user interfaces and much more.

Many Pythons, all different

One source of confusion can be the various things that are called "python" and that all run on Mac OS X. As of August 2003, when MacPython 2.3 was released, this confusion should hopefully die off slowly, but at the moment it is good to be aware that there are many versions of Python 2.2 that all run on Mac OS X. While all of these use the same core language the packageing differs, and hence they differ in what you can do with them. See the Other Pythons on OSX for a list.

MacPython is also available for Mac OS 9 and earlier, see MacPython on older systems.

Licensing issues

MacPython is open source, just like all of Python, so you can use it for anything including commercial use. For the full story see the section Python Copyright on