Articles / Python Projects

Python Projects

As I write this, there are almost 3,000 projects in freshmeat's C category and almost 1,500 in the Perl category, but there are only about 400 projects in the Python category. SourceForge has similar statistics. In this article, I hope to get more people to consider using Python in their next projects.

My first programming languages were C and Perl. I found C very fast and powerful, but I had constant battles with ever finishing the projects I started in it. I mainly used Perl for one-liners and throw-away scripts. I found that the C programs I wrote contained many lines of code for even the most trivial programs and the Perl programs contained very few lines of code but, due to Perl's cryptic nature, were so hard to read that it didn't really matter.

When I found what Python had to offer, I was amazed. I could write big applications very quickly, and the source code was always easy to read because of how Python is built. Best of all, Python is so easy to learn that you can literally learn it in a weekend just from reading the online tutorial. No expensive books are needed, though there are Python books out there.

There is a lot more to Python than what I can cover in this article, but I am going to show you a few Open Source projects that people have developed using Python, to give you a good idea of just what can be done with it.

If you want to write programs with a Graphical User Interface, there are a few options. Tkinter has been the standard for a while, but you'll probably enjoy either the PyGTK or wxPython toolkit more. Ivo van der Wijk is developing an IRC client in python-gtk called MoST. I have also written a somewhat-functional IRC client called Reptidle in my spare time using wxPython. PyQT is another toolkit to check out.

If you're interested in writing games, Pete Shinners's Pygame library is for you. Pygame, which wraps the SDL library, allows you to create fully-featured games in Python very easily. Pete has also written a couple of games using his library, including the addictive "SolarWolf", which is a remake of the old Atari 2600 game "SolarFox", and "Aliens", which is a demo game that comes bundled with Pygame and is great for learning to write descent games. Jan Ekholm and Gareth Noyce have been working on a Pygame-based realtime network strategy game called Civil for a couple of years now. Pygame also has interoperability with PyOpenGL, a cross-platform Python binding to OpenGL. The creator of Pygame, myself, and some other Pygame fanatics can be found on irc.openprojects.net in #pygame. Come on by anytime.

Games aren't the only thing Pygame is good for, though. There are also some multimedia applications being developed with it. The following are just a few of them:

  • Frank Raiser's PyFile, a graphical file browser.
  • David Clark's PyPanda, an application that streams webcam images from the San Diego Zoo Panda Cam.
  • imgv, a unique image viewer that I wrote (another shameless plug).

For you Web developers, there's a popular Open Source Application Server called "Zope". Zope allows you to create dynamic Web sites in a very object-oriented way. With Zope, everything is editable through the Web. It comes with its own Web server, and you can write Python scripts for it. Zope itself is mostly written in Python. The Zope Book is freely available online, and there is an IRC channel called #zope on irc.openprojects.net.

Twisted by Twisted Matrix Laboratories provides an Open Source framework for developing network applications in Python. Twisted takes a lot of the hassle out of development so you can focus on the good stuff. Currently, it has support for the FTP, HTTP, SMTP, IRC, telnet, POP3, AOL's instant messaging TOC, DNS, LDAP, finger, Echo, discard, chargen, and Perspective Broker protocols. It is constantly being developed by the guys of #python on irc.openprojects.net, so drop in if you have any questions.

Hopefully, after looking at some of the Python projects I've mentioned, you can see that Python is a powerful language that is suitable for real world applications. You can also extend and/or embed C/C++ with Python if you need more speed.

Rss Recent comments

Rcomment-before 17 Nov 2001 00:22 Rcomment-trans haering Rcomment-after

Not that bad!
I'm a great fan of Python myself, but in my opinion, the numbers aren't that bad. Python vs. Perl 1:3 that might be relatively close to the number of programmers, there might even be more than 3 times the number of Perl programmers than there are Python programmers.

Plus, we don't need more Python projects per se, but more *useful* software, preferrably written in Python :-) I really don't need another MP3 cataloging software written in Python ;-)

Rcomment-before 17 Nov 2001 00:51 Rcomment-trans staeryatz Rcomment-after

Python is interesting
The first thought that came to my mind when I first saw Python code was "what a strange language". I studied it for about a day, and pretty much got the gist of it, then tried writing my own scripts.

