Python is known for it's "batteries include" philosophy, meaning that the standard library that "ships" with the basic installation of the language is feature rich and ready for immediate consumption to tackle most garden variety problems from the get-go.
However, there are numerous third party modules and packages that I feel should be part of the standard distro, or at least treated as such - PEP 206 just scratches the surface of identifying some of the more useful modules that are becoming commonplace).
So here are my 11 most useful extensions that I have installed before I begin doing anything else:
If you are going to be using the Python interactive interpreter environment (and you are, right?), then IPython is a must. It's not just the normal the interactive environment on steriods, it's the Barry Bonds of interactive environments. After getting used to the boat-load of features, you'll wonder how you ever got by without it.
If you use a MySQL database and want to interactive with it via Python APIs, you'll be needing this.
From what I've read, Jason Orendorff's
pathmodel nearly made into the standard Python library. It's a shame it didn't, because one of the uglier Python warts in this author's opinion is the mess of file and path handler interfaces. Do I look in the
codecsmodule to find that file / path handling function? Forget it - just look in the
For working with dates, date ranges, or recurrences of dates, this is the only library you will need. Excellent documentation with extensive example code.
As an example, create a list of the next 3 occurrences of Friday the 13th:
1 2 3 4 5 6 7 8 9 10 11 12
from datetime import datetime from dateutil import rrule f13 = rrule.rrule( rrule.YEARLY, count=3, byweekday=rrule.FR, bymonthday=13, dtstart=datetime.now() ) list([d.date() for d in f13]) # [datetime.date(2008, 6, 13), datetime.date(2009, 2, 13), datetime.date(2009, 3, 13)]
Working with images? Done. One caveat: you might want to save yourself some trouble and install the last JPEG library from www.ijg.org (version 6b currently).
Thinking of using Python's Tkinter interface to bestow another hideous, malformed GUI app on us all? Well, 1995 called and asked for it's cheesy look and feel back.
Come on, wxPython is free, easy to install and use, and has great documentation in WxPython In Action.
An odd name, but great for parsing both kinds of HTML: the good and the bad.
An example direct from the documentation:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
from BeautifulSoup import BeautifulSoup html = '<html><p>Para 1<p>Para 2<blockquote>Quote 1<blockquote>Quote 2' soup = BeautifulSoup(html) print soup.prettify() # <html> # <p> # Para 1 # </p> # <p> # Para 2 # <blockquote> # Quote 1 # <blockquote> # Quote 2 # </blockquote> # </blockquote> # </p> # </html>
docutilshas become, in my opinion, the de facto method for marking up Python documentation, to include
__doc__strings. It excels at processing reStructuredText for HTML or LaTex output.
I'm not quite sure why half of the XML functionality was pruned from the default Python standard library, but this is the other half. There are other XML libraries (
4Suite) that may suit your particular needs better, but as a minimum you should consider getting at least the full
These libraries extend the
distutilspackage to produce executable binaries for Mac OS X and Windows, respectively.
Markdown has become a daily part of my development and online life. Many bloggers have begun offering comments in Markdown format (this site included). I find extremely useful for purposes of documentation and more formally structured email because even unprocessed, it remains very readable and elegent as opposed to raw wiki syntax (which I find to be less decipherable than HMTL in many cases, particularly MediaWiki) or even reStructuredText (a bit too structured and esoterica for common everyday usage).