Cheetah best for templating?

R

Roger Jack

I have just finished reading Code Generation In Action which uses Ruby for
code generation. I would like to use Python instead. Is Cheetah the best
tool to use for templating source code files and then generating code? Is
there something more mature or better?

Thanks!

--
Roger Jack
Elegance Technologies, Inc.
484.431.1775
(e-mail address removed)
www.elegancetech.com
 
R

Rene Pijlman

Roger Jack:
Is Cheetah the best tool to use for templating source code files
and then generating code?

I've choosen it for a project recently and IMO it's a good templating
system.

It would be good to get a little more guidance for using it in an easy
PHP-way with mod_python, but other than that I have no gripes.
 
E

Erik Max Francis

Roger said:
I have just finished reading Code Generation In Action which uses Ruby
for
code generation. I would like to use Python instead. Is Cheetah the
best
tool to use for templating source code files and then generating code?
Is
there something more mature or better?

I tend to think highly of EmPy, but that's not exactly a surprise :):

http://www.alcyone.com/software/empy/

I do know that there are several people on the EmPy mailing list using
EmPy for exactly the purpose you're considering.

What's going to be best for you is really going to depend on your
aesthetic sensibilities; pretty much all of templating systems' base
features are universal, just expressed in different ways. The only
thing that might objectively make one system better than another for you
would be ancillary features which are included on top.
 
G

Giles Brown

Roger Jack said:
I have just finished reading Code Generation In Action which uses Ruby for
code generation. I would like to use Python instead. Is Cheetah the best
tool to use for templating source code files and then generating code? Is
there something more mature or better?

I had a project where I wanted to generate some pro*c + C++ database code.
I found that the Python Template Language that comes with Quixote was
very convenient for this purpose, because it avoids needing to learn
another syntax.

Quixote: http://www.mems-exchange.org/software/quixote/
PTL: http://www.mems-exchange.org/software/quixote/doc/PTL.html

Regards,
Giles
 
W

Wilk

Roger Jack said:
I have just finished reading Code Generation In Action which uses Ruby for
code generation. I would like to use Python instead. Is Cheetah the best
tool to use for templating source code files and then generating code? Is
there something more mature or better?

My graphist and me found it excellent, fast, clear, simple, stable : Pythonic !

We found the others engines too verbose, more perlish ;-)

Like python, the best is to try somes engines, you will see quickly wich
one you need. First, like everybody, i did my own engine, but Cheetah
was finaly a better wheel !

I use it to generate html, latex and xml
 
V

Ville Vainio

Erik Max Francis said:
I tend to think highly of EmPy, but that's not exactly a surprise :):

http://www.alcyone.com/software/empy/

I do know that there are several people on the EmPy mailing list using
EmPy for exactly the purpose you're considering.

Including yours truly. Also, the source code generation problem might
be solved trivially by checking out

http://www.students.tut.fi/~vainio24/pywiz/
What's going to be best for you is really going to depend on your
aesthetic sensibilities; pretty much all of templating systems' base
features are universal, just expressed in different ways. The only

Also, there is very little to lose by taking a cursory glance at each
one and choosing what seems easiest (assuming they have the same level
of power).

Short EmPy tutorial:

---------- myfile.em -------------------

@{
# statements
import time
var1 = 12
var2 = "Hello"
}

@var2 World! @var1 plus one is @(var1+1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top