473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Well written open source Python apps

Ben
Could anyone suggest an open source project that has particularly well
written Python? I am especially looking for code that people would
describe as "very Python-ic". (Not trying to start any kind of war -
just wanted some good examples of a well written Python app to read.)

Thanks!
-Ben

P.S. - Sorry if this has been discussed at length before - I searched
the group before I posted, but didn't come up with what I was looking
for.

Oct 13 '05 #1
13 2210
On Thursday 13 October 2005 09:43, Ben wrote:
Could anyone suggest an open source project that has particularly
well written Python? I am especially looking for code that people
would describe as "very Python-ic". (Not trying to start any kind of
war - just wanted some good examples of a well written Python app to
read.)


The Python Standard Library. Thousands of lines of quite good Python
code. It might not use all the latest features, and there might be a
few dark corners here and there, but it's still solid. And quite easy
to understand (I had no difficulty understanding and modifying
httplib).

- Michael
Oct 13 '05 #2
On Oct 13, Ben wrote:
Could anyone suggest an open source project that has particularly well
written Python? I am especially looking for code that people would
describe as "very Python-ic". (Not trying to start any kind of war -
just wanted some good examples of a well written Python app to read.)


The Python Package Index (PyPI, or cheeseshop)
<http://www.python.org/pypi> has pointers to a lot of packages that are
likely mostly pythonic.

I don't know if this is spelled out more precisely somewhere, but here
is my notion of a pythonic distribution:

* Has modules grouped into packages, all are cohesive, loosely
coupled, and reasonable length

* Largely follows PEP <http://www.python.org/peps/> conventions

* Avoids reinventing any wheels by using as many Python-provided modules
as possible

* Well documented for users (manpages or other) and developers
(docstrings), yet self-documenting with minimal inline commenting

* Uses distutils for ease of distribution

* Contains standard informational files such as:
BUGS.txt COPYING.txt FAQ.txt HISTORY.txt README.txt THANKS.txt

* Contains standard directory structure such as:
doc/ tools/ (or scripts/ or bin/) packageX/ packageY/ test/

* Clean UI, easy to use, probably relying on optparse or getopt

* Has many unit tests that are trivial to run, and code is structured to
facilitate building of tests

The first example of a pythonic package that comes to my mind is
docutils <http://docutils.sourceforge.net/>.

--
Micah Elliott
<md*@micah.elliott.name>
Oct 13 '05 #3
Here is an article discussing the coding style of BitTorrent.

http://www.onlamp.com/pub/a/python/2...ythonnews.html

Maybe that code is worth looking at.

Oct 13 '05 #4
This is really synchronicity in action! I started to think yesterday
about putting together a project that measures the 'goodness' of Python
packages in the PyPI Cheese Shop repository. I call it the "Cheesecake"
project. I took the liberty of citing Micah's post in a blog entry that
I just posted:
<http://agiletesting.blogspot.com/2005/10/cheesecake-how-tasty-is-your-code.html>

Comments/suggestions welcome!

Grig

Oct 13 '05 #5
"Ben" <bw*******@gmail.com> writes:
Could anyone suggest an open source project that has particularly well
written Python? I am especially looking for code that people would
describe as "very Python-ic". (Not trying to start any kind of war -
just wanted some good examples of a well written Python app to read.)

[...]

At the time I looked at it I thought this was nice, though that was
some time ago (it was still 'sketch' then) so I wonder if I'd still
have the same opinion if I looked now (due to me changing my view of
"good code", not the skencil source code changing!):

http://www.nongnu.org/skencil/
John

Oct 13 '05 #6
On Oct 13, Grig Gheorghiu wrote:
This is really synchronicity in action! I started to think yesterday
about putting together a project that measures the 'goodness' of Python
packages in the PyPI Cheese Shop repository. I call it the "Cheesecake"
project. I took the liberty of citing Micah's post in a blog entry that
I just posted:
<http://agiletesting.blogspot.com/2005/10/cheesecake-how-tasty-is-your-code.html>


Grig, I think you're onto something here; good idea. I have no
experience with CPANTS, and I'm not sure how many of my ideals could be
checked programmatically. But if your Cheesecake tool comes into
fruition, here are some things that I would personally find useful:

* A command-line version that I could easily run on my projects.

* An output that gives more than just an index/score; maybe a bunch of
stats/indicators like pylint. I.e., it would be say "pypkglint" or
"pydistchecker", a higher level lint that operates on packages instead
of just source files.

* Some checks that might be useful

- Module and package naming conventions. (PEP-8 describes
module-naming, but I see this broken more often than followed in
practice. And it is silent on package names, but the tutorial uses
capitalized names.) Some consistency here would be nice.

- Existence of standard files. ESR goes into detail on this in his
"Art of UNIX Programming" book (pp 452).

- Existence of standard directories (those I mentioned before).

- Output of checkee "--help" should satisfy some standards. I presently
check my own tools by running "help2man" which forces me to setup
optparse to follow a strict format. I have some active RFEs on
optik (optparse) to address this.

- Use of distutils. Maybe just a check for setup.py ?

- Consistency of module length. Not sure about this one, but you
might lower the score if some package modules are 10 lines while
others are 10KLOC.

- Number of modules per package. Maybe 4..20 is a good amount?

- Extra points for existence of something like "api.html", which
indicates that epydoc/pydoc generated API info.

- Extra points for .svn/CVS/RCS directories indicating that version
control is in place. Maybe even glarking of version numbers where
high numbers indicate that code is checked in frequently.

- Use of ReST in documentation, or even in docstrings.

- Count of unit tests. Do module names map to test_<modulename> in
test directory? How many testXXX functions exist?