Having tried a few already, I think every language has its place. The Python syntax is very interesting, also, it's like nothing I've ever seen before it.

I've tried out some PyGtk examples, and I saw just how powerful Python can be, and It looks promising.

I'd say more good stuff, but I'm not exactly a Python programmer (but I could be).

Oh yeah...and the OO part of Python is very simple to implement. ;)

Rcomment-before 17 Nov 2001 00:55 Rcomment-trans rikkus Rcomment-after

Alternatively

No flamewar intended, but if you are looking for a new language, I'd suggest you check out Ruby (http://www.ruby-lang.org) too.

Rik

Rcomment-before 17 Nov 2001 01:43 Rcomment-trans jarrodj Rcomment-after

PythonTheater
I took a brief look at Python code and started playing around and wrote an mpeg/avi player in Python. PythonTheater started out as a little toy to see what I could do, but quickly got really good and I released it. Python has a really good syntax, really lends itself to OO programming. Also, it has a fantastic C API for developing glue between C/C++ and Python code, or simply implementing perfomance modules in the midst of python code. I think the best thing that ever happened to GTK was PyGTK, that API is *far* more intuitive and quick to write in than GTK in C or GTK--- in C++, more on the level of Java Swing. If one could settle on a cross-platform Python GUI, Python would be on the level of Java for cross-platform development. Perl is nice and all, but the syntax can get really ugly, especially if multiple coders with different styles work on a single codebase. Also, Perl lends itself more to structured programming than OO programming. In short, I see Python as a good language for general-purpose programming, while Perl works really well in string processing applications (i.e. web form prcessing, log analyzers, etc..). So for most apps, Python, for a lot of CGI work, Perl :)

Rcomment-before 17 Nov 2001 02:20 Rcomment-trans bstarynk Rcomment-after

Python and other scripting languages.
I greatly prefer Ruby and Ocaml.

Ruby is a fully OO scripting language that is purer than Python.

Ocaml is a great functional programming langage for real programming.

Please notice that Python's garbage collector is very poor.
And some people dislike significant indentation like Python's. At last, type inference and powerful compile time analysis is a big plus of Ocaml.

Rcomment-before 17 Nov 2001 19:16 Rcomment-trans honeylocust Rcomment-after

Indentation sux
I was enthusiastic about Python for a little while after it came out. Then I lost about two days work tracing down bugs after a text editor accident messed up the indentation of source files -- it was particularly confusing because there were combinations of spaces and tabs that looked identitical on the screen but looked different to Python.

I realized then and there that stupidity like that would cause me to lose any gains I got from programming in Python and that was the end of my Python career.

Python's a nice language in a number of other ways. In terms of actual features, Python and Perl are competitive, since they're based on similar technology. Each of them has, in some respects, an unorthodox syntax... Except for indentation, Python is a pretty conventional looking OO-language with facile operators for working with composite types. Perl's OO is less rigorous, but it's syntax is practical and powerful otherwise, if unorthodox.

Rcomment-before 17 Nov 2001 19:17 Rcomment-trans rainy Rcomment-after

quality vs. quantity.
One of the design goals of python was to make code more readable. I think python is very successful in this regard, so it's easier to take existing code and change it rather than start a new project. This could be one of the reasons why there's less python projects around. I myself wrote a few apps: a learning mp3 player, project gutenberg reader, diary program, python shell, burning frontend, vim "random tip" script, and a time management app.. I keep them at silmarill.org/projects/ . Python is neat as hell and I like it much better than any other lang I tried (smalltalk, java, c, c++, perl, ruby). My favorite features are meaningful indentation and clean/minimalistic design.

Rcomment-before 17 Nov 2001 19:43 Rcomment-trans juanjux Rcomment-after

Re: Indentation sux
Come back to Python, versions > 2.0 give you an 'indentation error' on those cases.

Rcomment-before 17 Nov 2001 20:41 Rcomment-trans mj6798 Rcomment-after

Re: Indentation sux

> I was enthusiastic about Python for a
> little while after it came out. Then I
> lost about two days work tracing down
> bugs after a text editor accident messed
> up the indentation of source files -- it
> was particularly confusing because there
> were combinations of spaces and tabs
> that looked identitical on the screen
> but looked different to Python.

