Kid's Getting a (not so) Little Brother?

Genshi

Those guys who brought you Trac are looking for a replacement template system for ClearSilver. They came up with Markup Genshi (see second update below) (not to confuse with Markdown, John Gruber's text-to-HTML formatting syntax), which is heavily influenced by Kid. They did not use Kid since it has some critical issues that originate deep inside the system. I experienced some of them myself.

There is a list of differences between Markup and Kid. Advantages over Kid include:

  • XPath expressions for py:match
  • XInclude instead of the (in some way odd) py:extends and py:layout
  • additional directives for conditionals
  • far better error tracebacks are possible to a specific position in a template; in Kid, it's like tapping in the (semi-)darkness
  • no dependency on ElementTree since it doesn't allow for the preceding feature

Disadvantages are:

  • no compiled Python files (.pyc) are generated, templates are executed directly
  • no inline Python with <?python ?> PIs

The drawbacks are bearable, the improvements might get killer reasons for a change.

Last week version 0.2 was released and it looks very promising. Even Kevin Dangoor (of TurboGears fame) considers switching TG from Kid to Markup in the future.

I'll definitely take a closer look on the next versions. I might switch my sites to it, but it also seems to be a good choice for my tiny apps. For them, I had a hard time to choose between SimpleTAL (no dependencies, but an unnecessary additional mini-language that gets in my way) and Kid (much better syntax, but requires ElementTree, and Python 2.5 is neither common nor final) with both being pure-Python and about 100 KB in size. I'm confident that Markup will be a better alternative to both.

But the name will definitely become a problem, at least for the users :-)

Update: I just finished moving homework from Kid to Markup - and I'm very happy with the result. The xi:include is much clearer than py:layout and py:match are. The possibility to use directives like py:if/py:for/py:def as elements also saves some bloat like py:strips and makes the the templates even more concise. Markup is definitly my first choice now.

Please note that I had an issue with the 0.2 release and used fresh SVN exports instead.

Update: Markup has just been renamed to Genshi. The name change will come into effect with the next release, 0.3.

Update: The 0.3 release is available, allowing to use easy_install Genshi now.