Friday, June 13, 2008

looking for good examples of source from large Python projects

I was recently asked for some advice about Python source code that would serve as a good example of organization, style, and documentation (including comments in the code itself). I had a few suggestions for projects to look at, but I wonder what other people think about the question.

Can you point to a project with source that you would hold up as an example of how to set up a medium to large code base? What makes it a good example?

14 comments:

Anonymous said...

Django

matthew said...

Trac?

innervision said...

I second Django as a good project for that. The code is very well commented, it has tests, docstrings where they apply, a nice and easy to understand structure, etc.

I'm not a fan of reading other people's code, and had no trouble at all reading a lot of the code to check how it does things.

Matt said...

I had a similar blog post a bit back.

Anonymous said...

Django.

Anonymous said...

IPython has a large codebase and lots of docs. The trunk of it is undergoing a lot of change right now, so maybe in a couple days that would be good.

elarson said...

CherryPy is a great example. Also, the CherryPy community is also rather exceptional.

saluk said...

twisted :)

Benjamin said...

Hmm. Would it be a crime if I said the Python core and stdlib. Some of the smartest brains in Python maintain those.

Sean Reifschneider said...

Whenever this question comes up (yeah, there's nothing new under the sun), I always say Mailman. Every time I've had to hack something into it, it's been no problem.

At the other end of the spectrum is anaconda, the Fedora/RedHat installer. Every time I've tried looking at the code there it's made my eyes bleed.

Sean

Doug Hellmann said...

Django and Zope (3, not 2) were on my suggestion list. I suspected that Mailman would be a good one, too, so thanks for the confirmation.

I didn't think of trac or CherryPy, but their code is good.

I'll have to give IPython a look.

I've never looked at the Twisted code. If the code matches the architecture, it will be a mind-bending read. :-)

@matt - Thanks for the link, there was some helpful feedback in the comments there.

Thanks, everyone!

Tinjaw said...

Thanks for posting this question. The responses have been very helpful.

mmarshall said...

"""
I've never looked at the Twisted code. If the code matches the architecture, it will be a mind-bending read. :-)
"""

I found reading the Twisted code base to be an excellent way of un-mind-bending the architecture :-)

MWM

Anonymous said...

Aloha!

Somebody else suggested Trac and I agree. When I get this question I always point to Trac.

http://trac.edgewall.org/

The ability in Trac to actually look at the code formatted in a nice way on a web page is another reason why Trac is a good choice.

That is, not only is the code written in good way, but the tool implemented by the code is good for displaying the code. Very recursive-meta...