Well, then your text editor was misconfigured. If you
change the hard tab width (as many Windows editors
do), you will cause yourself lots of problems, not just
with Python.

The simple solution is to remove tabs from your source
code altogether and use spaces consistently.

Rcomment-before 17 Nov 2001 20:42 Rcomment-trans mj6798 Rcomment-after

languages aren't an end in themselves
People will write Python software if they have a need for it and if Python seems to be the right tool for it. That's the same for any tool or language.

Rcomment-before 17 Nov 2001 21:53 Rcomment-trans leonbrooks Rcomment-after

Re: Indentation sux

> I was enthusiastic about Python for a
> little while after it came out. Then I
> lost about two days work tracing down
> bugs after a text editor accident messed
> up the indentation of source files -- it
> was particularly confusing because there
> were combinations of spaces and tabs
> that looked identitical on the screen
> but looked different to Python.

Python 2 and beyond will get suspicious and warn
you about this, but I agree that this kind of thing is
annoying. Imagine the fooforaw if C required you to
indent-and-brace in a particular style to get it
working!

Ah, well, there's always Ruby. (-:

Rcomment-before 17 Nov 2001 21:56 Rcomment-trans leonbrooks Rcomment-after

New projects

> Plus, we don't need more Python
> projects per se, but more *useful*
> software, preferrably written in Python
> :-) I really don't need another MP3
> cataloging software written in Python ;-)

Hokay, I'll make an Ogg cataloging program instead,
and I have some really neat ideas for a text editor to
deal with the descriptions...

G,D,R (-:

Rcomment-before 19 Nov 2001 00:45 Rcomment-trans ianb Rcomment-after

Zope isn't all there is!
Sometimes Zope is so hyped as the Python Killer App that people don't realize that it is by no means the only way to do web development in Python. Webware (http://webware.sourceforge.net) and Skunkweb (http://skunkweb.sourceforge.net) are both application servers using Python, neither of which are nearly as heavy as Zope. They also let you use real Python, without the funny semantics of Zope (e.g., Aquisition).

If your really love Python, I think you'll like those frameworks/application servers much more than Zope -- IMHO they are closer to the design principles behind Python, i.e., transparent and explicit. Python fits in my brain, but Zope most certainly does not.

Rcomment-before 19 Nov 2001 05:02 Rcomment-trans garethnoyce Rcomment-after

Civil...
...is great. Go check it out, get involved, learn the joys of Python/Pygame, meet interesting and exciting people and become slightly famous...

Rcomment-before 19 Nov 2001 17:36 Rcomment-trans JohnMunsch Rcomment-after

Re: languages aren't an end in themselves

> People will write Python software if
> they have a need for it and if Python
> seems to be the right tool for it.
> That's the same for any tool or
> language.

While you are quite correct that no language is an end unto itself, there are clear advantages to be had by using certain languages and their use should be encouraged for projects. I would like to encourage anyone considering an open source project to pick a language like Java, Python or Perl over C or C++ so that I don't have to port the resulting application to my platform when I want to run it.

Many open source projects rumble blindly along assuming that all the world runs Windows, or Linux, or whatever because that is what the author him/herself runs. They then produce something that I either have to port (which I have no time for) or never use if I don't have the same operating system preference as the author.

At it's best, some languages like Java and Python can offer portable byte code that can run without change on other platforms. I recently received a message from a user saying that my HotSheet project ran perfectly for him on Mac OS X 10.1 even though I've never tried it in that environment myself. The first time I ever tried my application on Linux it worked perfectly without any changes or any recompilation. That kind of portability should be a goal to be strived for by every open source project and it all starts with choosing a language that encourages portability.

Rcomment-before 20 Nov 2001 10:46 Rcomment-trans tal197 Rcomment-after

PyGTK tutorials
I'm now using python for projects whenever I can. When it comes to distributing software you can skip the whole issue of compiler problems (and the need for the user to have gcc and all the needed headers), etc.

Anyway, might as well just plug
my PyGTK tutorials
here, plus a number of
programs, many written using python.

Rcomment-before 20 Nov 2001 17:15 Rcomment-trans twoflower Rcomment-after

Don't forget getmail :)
(Plug) getmail and queue-repair are also in Python. Development was much quicker than it would have been in C or Perl.

Rcomment-before 20 Nov 2001 18:22 Rcomment-trans slicer Rcomment-after

C, Perl and Python
I favor your idea of getting more Python out there. To be honest, I haven't coded in this language yet, however I hope to learn soon.
I have to question your reasoning, however. I think diversity and the power of different languages are great. However, if you're having time reading your own code (ex. Perl) then perhaps you need to change your writting style.

However, that aside, I fully support the idea of new Python projects. It'll give me an excuse to learn a new language. :)

Rcomment-before 21 Nov 2001 01:36 Rcomment-trans rubyfan Rcomment-after

Consider Ruby as well
Python has it's good points, but some people (especially if you're coming from the Perl world) find Ruby easier to grok.

