Testing numpy without doing an installation?

pearu at cens.ioc.ee pearu at cens.ioc.ee
Tue Oct 17 06:04:11 CDT 2006


On Tue, 17 Oct 2006, Stefan van der Walt wrote:

> On Tue, Oct 17, 2006 at 10:03:03AM +0200, Francesc Altet wrote:
> > A Divendres 13 Octubre 2006 22:20, Lisandro Dalcin va escriure:
> > > On 10/13/06, Francesc Altet <faltet at carabos.com> wrote:
> > > > Is it possible to test a numpy version directly from the source
> > > > directory without having to install it?
> > >
> > > I usually do:
> > >
> > > $ python setup.py build
> > > $ python setup.py install --home=/tmp
> > > $ export PYTHONPATH=/tmp/lib/python
> > 
> > Thanks for your answer Lisandro, but what I want is to completely avoid an 
> > installation. The idea is to be able to test the local copy version of numpy 
> > in the development directory while doing small changes on it. Having to do 
> > the install step slows down the testing phase when doing small
> > changes.
> 
> It would be great if we could get this to work.  One problem is that
> distutils won't build the C-modules in place.  Does anyone know of a
> workaround?

Actually numpy.distutils supports in place builds of C modules.
However, its rather difficult to make numpy inplace to work for the
following reasons:
- to build a numpy based C extension, you'll need numpy header files
- numpy header files are generated during numpy build
So it is a chicken-egg problem.

One workaround for testing a numpy subpackage would be installing 
numpy and then doing inplace build in numpy subpackage directory. For
example:
  
  cd svn/numpy
  python setup.py install
  cd numpy/fft
  python setup.py build build_ext --inplace

Another workaround would be to install only numpy.core (that contains
numpy headers) and then doing inplace builds in numpy source directory ---
this, however, requires some setup.py modifications.

IMO, doing inplace builds has side effects that can easily lead to
shooting to a leg. While developing numpy, I would recommend always
installing numpy to some place, setting PYTHONPATH accordingly, write
unittests, and run them for testing. When test_*.py files are set up
properly then you don't need to install everytime you modify unittests,
they can be run inplace.

Pearu


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list