diff --git a/doc/conf.py b/doc/conf.py index 4d94e81f46f..564120c059b 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -22,6 +22,11 @@ print "numpy: %s, %s" % (numpy.__version__, numpy.__file__) except ImportError: print "no numpy" +try: + import scipy + print "scipy: %s, %s" % (scipy.__version__, scipy.__file__) +except ImportError: + print "no scipy" try: import pandas print "pandas: %s, %s" % (pandas.__version__, pandas.__file__) @@ -68,7 +73,7 @@ def __getattr__(cls, name): else: return Mock() -MOCK_MODULES = ['netCDF4', 'scipy', 'scipy.io'] +MOCK_MODULES = ['netCDF4'] for mod_name in MOCK_MODULES: sys.modules[mod_name] = Mock() diff --git a/doc/requirements.txt b/doc/requirements.txt index 852a47407eb..edd1774fab1 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,8 +1,9 @@ # only the dependencies required to build xray's docs # all others (netCDF4, scipy) are mocked out in conf.py -numpy==1.8.1 +numpy>=1.7 ipython==2.0.0 pandas==0.13.1 -six python-dateutil +scipy +six matplotlib diff --git a/doc/tutorial.rst b/doc/tutorial.rst index d8339cef927..3ea329d3718 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -391,6 +391,17 @@ skip missing values, but we expect to switch to NA skipping versions (like pandas) in the future. For now, you can do NA skipping aggregate by passing NA aware numpy functions to the :py:attr:`~xray.DataArray.reduce` method: +.. ipython:: python + :suppress: + + # monkey patch numpy with nanmean from scipy.stats so the docs can build + # even with numpy 1.7 (np.nanmean first appears in numpy 1.8). + # this is to work around an unfortunate limitation of readthedocs/pip which + # stops us from upgrading both numpy and pandas. + + from scipy import stats + np.nanmean = stats.nanmean + .. ipython:: python foo.reduce(np.nanmean, 'time') diff --git a/setup.py b/setup.py index 31475e9325d..4620f258c8c 100644 --- a/setup.py +++ b/setup.py @@ -153,8 +153,8 @@ def write_version_py(filename=None): classifiers=CLASSIFIERS, description=DESCRIPTION, long_description=LONG_DESCRIPTION, - install_requires=['numpy >= 1.8', 'pandas >= 0.13.1'], - tests_require=['mock >= 1.0.1', 'nose >= 1.0'], + install_requires=['numpy >= 1.7', 'pandas >= 0.13.1'], + tests_require=['nose >= 1.0'], url=URL, test_suite='nose.collector', packages=['xray', 'xray.backends'])