*Ruby is fully object oriented from the ground up (but it doesn't get in your way like it does with Java).

*Ruby is a very dynamic language: methods can be added to objects or classes at runtime, for example.

*Ruby has true closures (AFIK Python does not, maybe in 2.2)

*Ruby's iterators and blocks are quite handy

*Ruby is a single-inheritance OO language, but it has mixins which allow different behaviours to be included in classes and mixins are also conducive to generic programming.

*Performance-wise, Ruby tends to be a bit slower than Perl and a bit faster than Python

*dRuby is an easy-to-use distributed object system that comes with Ruby (much easier to use than SOAP or XML-RPC and the like)

Check it out:
http://www.ruby-lang.org
http://www.rubygarden.com

Rcomment-before 23 Nov 2001 04:22 Rcomment-trans jtra Rcomment-after

Re: Consider Ruby as well
Yes, and nice textmode user interface, see JTTui- textmode user interface (http://freshmeat.net/projects/jttui/).

Does python have something similar? ;-)

Rcomment-before 10 Dec 2001 14:42 Rcomment-trans petra Rcomment-after

Re: Not that bad!

> Plus, we don't need more Python
> projects per se, but more *useful*
> software, preferrably written in Python
> :-) I really don't need another MP3
> cataloging software written in Python

It would also be nice if people remembered that Python objects can be used very easily -- if you like someone else's wordwrap function (something that just happened to me), just "from EmailProgX use WordWrap" ...

Rcomment-before 10 Dec 2001 22:10 Rcomment-trans idfx Rcomment-after

It's important to note that Python isn't really only one language.
I've been messing with Python for about 2 years,
now, and I've come to greatly appreciate it. It
can be infinitely easier to read than C,C++, or
especially Perl. It's very impressive how its
object-oriented nature is thorough, but not
intrusive. If you don't want OOP, just ignore the
objects.

The indentation is often controversial, but I find
that it forces me to write better code in the long
run. And I can't imagine how indentation that
not only follows the program logic but also defines
it can be a worse thing than spending hours looking
for a single missing ' ; '.

( BTW, the indentation makes for excellent code
'folding' if your editor supports it. I'm not sure,
but I think emacs does. )

But the strongest point of Python, I think, is it's
ability to encapsulate other languages, to 'glue'
heterogenous code together.

