Back to Article Listing

Pylons - Why

Important

These are just my opinions, yours may differ... and that is OK.

Why Python

I have not been writing web apps for that long, so I do not profess to be an expert. But, over the last decade, or so, I have writen several; most are still in service.

The first app was a simple personal phone list written in ASP against a MSSQL database in 1997-ish. Soon after; I discovered OSS. As soon as I learned about PHP, I jumped over that cliff with the rest of the lemmings. It was so easy to learn and get running! [insert your own remark here] But PHP and I started to grew apart a few years ago and I finally decided to give it up completely for all new development.

I now had a quest to find a new language for web development.

My first inclination was to turn to Perl. It has a long history, a huge user base and code base, and a good reputation. But, I had difficulty with the language. I am sure I could have muddled through it, countless others have. I believe part of my difficulty was that I did not like the language. I had already learned and used Python for several years on other projects. I liked Python, and the underlying principles. So I was predisposed to dislike Tim Toady [1].

My quest also led me to a lot of enthusiasm for Ruby on Rails. I do not know enough about the Ruby language or 37signals' Rails to have an opinion. For me, this falls in the same category as Perl. I really do not think I need to learn a whole new language for web development. I can just leverage what [little] I already know with Python.

My first choice was Python.

Why Pylons

With Python as the language, I had many more specific choices to make, here are just a couple of them

  • MVC web framework
    • write my own
    • pluggable components (what many refer to as 'glue' style)
    • full-stack (what I refer to as 'join our church')
    • gargantuan overkill environment (what many refer to as 'zope')
  • templating
    • XML
    • anything but XML
  • database
    • SQLite
    • MySQL
    • PostgreSQL

You get the idea.

There is a LOT of discussion about web frameworks in the python community. Django, Turbogears, Pylons, or CherryPy with templating; are some of the top choices. I looked at many of the frameworks. Each has a story and a philosphy that you may like or dislike.

Before making any decisions, I test drove CherryPy with Cheetah templates. It was fun and I learned a lot about the basics of using Python in web programming. I really liked it. But I felt I needed "something more".

The common description of Django is that because of its roots in the newpaper business, it is suited for content delivery. It is also known to cater to newbies, has strong documentation, and has attracted a large following. On top of all that... python creator, GvR, has blessed the project. They make a strong case.

I dug a little deeper into their docs. Django is definitely "something more". But, for me, it may be too much more.

I also surfed around for opinions. I tried to ignore warnings from my hype-radar. I found a lot of fan-boys amd mob-followers. I also found that the buzz and enthusiasm has been whithering with some. Opponents dislike the restrictive feel of the full-stack approach.. and disagree with some of the core decisions made by the project. I read many opinions for both sides when I did my research.

Pylons, while newer, is a vibrant project and building nicely. I like their BSD-ish approach.. a set of tools that does each job well and works nicely together. These are loosely coupled so you can swap them out easily. The 'defaults' where chosen by cherry picking what they deemed to be the best of breed in each area. If you do not agree.. swap. I believe it they are more geared to the developer than being a one-stop-shop, one-size-fits-all kind of framework. I also like that they were less hype and more "code it your way, but here are some good suggestions for tools". The documentation is behind Django, but it is still good. And the community is active with mailing lists and a crowd on IRC.

I looked at Turbogears. It smelled like Pylons and it, too, seemed like a good candidate for my needs [2].

I have had exposure to Zope on a few projects over the years. I have even installed it a few times; to try and learn it. I kinda see Zope as more of a whole environment than a web development framework. I once heard it described as an aircraft carrier. It looks powerful and majestic, but it needs a deep water port for installation; and huge crew to make it do anything at all.

I also have the (unjustified, irrational, and wacky) opinion that they see your computer the same way Oracle does; "all your cycles belong to us. we do not need any of that silly operating system overhead. just give us raw disk space and we will do everything. feed me now". Of course this is not the way it really is. But, my thimble sized brain is afraid that I will be helping it run my web presence; and not the other way around. I know some pretty smart guys who do Zope. I trust them when they say I should keep an open mind and try to learn the power of the platform. They tell me that it is not as bad as people say, once you 'get it'. I dunno.. this may work for some; in large environments. But if there was ever an example of Fear, Uncertainty, and Doubt; this is it. I will politely say, thank you, no.

As the article title implies, I chose Pylons. These kinds of decisions are subjective. All the projects have put forth what they believe to be a good product. I like the choices that the Pylons framework seems to offer; and the freedom to make them. I also like their attitude, "Here are the tools you need, do with them what you want." They give you enough rope to get you started and if you want more, there is plenty available to hang yourself. And they do not force you to do things a certain way. As a quick example, I can site these things I read about the authorization module AuthKit:

Pylons is built totally on WSGI, so you can use any WSGI auth system you choose.

Because authentication and authorization information typically comes from a variety of different sources (e.g. an SQL database), any one solution is not necessarily going to fit your requirements. AuthKit provides a framework you can tweak to fit your requirements.

Permission objects are very similar to WSGI middleware and can be chained together. It is easy to define your own permission objects for authorization checks; specific to your own custom auth system using AuthKit.

Pylons installation

The first choice here is whether you should use your operating system package management or use Python's easy_install. There may be good reasons to do either, I will leave that to the reader.

The second choice is whether you should go with stable or current versions of each component. Again, there are good reasons to do either. You choose.

Footnotes

[1]One of Per's mantras - TIMTOWTDI : "There's more than one way to do it."
[2]Ironically, Turbogears in a rewrite and will probably be going in a similar direction as Pylons. It looks like I made a good choice.


Copyright © 20070702 genoverly
(db datestamp: 20070821)

nautical_flag_icon
Copyright © 2003-2015 genoverly