Re: [Numpy-discussion] Testing numpy without doing an installation?

2006-10-17 Thread pearu

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 <[EMAIL PROTECTED]> 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
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Testing numpy without doing an installation?

2006-10-17 Thread Stefan van der Walt
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 <[EMAIL PROTECTED]> 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?

At the moment, if you run numpy from the source directory, you see the
message

In [1]: import numpy
Running from numpy source directory.

after which you can't access any of the numpy functions.  This would
be due to this snippet in __init__.py:

try:
from __config__ import show as show_config
except ImportError:
show_config = None

if show_config is None:
import sys as _sys
print >> _sys.stderr, 'Running from numpy source directory.'
del _sys

If we declare set_package_path and restore_path in __init__.py, we can
wrap all imports in numpy with

set_package_path('../../..') # set path back required depth
from numpy import whatever, you, need
restore_path()

That would take care of things on the python side, at least.

Cheers
Stéfan

-
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
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Testing numpy without doing an installation?

2006-10-17 Thread Francesc Altet
A Divendres 13 Octubre 2006 22:20, Lisandro Dalcin va escriure:
> On 10/13/06, Francesc Altet <[EMAIL PROTECTED]> 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.

Cheers,

-- 
>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"

-
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
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Testing numpy without doing an installation?

2006-10-13 Thread Lisandro Dalcin
On 10/13/06, Francesc Altet <[EMAIL PROTECTED]> 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

and then

$ python -c 'import numpy; numpy.test()'

and finally,  if all was right,

su -c 'python setup.py install'

or

python setup.py install --home=$HOME

-- 
Lisandro Dalcín
---
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

-
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
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion