Great example of a python module/package following up to dateconventions.

B

Big Stu

I'm hoping someone on here can point me to an example of a python
package that is a great example of how to put it all together. I'm
hoping for example code that demonstrates:

-Strict adherence to PEP 8
-thorough use of Docstrings
-Conventional directory structure/package layout
-Appropriate use of the latest accepted coding guidelines in the
python community (e.g., new classes versus old classes, Python 3000
compatibility, newer language features, etc. etc.)
-Some amount of object oriented design

Bonus:
-Unit tests
-Logging mechanism

I can't imagine a package that's been around longer than a few years
will hit upon all these things well unless the maintainer went back
and did some serious refactoring and re-tooling.

Is this question possible to answer?
 
J

Josh Holland

I'm hoping someone on here can point me to an example of a python
package that is a great example of how to put it all together. I'm
hoping for example code that demonstrates:

Surely most of the Standard Library should satisfy all your
requirements?
 
B

Big Stu

Surely most of the Standard Library should satisfy all your
requirements?

That's definitely a place I've started to poke around, but the
standard library stuff always comes to me by way of my standard python
installation. I was hoping to have a template of a 3rd party package
to follow. Complete with conventions to follow for easily packaging
and distributing via the usual python channels (pypi, easy_install,
egg, etc.).
 
J

Joan Miller

I'm hoping someone on here can point me to an example of a python
package that is a great example of how to put it all together.  I'm
hoping for example code that demonstrates:

-Strict adherence to PEP 8
-thorough use of Docstrings
-Conventional directory structure/package layout
-Appropriate use of the latest accepted coding guidelines in the
python community (e.g., new classes versus old classes, Python 3000
compatibility, newer language features, etc. etc.)
-Some amount of object oriented design

Bonus:
-Unit tests
-Logging mechanism

I can't imagine a package that's been around longer than a few years
will hit upon all these things well unless the maintainer went back
and did some serious refactoring and re-tooling.

Is this question possible to answer?

Look here:

http://bitbucket.org/ares/scripy/src/
 
J

Josh Holland

Have you actually looked at any of the standard library?
Not recently or in depth, no. I would have thought that it would be of
high quality. I must have been mistaken.
 
B

Big Stu

Have you actually looked at any of the standard library?

Jean-Paul

I'm looking at urllib2 right now and it is covering a bunch of the
bases I'm looking for. And grepping in the /usr/lib/python2.5/ folder
for import statements on various things I'm interested in is bringing
up some good examples to check out as well. Given that I'm still
fairly novice to this I'm not yet in the position to make a good
judgment on what is and isn't a good python practice so I was hoping
someone on here might be able to point at a module or 2 that has
really done a good job of following best practices.

Seems like a reasonable question with an answer that others in a
similar position to me might find useful.
 
E

exarkun

I'm looking at urllib2 right now and it is covering a bunch of the
bases I'm looking for. And grepping in the /usr/lib/python2.5/ folder
for import statements on various things I'm interested in is bringing
up some good examples to check out as well. Given that I'm still
fairly novice to this I'm not yet in the position to make a good
judgment on what is and isn't a good python practice so I was hoping
someone on here might be able to point at a module or 2 that has
really done a good job of following best practices.

Seems like a reasonable question with an answer that others in a
similar position to me might find useful.

You're right. I was actually wondering if Josh had looked before
suggesting it. :) The stdlib varies wildly in quality, with much of it
not serving as a particular good example of most of the points you
mentioned.

urllib2 is probably better than a lot, but, for example, even it only
manages about 75% line coverage by its test suite.

Jean-Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,434
Messages
2,571,691
Members
48,796
Latest member
Greg L.

Latest Threads

Top