pydata / sparse

Sparse multi-dimensional arrays for the PyData ecosystem

Home Page:https://sparse.pydata.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove runtime dependency on SciPy

rgommers opened this issue · comments

Right now scipy is a hard dependency, but all it's used for is to do a few isinstance checks. A dependency is undesirable here both because it's heavy and because it's a bit circular when testing PyData Sparse support in the SciPy test suite. sparse should work without scipy installed.

It shouldn't be too difficult to get rid of this; the isinstance checks could use something like this instead:

def _is_scipy_sparse_obj(x): # supports sparse arrays and matrices
    if hasattr(x, '__class__') and `x.__class__.startswith('scipy.sparse'):
        return True
    return False

That sounds like a low-hanging fruit indeed.