Archive for 2008

DjangoCon and learning from Zope 2

DjangoCon was a lot of fun. I think Jacob, Adrian, Malcom, and James are a lot of fun to hang out with, and I like them a lot — so it was good to get to see them all. I was a bit nerve-wracked about my talk which was hard to write and hard to present, so I missed out on some good times by being too preoccupied.

A TurboGears Guy talks about what Django can learn from Zope

The talk itself was first thing in the morning on after the official gathering at the bar on the previous evening, and I was asked to talk a bit about how django fit into the python web ecosystem, and how things could be better.

My goal with the talk was to shake things up a bit, and hopefully to encourage lots more cross-talk and cross pollination between Django and the rest of the python web developer community.

There is a lot to be admired in Django, and a lot we can learn from them. And at the same time, Ben Bangert, Mike Bayer, Ian Bicking, Armin Ronacher, and many, many others have been doing great things outside of django, which it would be awesome if Django users took on.

I thought the talk was well received, and Simon Wilison filed several tickets in django’s track during the talk, and I had lots of good conversations with folks after the talk was over.

But now that it’s out on YouTube, there seems to be a few people getting riled up about the talk.

I think discussion is good, and people have been saying that it’s hard to watch a 50 min. talk. So I’m going to quickly summarize a couple of points from the talk, and open up some discussion here if people want to do it.

Basically the talk is three 10-12 min talks followed by 10 minutes of QA. The first section is about Zope2 and learning from the mistakes of the past. The second is about how innovation works, and how Django fits into web-innovation in python. The third is about the future and a couple of possible suggestions for a couple of technical changes to Django that could improve things for everybody.

So, feel free to just watch the portions that you want.

Zope 2, history and not repeating the mistakes of the past

The first section is basically an argument that monolithic frameworks can lead to community fragmentation by increasing the cost of switching and by creating an attitude of “uninformed superiority” on both sides of the divide. This is among the lesions that can be learned from examining the history of Zope2.

I have a brief digression where I mention Zope’s z-shaped learning curve in this section which seems to have gathered some criticism. My point is that both through-the-web and the django admin have made getting started very easy, but require you to go back and relearn some stuff when it comes time t customize it beyond a certain point. There is lots of complexity in Zope2 that is avoided by Django, but still I think it’s pretty clear that there is a bit of similarity there. And some danger in the future if Django continues to grow in the wrong way. So, this was intended as a warning about a possible future, not as a critique of the present.

Dependency charts and Django’s “loose coupling”

Another digression in this section seems to have been been controversial. I put a couple of dependency diagrams into the talk the night before I gave it. I did this because I saw a couple things at the conference that made me think that Django developers didn’t really see what was happening in their framework.

I don’t want to be unfair to Django, but I very much thought that it’s important that Django cast of some of the complacency that seems to have grown up in the django community around the slogan “tightly integrated, but loosely coupled.” There’s a lot of great integration in Django, but I’m afraid some of the loose coupling seems to escape me. Take a look at this django dependency diagram. Django dependency diagram And I think you’ll agree that’s not exactly the definition of “loosely coupled.”

The diagram shows that there’s a lot going on inside of the Django package, and a lot of things look like they depend on one another. Someone suggested that they wanted to use the filesystem abstraction code from Django outside Django, and Adrian suggested two possible approaches:

  1. just import it from django.
  2. fork it to create a new package.

The first is hampered by the fact that it’s not at all clear as an outsider what importing one module from Django will drag into your application. A quick look at the dependency diagram here, was enough to make me realize that it was not trivial to find out exactly what will happen.

Don’t get me wrong, I think there are good things about the tightly integrated nature of Django. I just want it to be clear, that there is a trade-off, and there’s no way to magically get the benefits of both tight integration and loose coupling at the same time for free. And one of those trade-off’s is that Django can begin to become a bit of a closed system — good stuff can flow in from the outside world, but nothing flows out.

This too encourages the creation of a divide between non-django python web programmers and Djangonaughts.

OK, this has gone on plenty long enough. I’ll blog about parts 2 and 3 of my talk tomorrow.

TurboGears 1.0.6 released

The TurboGears community is pleased to announced that TurboGears 1.0.6 has been released. This version is a maintenance release that fixes bugs & glitches found since the last two months.

We are really active at the moment working on the 1.1 branch which should enter beta tomorrow. The 1.1 release will be fully retro-compatible with the 1.0 branch but will propose important new things:

  • SQLAlchemy as the default ORM
  • Genshi has the default templating engine
  • A new test system that is forward compatible with branch 1.5 & 2.0 (this is an important step toward migrating old applications written in 1.0 to 2.0 without breaking everything in the process)
  • Drop the use of RuleDispatch and use Peak Rules instead (no more C compilation)
  • Enhanced mod_wsgi compatibility to avoid past hacks that we had to do to deploy on Apache

Once 1.1 is out has a stable version we will encourage all 1.x users to go with this new version and to update their unit tests by following the TestMigration procedure.

A big work is undergoing also in the 1.5 branch to bring you CherryPy 3.1 support and further move TG into the WSGI realm.

Enjoy this new release and give feed-back in our mailing list!

Florent Aide.

10 Reasons why the new TurboGears 2 alpha is worth a look.

We just cut another release for 1.9.7a3, and it’s even more backwards compatable with TG1.

I occasionally get questions about why we are working on version 2.0 of TurboGears and what it means for users.

  • The ability to retrieve whole graphs of objects in a single query through the ORM
  • Commit entire graphs of object changes back to the database in one step
  • The ability to support multiple databases easily
  • Out of the box support for a powerful web-based interactive debugger
  • Full WSGI support
    • Your app is a WSGI app out of the box
    • You can run multiple TG2 apps in a single process
    • You easily call a any WSGI app from inside TG2
    • You can easily create and add middleware to your TG2 app
  • Easy access to a large library of helper functions in your templates
  • Out of the box support for using Routes to overide object dispatch for unusual URL’s
  • Flexible out of the box caching for pages, intermediary data, etc
  • Improved object dispatch, to better support resource oriented URL’s
  • Support of Dojo, jquery, ext.js, mootools, and other javascript libraries via ToscaWidgets

This means that TG2 apps have more flexibility and can can scale better than TG1, and we’re working on trying to make TurboGears 2 better documented than any other framework. Because we have full WSGI support you can easily mount existing WSGI applications in your TurboGears site, and you can also get things like profiling middleware, middleware that helps you find memory leaks, or any of a whole host of other interesting middleware almost for free.

There’s lots more to be done before we hit 2.0 final, we need to transparently support attomic commits across database boundaries (when the underlying stores support it). We need to make it even easier to build reusable site-components with TG2, and we need to continue to improve the TG2 documentaiton.

But I think we’re making huge progress, and I’m looking forward to the next release. The current plan is to release a 1.9.7 stable release in the next 4-8 weeks, and to release 2.0 (with the above mentioned extra features) later this year.

Doug’s awesome virtualenv scripts

I think virtualenv is horribly useful, because it is very, very common that I want to use more than one version of a library. Sometimes this is just because I want to test TurboGears 2.0 against some new version of some dependency, sometimes it’s because I’m running some old version of some project with out-dated requirements, and other times it’s just because I want to key my OS’s system python clean. Because there’s lots of virtualenvironments on my machine, and because I’m always switching between them I was very happy to find Doug Helman’s article on how to more easily manage switching between the various virtual environments that I’m working on at any given point in time.

If you use virtualenvs — and if you’re a python developer you should ;) — take a look at this article, it might make your life easier.

Host TG on IIS

Here’s a quick note on how to use IIS to serve up your TurboGears applications. This is something we need to document better, if we want to increase python/turbogears penetration in the windows market.

It’s not like asp.net is so good that they don’t need TurboGears. And TurboGears multi-threaded+multiprocess model works better on windows than many of the other “dynamic language web-frameworks which depend solely on the multi-process model.