Some resources the author didn't mention are
SWIG (http://www.swig.org) and SIP, both of which auto-
magically generate Python objects from C++ or C
code. Also worthy of note is the cousin project
Jython (http://www.jython.org), which implements Python in pure Java,
and through which the programmer can access
both Python and Java objects.

But it's important to note that being involved with
Python has different levels. I, for example, am a
Python coder, not a developer. I
write code in Python, using the excellent tools that
some brave coder has already built for me. Usually
they did that building in C. I know some C, but not
nearly enough to do the kind of things I can do in
Python, using only the built-in libraries.

My hat's off to those who give us such tools, but
the point I feel is important to note is that it's not
all-or-nothing. There are those who write Python,
and there are those who write _in_ Python, and
you can be whichever you like. You don't have to go any deeper than you want, but you can use it to get a lot done quickly, without abandoning your language of choice.

Now that's a power tool.

yrs,

idfx

Rcomment-before 31 Dec 2001 07:15 Rcomment-trans denny Rcomment-after

Mixed opinions...

I had to use Python for a project at my last job, and I was left with a severe antipathy toward it... however, as my distance from that unpleasant experience increases, I'm more inclined to think that this is entirely the fault of the GUI toolkit that work made me use, wxPython, rather than anything explicitly wrong with Python itself.

I did deeply resent the enforced layout, but it would be a simple enough thing to adapt to if you put your mind to it... and the OO structure to everything does make development a very pleasant process.

On the whole, I'm a confirmed Perl fan and I'm sure I'll remain so for some time yet... but if I had to use Python again, I don't think I'd be too upset - just as long as I didn't have to use wxPython, which was nasty nasty nasty (IMHO).

Regards,
Denny

Rcomment-before 11 Feb 2002 00:45 Rcomment-trans juanjux Rcomment-after

Re: Consider Ruby as well

> *Ruby is fully object oriented from
> the ground up (but it doesn't get in
> your way like it does with Java).

Python (2.2) is also fully object oriented.


> *Ruby is a very dynamic language:
> methods can be added to objects or
> classes at runtime, for example.

With Python too.

> *Ruby has true closures (AFIK Python
> does not, maybe in 2.2)

True, not even in 2.2


> *Ruby's iterators and blocks are quite
> handy

Python also have iterators (again, 2.2).

> *Performance-wise, Ruby tends to be a
> bit slower than Perl and a bit faster
> than Python

Absolutely false. Check this out:

http://www.bagley.org/~doug/shootout/

Rcomment-before 17 Apr 2002 23:45 Rcomment-trans Thinman Rcomment-after

Re: Not that bad!

> I'm a great fan of Python myself, but in
> my opinion, the numbers aren't that bad.
> Python vs. Perl 1:3 that might be
> relatively close to the number of
> programmers, there might even be more
> than 3 times the number of Perl
> programmers than there are Python
> programmers.
>
> Plus, we don't need more Python
> projects per se, but more *useful*
> software, preferrably written in Python
> :-) I really don't need another MP3
> cataloging software written in Python
> ;-)

Hey... in Pyhton the most important things are the
modules.... Make more modules... Let others make
their projects....

Rcomment-before 15 Feb 2003 13:53 Rcomment-trans arschlesinger Rcomment-after

Don't Forget Jython
I find Java much easier to use than C and C++ and the object system is most definitely better than the procedural systems of C, and the object system of C++.

I think that Java is, however, a harder language to learn than Python, but it is faster. Why not use Python inside of Java with Jython? I installed Jython today, and haven't started using it yet, but I see the benefits to it already. A Python script can exist in another file inside of a JAR and can perform some very complicated network operations or get some OS information easily and then give that information easily to a Java object. The only reason to do this is because in some instances, Python is easier to use than Java, but in some cases, Java is better to use than Python, such as GUI programming.

Also, apps can be created very easily with robust plugin architectures, and users could write plugins with either Python or Java.

Python is becoming the next glue language, and it is 100X easier to use and read than Perl.

Rcomment-before 15 Jun 2003 10:14 Rcomment-trans Versus Rcomment-after

Re: Consider Ruby as well

> Yes, and nice textmode user interface,
> see JTTui- textmode user interface.
> Does python have something similar?
> ;-)
>

Python has curses module.

Rcomment-before 12 Dec 2005 05:07 Rcomment-trans jalanb Rcomment-after

Re: Not that bad!

> Plus, we don't need more Python projects

> per se, but more *useful* software,

> preferrably written in Python :-) I

> really don't need another MP3 cataloging

> software written in Python ;-)

OK, you don't, but I do. The great thing about OS is that we get the code, and the one thing a person writing an mp3 cataloging program needs (because none of the others is quite what I need) is exactly that: lots of other mp3 cataloging software written in Python.

OK, so I'm actually writing a different project altogether, not mp3 catloguer at all, but the principle is the same - the chance of any one project being the "last word" is minimal, so we need lots of different takes on each project, so that we can take a bit here, a bit there, and roll our own.

OS projects are for developers, not lusers.

Rcomment-before 05 Apr 2006 07:40 Rcomment-trans reality11 Rcomment-after

Re: Mixed opinions...
please can u just teah me on how to start with these python programming.i will appreciate if u do it for me

E18c8cc8b352405a9402cd5c30a868ac_thumb

Project Spotlight

Micro Tetris

A very small Tetris clone for embedded systems.

No-screenshot

Project Spotlight

mylvmbackup

A utility for creating MySQL backups via LVM snapshots.