"""PyAMG: Algebraic Multigrid Solvers in Python"""
from __future__ import absolute_import

__doc__ += """

Utility tools
-------------

  test        --- Run pyamg unittests (requires nose unittest framework)
  bench       --- Run pyamg benchmarks (requires nose unittest framework)
  __version__ --- pyamg version string

"""

# Emit a warning if numpy is too old
import numpy as np
majver, minver = [float(i) for i in np.version.version.split('.')[:2]]
if majver < 1 or (majver == 1 and minver < 2):
    import warnings
    warnings.warn("Numpy 1.2.0 or above is recommended for this version of\
                  PyAMG (detected version %s)" % np.version.version,
                  UserWarning)

# Emit a warning if scipy is too old
import scipy as sp
majver, minver = [float(i) for i in sp.version.version.split('.')[:2]]
if minver < 0.7:
    import warnings
    warnings.warn("SciPy 0.7 or above is recommended for this version of\
                  PyAMG (detected version %s)" % sp.version.version,
                  UserWarning)

from .version import git_revision as __git_revision__
from .version import version as __version__

from .multilevel import *
from .classical import ruge_stuben_solver
from .aggregation import smoothed_aggregation_solver, rootnode_solver
from .gallery import demo
from .blackbox import solve, solver, solver_configuration

__all__ = [s for s in dir() if not s.startswith('_')]
__all__ += ['test', '__version__']

from numpy.testing import Tester
test = Tester().test
bench = Tester().bench

"""PyAMG: Algebraic Multigrid Solvers in Python"""
from __future__ import absolute_import

__doc__ += """

Utility tools
-------------

  test        --- Run pyamg unittests (requires nose unittest framework)
  bench       --- Run pyamg benchmarks (requires nose unittest framework)
  __version__ --- pyamg version string

"""

# Warn on old numpy or scipy
import numpy as np
npreq = '1.6'
npmin = [int(j) for j in npreq.split('.')]
npver = [int(j) for j in np.__version__.split('.')]
if npver[0] < npmin[0] or (npver[0] >= npmin[0] and npver[1] < npmin[1]):
    import warnings
    warnings.warn("Numpy %s or above is recommended for this version of"
                  "PyAMG (detected version %s)" % (npmin, npver),
                  UserWarning)

import scipy as sp
spreq = '0.11'
spmin = [int(j) for j in spreq.split('.')]
spver = [int(j) for j in sp.__version__.split('.')]
if spver[0] < spmin[0] or (spver[0] >= spmin[0] and spver[1] < spmin[1]):
    print('hi')
    import warnings
    warnings.warn("SciPy %s or above is recommended for this version of"
                  "PyAMG (detected version %s)" % (spmin, spver),
                  UserWarning)

from .version import git_revision as __git_revision__
from .version import version as __version__

from .multilevel import *
from .classical import ruge_stuben_solver
from .aggregation import smoothed_aggregation_solver, rootnode_solver
from .gallery import demo
from .blackbox import solve, solver, solver_configuration

__all__ = [s for s in dir() if not s.startswith('_')]
__all__ += ['test', '__version__']

from numpy.testing import Tester
test = Tester().test
bench = Tester().bench

clean up init checks