views:

475

answers:

8

I'm looking for a python project to use as example to learning python.

The project should have these features:

  1. is almost fully unit tested
  2. use consistently the code convention recommended by PEP 8
  3. it's elements are almost fully documented

Extra point features are:

  1. building, assembling, and release automation

EDIT:

The Question is too generic. I prepared a more specific question about the unit-test part.

+5  A: 

Start with the libraries already included with Python. Each of those is almost fully unit tested, follows PEP-8, and has extensive documentation.

And.

They're already installed as part of Python.

S.Lott
There is any of these libraries that you would recommend?
Andrea Francia
The setuptools seems well documented and unit tested, but seems it uses some sort of ad hoc adaption of the standard unit testing.
Andrea Francia
@Adrea Francia: All of them. Pick one that interests you. Pick one that applies to the problem you want to solve. Pick one alphabetically. Pick one by size. They're part of the official distribution. They've been thoroughly vetted by a LOT of Pythonnistas.
S.Lott
@Andrea Francia: Yes "adaption". No "ad hoc". Subclasses and extensions are normal, especially to test something like this without walking all over your current installation.
S.Lott
Seems to me that the datetime package does not follow the PEP 8, name of classes aren't CamelCapitalized.
Andrea Francia
@Andrea Francia: datetime package does not follow the PEP 8. In some cases (Python 2.5.2. for windows) t's not distributed as source, either. If you're looking for total perfection, you may be disappointed.
S.Lott
No no, I doesn't need perfection, your answer is ok, that was just an observation. In fact I need a project simple to build, I fear that entire Python is not simple to build. Maybe I need update my question.
Andrea Francia
+3  A: 

If you want some thing on the web domain, Trac is an excellent example.

neesh
Thanks. If someone need a link the website of Trac is http://trac.edgewall.org/
Andrea Francia
+2  A: 

Django matches your criterias. But it's not really the easier way to start.

ClientCookie is probably less suited, but far easier to handle.

e-satis
In Django is not simple to find how to run the tests. And I didn't found a test for each source file. I wonder if every method or function is unit tested or not.
Andrea Francia
Instead of ClientCookie I downloaded the mechanize project which include the ClientCooikie. Even if this project is smaller than Django the unit testing part is well documented and there are also unit and functional tests.
Andrea Francia
A: 

You can try Google Code Search, and see what you can find for Python language. Each link has project specified, so you can check as many of them as you like.

Many C libraries have Python bindings (like wxWidgets, OpenGL, OpenCV etc) and those bindings usually have nice test coverage.

Abgan
A: 

A shameless plug, but I can recommend pyftpdlib the Python FTP server lib I work on occasionally. It's very well documented code, full unit tests, careful docstrings, and follows the Python style PEPs very strictly.

Jay
Thanks! Your code is well documented and tested but I'm searching some ideas how to organize many tests of many classes of many packages.
Andrea Francia
I've generally found one test module per python module (named `testmodulename`), one TestCase per class (named `ClassNameTest`), to work well.
David Eyk
I have also nested packages ... where put the tests? How name they, how collect all tests? How to refer to the developing modules instead of the installed modules without use a possibly unconfigured PYTHONPATH?
Andrea Francia
A: 

I've recently released a simple package, Dyce (a dice roller with a parser and some other neat features), with exactly these aims. Right now it is strongest on build/package/release automation, but I'm working to improve the documentation and test suite. See the site for a more complete description.

David Eyk
A: 

Elaborating a little on S. Lott's answer:

The specs point directly at a somewhat famous open source project, the Python Library. Have a look at python/trunk/Lib/test/regrtest.py, which will find all modules whose name is "test_*" in the test directory, and run them.

gimel
A: 

Twisted is extremely well written and unittested. It follows PEP 8 in almost everyway except for using the uglyJavaNamingScheme.

Benjamin Peterson