Re: [Numpy-discussion] Template system

2008-01-12 Thread Robert Kern
Charles R Harris wrote:
 OK, so far I've knocked it down to 35KB by removing stuff I'm not 
 interested in. It is now smaller than Cog, and 7x larger than the file 
 we now use to do the same job. I'm pretty sure I can make it leaner than 
 that. It remains extensible.

Can you put a tarball up somewhere? Django generally requires environment 
variables to configure itself. There is a way to configure these from code, but 
it looks like that pulls in django.conf. This is my primary source of 
discomfort 
with using Django templates. My experience with using Django components outside 
of a Django web app has been frustrating. The more modifications we make, the 
more we have to maintain. And if any of it causes problems for someone trying 
to 
build numpy, that's more questions we need to answer. I want to answer numpy 
questions, not Django questions.

I would be much, much more comfortable with an implementation that can simply 
be 
dropped in without modification.

-- 
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
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Template system

2008-01-12 Thread Charles R Harris
On Jan 12, 2008 4:12 AM, Robert Kern [EMAIL PROTECTED] wrote:

 Charles R Harris wrote:
  OK, so far I've knocked it down to 35KB by removing stuff I'm not
  interested in. It is now smaller than Cog, and 7x larger than the file
  we now use to do the same job. I'm pretty sure I can make it leaner than
  that. It remains extensible.

 Can you put a tarball up somewhere? Django generally requires environment
 variables to configure itself. There is a way to configure these from
 code, but
 it looks like that pulls in django.conf. This is my primary source of
 discomfort


Yeah, I had that problem running Django straight from the box.
Pain.In.The.Ass. However, the easiest way to just get the template subsystem
out is to delete a bunch of files and rename global_settings to settings.
Then I also changed the name django to something else and put some imports
in the __init__, but you don't have to do that. Easily done with a script.


 with using Django templates. My experience with using Django components
 outside
 of a Django web app has been frustrating. The more modifications we make,
 the
 more we have to maintain. And if any of it causes problems for someone
 trying to
 build numpy, that's more questions we need to answer. I want to answer
 numpy
 questions, not Django questions.

 I would be much, much more comfortable with an implementation that can
 simply be
 dropped in without modification.


Well, now I'm all hot to see how small I can make it while keeping the
ability to add bits back in. You've got me digging through the code with the
usual results. The configuration file is gone entirely, I'm cleaning up
other bits, and getting rid of automatic html escaping, caching, and  other
such serving nonsense because, well, I don't need it.

Chuck
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Template system

2008-01-11 Thread Charles R Harris
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.

Chuck
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Template system

2008-01-11 Thread Robert Kern
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.

-- 
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
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Template system

2008-01-11 Thread Charles R Harris
On Jan 11, 2008 2:58 PM, Robert Kern [EMAIL PROTECTED] 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?

Chuck
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Template system

2008-01-11 Thread Robert Kern
Charles R Harris wrote:
 
 
 On Jan 11, 2008 2:58 PM, Robert Kern [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] 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
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Template system

2008-01-11 Thread Charles R Harris
OK, so far I've knocked it down to 35KB by removing stuff I'm not interested
in. It is now smaller than Cog, and 7x larger than the file we now use to do
the same job. I'm pretty sure I can make it leaner than that. It remains
extensible.

On Jan 11, 2008 7:02 PM, Robert Kern [EMAIL PROTECTED] wrote:

 Charles R Harris wrote:
 
 
  On Jan 11, 2008 2:58 PM, Robert Kern [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] 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
 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Template system

2008-01-11 Thread David Cournapeau
Charles R Harris wrote:
 OK, so far I've knocked it down to 35KB by removing stuff I'm not 
 interested in. It is now smaller than Cog, and 7x larger than the file 
 we now use to do the same job. I'm pretty sure I can make it leaner 
 than that. It remains extensible.
One good way to see whereas it is a worthwhile addition would be to give 
an example of one source file using this new template.

cheers,

David
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion