Farm Development

What Makes Pylons Stand Out As a Web Framework

After 6 release candidates, Pylons 0.9.7 final has been released. Big congrats to all developers. Although it's just a point release, I think this is a huge milestone for Pylons for one reason: It has proper documentation! I've been using both Pylons and Django for several web applications and Pylons' old docs were sparse and hard to navigate. This didn't stop me from digging in and playing around with the framework but for a project to really reach a wide audience it needs well-organized, readable documentation. I can think of many well designed, solid programming tools that have failed because, simply, their docs were not readable. There is a difference between having comprehensive documentation and having documentation that is readable. Django got this right from day one.

As a Pylons user, I'd like to point out a few reasons why I like it and some reasons I don't. It's not meant as a fair comparison to Django, but Django is the only other web framework I know pretty well so it is my point of reference.

Likes:

Dislikes:

As a disclaimer I should point out that I am one of those developers who likes to build low level tools. I certainly reuse existing components when possible but building small tools that do one thing and do it well is fun because it's easy. Pylons fosters this approach to software. Not all developers are like this and I'd say, overall, Django probably offers more of a "batteries included" feeling.

  • Re: What Makes Pylons Stand Out As a Web Framework

    In your dislikes you mention routing. As a Rails dev I must say one of the things I love is the simple declarative routing mechanism. Looking at the Django docs scares me. Are you really saying you prefer to write a file full of regexp's instead?

  • Re: What Makes Pylons Stand Out As a Web Framework

    @Andrew Bloom

    In some ways I agree that the simplicity of Routes is nice, but that the same time, when URLs define an actual API, simplicity becomes a negative. For example, if you are doing content negotiation via simple extension and provide a default without an extension, then you'd want to be particular about when a trailing slash needs to be appended and 303s are returned. This is something of a contrived example, but a small convenience can backfire in some cases.

    I don't say this to bash Routes either. I've used it and other dispatchers happily, but I've also ran into cases where I would have preferred a simple regex and lose the magic.

  • Re: What Makes Pylons Stand Out As a Web Framework

    @Andrew Bloom

    In some ways I agree that the simplicity of Routes is nice, but that the same time, when URLs define an actual API, simplicity becomes a negative. For example, if you are doing content negotiation via simple extension and provide a default without an extension, then you'd want to be particular about when a trailing slash needs to be appended and 303s are returned. This is something of a contrived example, but a small convenience can backfire in some cases.

    I don't say this to bash Routes either. I've used it and other dispatchers happily, but I've also ran into cases where I would have preferred a simple regex and lose the magic.

  • Re: What Makes Pylons Stand Out As a Web Framework

    Since I'm using Pylons side by side with Django, I agree with the argument that Pylons could use a more visible app sharing framework. I'd like one that used Routes' syntax, since I find it slightly more attractive than writing regexs. That being said, I extracted Django's dispatcher into a piece of WSGI middleware a few years back and have kept it up to date. It can dispatch on regexes and glob patterns. I know Kevin Dangoor's using it in Bespin, a new project from Mozilla Labs.

    http://pypi.python.org/pypi/urlrelay/

  • Re: What Makes Pylons Stand Out As a Web Framework

    @L.C. Rees : this rocks! I'm glad you posted the link; I didn't know about it. I like the regex style because you can look at the URL mappings and you know exactly what's happening, you don't have to read the docs.

    When I was learning Routes I found everything very unintuitive. It is clean and simple but it is an abstraction that I had to learn, like another language. It wasn't hard to learn but, for example, one time I needed to route to a controller in a submodule. Was it controller='submodule.the_controller' or was it controller='submodule/the_controller' ? There should be an intuitive answer to a question like that.

  • Re: What Makes Pylons Stand Out As a Web Framework

    By the way, it seems Django is quickly growing a newfound fondness for one-letter variables:

    http://docs.djangoproject.com/en/dev/topics/db/queries/#query-expressions

    And I believe there is a Q() around as well.

  • Re: What Makes Pylons Stand Out As a Web Framework

    The WebOb do-it-yourself framework has a nice example of a URL dispatcher with a clean syntax and (optionally) using regex. Have a look at:

    http://pythonpaste.org/webob/do-it-yourself.html#routing

  • Re: What Makes Pylons Stand Out As a Web Framework

    Ben, re: Django one-letter variables, that is unfortunate.

  • Re: What Makes Pylons Stand Out As a Web Framework

    If you like django's url routing, you might want to try Selector from luke arno:

    http://lukearno.com/projects/selector/

    I prefer using pre-built patterns to use rather than using raw regex everywhere, as I find them much more usable. Nice thing is you can still fall back to regex when you need to do something weird. I've ported this module to use w/ django's url routing; ymmv:

    http://dev.jmoiron.net/hg/jmoiron.net/file/tip/saudade/common/urls.py

    As for 1 letter var names, Q() in django's orm is a query object, used most often to build queries that would require SQL's OR. While I don't particularly like django's orm, I don't mind 1 letter variable names if 1. they are central to what the library does and 2. their arguments are more descriptive of what they're doing than the full name would be. Like $ in prototype/jQuery, or translation routines that are frequently renamed to "_" in C applications.

  • Re: What Makes Pylons Stand Out As a Web Framework

    TurboGears has rewritten their API to sit on top of Pylons:

    http://www.turbogears.org/2.0/docs/main/WhatsNew.html

    Basically, it's Pylons with all the batteries included.

    The team I'm working with was completely sold on using Pylons because we wanted to use specific components, like SQLAlchemy and Genshi. However, TurboGears has picked the components we wanted to use so now we are seriously considering using it instead. I've had very good experiences in the #turbogears channel.

  • Re: What Makes Pylons Stand Out As a Web Framework

    @brainsik Maybe they will merge "officially" at PyCon. Wouldn't that be sweet. If they could get Armin to join the team too, that would be the dream team...

  • Re: What Makes Pylons Stand Out As a Web Framework

    Actually, I think it makes sense for them to remain separate. It allows Pylons to focus on being a "core" webapp layer and for TurboGears to focus on providing all the widgets and extra convenience for routing, python-code configs, an administrative command line tool, etc.

  • Re: What Makes Pylons Stand Out As a Web Framework

    @Kumar: I like the whole Kubuntu/Ubuntu think Mike Orr talks about. I think that is a great way to describe Turbogears and Pylons. Just different flavors off the same code base.

Note: HTML tags will be stripped. Hit enter twice for a new paragraph.

Recent Projects

  • JSTestNet

    Like botnet but for JS tests in CI.

  • Nose Nicedots

    Nose plugin that prints nicer dots.

  • Fudge

    Mock objects for testing.

  • Fixture

    Loading and referencing test data.

  • NoseJS

    Nose plugin that runs JavaScript tests for a Python project.

  • Wikir

    converts reST to various Wiki formats.