- A summary calculation of pylint/pychecker scores for each module.

- Point deduction (or fail!) if any .doc/.xls, etc. files included in
distribution.

- Extra points for use of modules that indicate extra usability was
incorporated, such as: gettext (multi-language), optparse (clean
UI), configparser (fine control), etc.

* A PEP describing the conventions (though some will argue that PEPs
should be enforcable by the compiler, so maybe just a "Cheesecake
Convention" document).

* And of course anything that CPANTS offers :-)

I'm sure people here have more ideas for quality indicators...

--
Micah Elliott
<md*@micah.elliott.name>
Oct 13 '05 #7
Ben wrote:
Could anyone suggest an open source project that has particularly well
written Python? I am especially looking for code that people would
describe as "very Python-ic". (Not trying to start any kind of war -
just wanted some good examples of a well written Python app to read.)


I'm sorry I can't speak on its "pythonicity" (my memory sucks), but I
did find Roger Binns' BitPim program (http://bitpim.sourceforge.net/) to
be an excellent source of ideas (steal steal steal) for wxPython code,
and I do remember it struck me as being exceptionally well commented and
well structured. I suspect it's pretty Pythonic, too, since Roger seems
pretty brilliant from where I sit. :-)

-Peter
Oct 14 '05 #8
The paper on BitPim http://bitpim.sourceforge.net/papers/baypiggies/
lists and describes programs and ideas used for the project. Some of
it is just bullet-points, but everything seems to be well chosen. I've
swiped a lot of these ideas.

Oct 14 '05 #9
> Could anyone suggest an open source project that has particularly well
written Python? I am especially looking for code that people would
describe as "very Python-ic".


I vote for the "doctest" code in the standard library.

Michele Simionato

Oct 14 '05 #10
Ben wrote:
Could anyone suggest an open source project that has particularly well
written Python? I am especially looking for code that people would
describe as "very Python-ic". (Not trying to start any kind of war -
just wanted some good examples of a well written Python app to read.)


Mailman - http://www.list.org/
Spambayes - http://www.spambayes.org

Those are written by experienced Python programmers, some of them Python
developers. It looks like well written code to me.

Gerrit.

--
Temperature in Luleå, Norrbotten, Sweden:
| Current temperature 05-10-14 10:19:49 8.3 degrees Celsius ( 47.0F) |
--
Det finns inte dåligt väder, bara dåliga kläder.
Oct 14 '05 #11
Steve M wrote:
Here is an article discussing the coding style of BitTorrent.

http://www.onlamp.com/pub/a/python/2...ythonnews.html

Maybe that code is worth looking at.


[didn't read this thread or that article until I saw the summary in Dr.
Dobb's Python-URL]

FWIW, the BitTorrent code seemed like an incredible hack to me. The
above article tries to put a positive spin on it, but seriously, the
code was a mess. Hats off to Mr. Cohen for creating BitTorrent in the
first place, but I wouldn't go looking at that code for any "best
practices".

It took several days of head scratching to figure out what was really
going on because the code is almost *completely* devoid of comments -
even high level stuff like "this module is for X" or "this class does
Y", not to mention comments to clarify code that was obscure or trying
to be too cute.

A day or so into it I discovered that there were two different public
classes with the exact same name, so anytime you saw it used elsewhere
you had to dig around to figure out which class was being used.

There were also lots of more subjective things that were pretty
annoying - state was passed around in various dictionaries (they were
begging to be refactored into classes), a lot of the variable names
seemed like misnomers, values were passed out from functions via 1-item
lists, etc. - drove me nuts. :)

To be clear, I'm not trying to rag on BitTorrent, just pointing out
that it is probably not at all what the OP is looking for (well-written
Python, stuff that is generally considered "very Pythonic").

-Dave

Oct 17 '05 #12
This is an old thread in this subject that I bookmarked:
http://groups.google.com/group/comp....93a0b7722bb32f

Oct 18 '05 #13
I suggest also these:

Spark:
-----------------
http://pages.cpsc.ucalgary.ca/~aycock/spark/

Few files.
I like how doc strings are used for handling the grammar.
Twisted:
----------------
http://twistedmatrix.com/

I like everything, from test to comments! (many are funny)
Misto
Oct 19 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
4
by: Python Baby | last post by:
learning Python, planning on making an interactive website. To me, "interactive website" = "web app" = websites such as NetFlix, Amazon, Orbitz, Hotmail, MyYahoo, etc. Something stateful that...
188
by: Ilias Lazaridis | last post by:
I'm a newcomer to python: - E01: The Java Failure - May Python Helps? http://groups-beta.google.com/group/comp.lang.python/msg/75f0c5c35374f553 - I've download (as suggested) the python...
3
by: Alex Gittens | last post by:
Is anyone aware of any applications that handle font and graphics display--- something like Adobe Reader--- that are written in Python, and the code is available for examination? It doesn't matter...
0
by: thomasasta | last post by:
Hey there is a new python written open source bit-torrent client out. Don´t mit it up with brams c++ bittorrent, in python it is bit-torrent.sf.net Don´t forget the minus - ...
158
by: Giovanni Bajo | last post by:
Hello, I just read this mail by Brett Cannon: http://mail.python.org/pipermail/python-dev/2006-October/069139.html where the "PSF infrastracture committee", after weeks of evaluation, recommends...
113
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside...
3
by: KidSensation | last post by:
Hello all, I ran into a couple applications written in c#, but we do not have the full version of visual studio.net 2003, so I thought they were most likely written in the beta version. After...
1
by: seberino | last post by:
Best open source Python online chat apps? I believe there are a few PHP online chat apps to allow people to have conversation via a web server but a Python one would soothe the soul. Any...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.