Skip to content

Require only numpy 1.7 for the benefit of readthedocs #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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()
Expand Down
5 changes: 3 additions & 2 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions doc/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: it turns out we aren't using mock in our tests anymore, so I removed this.

url=URL,
test_suite='nose.collector',
packages=['xray', 'xray.backends'])