[Numpy-discussion] Template system

Robert Kern robert.kern at gmail.com
Fri Jan 11 21:02:22 EST 2008


Charles R Harris wrote:
> 
> 
> On Jan 11, 2008 2:58 PM, Robert Kern <robert.kern at gmail.com 
> <mailto:robert.kern at gmail.com>> wrote:
> 
>     Charles R Harris wrote:
>      > Hi All,
>      >
>      > I'm thinking of adding the template system I pulled out of Django to
>      > Numpy to use in place of the current code generator. Its
>     advantages are
>      > documentation, flexibility, and maintainance. The code totals
>     about 470
>      > KB, comes with a BSD license, and is compatible with Python >= 2.3. I
>      > want to bring this up on the list because I'm sure there will be
>      > objections along the lines of "why do we need that"?  So I want
>     to see
>      > how strenuous the objections are.
> 
>     It's too big. If you want a better template system than the current
>     one, there
>     are a few which are contained in a single file. That would be fine
>     to include,
>     but I object strongly to incorporating Jinja.
> 
> 
> Ummm, harsh. I'm certainly open to suggestions. I took a closer look at 
> the django system and reduced it to 308K, 70K zipped. There was a lot of 
> space taken up by the .svn directories inherited from django and *.pyc 
> files. I could probably knock another 50K off by removing some 
> functionality we don't really need: html, http, dates, time, and maybe 
> template inheritance. Just for comparison, here are some things that are 
> in a fresh checkout of numpy, including the .svn files
> 
> Numpy 23 MB
> f2py   5.4 MB
> doc/swig 1.5 MB
> code_generators 192K
> 
> So adding the template subsystem would increase the repository size by 
> about 1.4%.  Do you have any objections in addition to the size?

Yes. I'm not convinced that we need anything better than we have now. Show me 
how using Jinja templates makes the current code better. Check the one-file 
templating modules (like YAPTU[1] or Cog[2]) out there to see if those are 
sufficient. Jinja and its kin (Mako, Cheetah, etc.) are intended for a very 
different use case, and their design, implementation, and footprint are 
optimized for that.

[1] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52305
[2] http://nedbatchelder.com/code/cog/

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco



More information about the NumPy-Discussion mailing list