[SciPy-dev] More bugs fixed
pearu at scipy.org
Sun Oct 9 12:31:23 CDT 2005
On Sun, 9 Oct 2005, Arnd Baecker wrote:
>>> When only "scipy core" is installed,
>>> scipy.linalg will just contain the basic routines,
>>> and use lapack_lite (and possibly no dotblas etc.).
>>> When also "scipy full" is installed, scipy.linalg will
>>> have the full glory of all the routines provided in present scipy.
>>> Technically the question is if there is
>>> a way to achieve this without "scipy full" overwriting
>>> files from "scipy core" (thinking of .deb/.rpm/... packages).
>>> Does this sound reasonable and feasible?
>> Reasonable, yes. Feasible, not really, I don't think. At the moment, the
>> scipy_core versions are "physically" under scipy.basic. In
>> scipy/__init__.py, we have a block like this:
>> import scipy.basic.fft as fftpack
>> import scipy.basic.linalg as linalg
>> import scipy.basic.random as random
>> So "from scipy import linalg" should work even with scipy_core. I'm not
>> entirely sure if this is going to continue to work in the various
>> situations where you can't overwrite stuff,
> Would something like
> import scipy.THE_FULL_ONE.fft as fftpack
> import scipy.THE_FULL_ONE.linalg as linalg
> import scipy.THE_FULL_ONE.random as random
> except ImportError:
> import scipy.basic.fft as fftpack
> import scipy.basic.linalg as linalg
> import scipy.basic.random as random
> This assumes that the routines from
> `THE_FULL_ONE` are compatible with the `basic` ones.
It would probably work but it is a bad idea as it assumes that packages
are are always bug-free, which is not true in real world.
IMO any try-except block should be implemented so that it always behaves
according to the meaning when the try-except block was introduced. So,
try-except blocks should be very minimal both in code as well as in
Anyway, I would suggest implementing scipy/__init__.py such that it would
not require modifications when a new Scipy package has been included.
So, it means that the __init__.py files should recognize somehow which
scipy subdirectories are SciPy packages and then import them + update
documentations and test suites. This was
implemented in Scipy 0.3 Lib/__init__.py file, see the _import_packages()
function, for Scipy 0.4 it may require some revision though.
More information about the Scipy-dev