[Numpy-discussion] "import numpy" is slow

David Cournapeau cournapeau@cslab.kecl.ntt.co...
Thu Jul 31 01:41:15 CDT 2008


On Thu, 2008-07-31 at 08:12 +0200, Andrew Dalke wrote:
> On Jul 31, 2008, at 3:53 AM, David Cournapeau wrote:
> > You are supposed to run the tests on an installed numpy, not in the
> > sources:
> >
> > import numpy
> > numpy.test(verbose = 10)
> 
> Doesn't that make things more cumbersome to test?  That is, if I were  
> to make a change I would need to:
>    - python setup.py build  (to put the code into the build/*  
> subdirectory)
>    - cd the build directory, or switch to a terminal which was  
> already there
>    - manually do the import/test code you wrote, or a write two-line  
> program for it

Yes. Nothing that an easy make file cannot solve, nonetheless (I am sure
I am not the only one with a makefile/script which automates the above,
to test a new svn updated numpy in one command).

The problem is that it is difficult to support running uninstalled
packages, in particular because of compiled code (distutils/setuptools
have a develop mode to make this possible, though). Distutils put the
build code in build directory, and the correct tree is built at install
time.

> 
> I would rather do 'nosetests' in the source tree, if at all feasible,  
> although that might only be possible for the Python source.

Yes but how do you do that ? You would do import scipy in an svn
checkout, and the C extensions would be the ones installed ? That sounds
like a nightmare from a reliability POV.

There was a related discussion (using scipy wo installing it) on scipy
ML, BTW:

http://projects.scipy.org/pipermail/scipy-user/2008-July/017678.html

cheers,

David



More information about the Numpy-discussion mailing list