There are 4 posts tagged with pylons.

There is an Atom feed for posts tagged with pylons.

A new kind of wiki

2007-10-18 Tags: , , ,

What is a wiki? It has to be more then a just program to transform _light_ *weight* text markup into valid html. Beyond the markup, a wiki is a platform to help many persons work on a shared document. Being a programmer, I'm familiar with this concept since we use similar tools to work on shared programming projects: revision control systems.

The state of the art in revision control systems is Git and Mercurial. What is it that makes then so good? Some people will tell you that it's because they are distributed. That's a good point but there is more to it. They manage to work without centralized authority by merging concurrent changes. To be able to do that, they have to be able to detect which changes you need to merge and and which ones you already have and the key to do that is to keep the full family lineage of every revision of every files for all the people that you work with. The main problem with Subversion is not that it's centralized, it's that it flattens the history into a linear series of revision and that destroys the hope for smart merges.

Git and Setuptools

2007-09-28 Tags: , , ,

Explicit is better than implicit. It's in the Zen of Python. Who could disagree? Setuptools has a feature that would prevent me from reaching peace of mind. You can tell it to include in your package all the files that you track with a revision control system. I used to prefer being explicit by using MANIFEST.in, until I started to heavily refactor a package layout. This is one thing that Git does really well. You just add all the new files recursively and it will figure out which files are really new and which are new names for old files. But updating MANIFEST.in can become quite a pain.

What happens in practice is that rules in MANIFEST.in have an extremely broad scope. The latest Pylons recursively includes everything in the template directory. It would be a pain to make the right rule; you need to include all the templates for all the templating languages supported by Buffet and each engine is really permissive on the file extension used to name its template. The current rule will match all Emacs backup files and a lot of junk that most people don't want to distribute. When I switched to include the files tracked by a revision control, the only file that I don't explicitly wanted in there was .gitignore. In this case, being explicit on what we don't want is a lot cleaner than being explicit on what we do want.

"Oh wait," you may ask. I mentioned using Git but Setuptools has no Git plugin. Until now. Here is gitlsfiles (2.4 egg, 2.5 egg), a plugin to have Setuptools packages all the files tracked by Git. You just need to install it and Setuptools will figure out the rest.

On object infested APIs

2007-07-12 Tags: , , ,

An interesting discussion spawned on #pylons about the merits of Form Encode, a library to handle form validation. It has a nice API with decorators that will handle a lot of simple usage. But it's abstraction is leaky when one wants to use it for previewing or to do validation that needs to inspect more than one field. The way to make new validators is object infected. You need to derive from an existing validator to extend it. Since Python have closures, I suggested, an API where you add sub-validation with hooks would probably be cleaner for most usage. "Objects are an abomination before the Lord" replied Paul Snively (nick: psnively).

The Emacs API uses hooks all over the place. It's nice because you can add and remove stuff without changing the base code. And unrelated code can be inserted into a single hook which is hard to do with inheritance.

Server meltdown

2007-06-05 Tags: , , , , ,

My post on building a better soda can stove was a test run for my new blog engine. For some reason, it got a lot more attention than I was hoping for. In turn, it rose to the front page on Reddit, Del.icio.us, Digg, and Makezine. Oh my...

What happened exactly? I'm not sure but I will tell my side of the story. I run this website on my home DSL. I have an upload cap of 80 kb/s. This is not great but until now it was plenty enough. Once my new blogging engine was running, I did a few test with Apache bench to see how responsive it was. Everything was fine and it didn't require much CPU load to saturate my uplink. But it didn't feel right, this test was way too artificial. At 7h16, I submitted my howto to Reddit, just to see a real world traffic spike. I didn't expect much, maybe a few hundred hits before I was down voted into oblivion. Exactly seven seconds after hitting submit, I had my first visitor. Not bad, I thought. Then an other one, and an other one, and it kept pouring like that for 36 hours. As I write this, I have brief periods of sub-saturation for the first time.