Skip to content
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

bump min deps for 0.15 #3713

Merged
merged 13 commits into from
Jan 24, 2020
2 changes: 1 addition & 1 deletion ci/requirements/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
- numba
- numpy
- numpydoc
- pandas<0.25 # Hack around https://github.com/pydata/xarray/issues/3369
- pandas
dcherian marked this conversation as resolved.
Show resolved Hide resolved
- rasterio
- seaborn
- sphinx
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements/py36-bare-minimum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ dependencies:
- pytest
- pytest-cov
- pytest-env
- numpy=1.14
- pandas=0.24
- numpy=1.15
- pandas=0.25
6 changes: 3 additions & 3 deletions ci/requirements/py36-min-all-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ dependencies:
- nc-time-axis=1.2
- netcdf4=1.4
- numba=0.44
- numpy=1.14
- pandas=0.24
- numpy=1.15
- pandas=0.25
# - pint # See py36-min-nep18.yml
- pip
- pseudonetcdf=3.0
Expand All @@ -40,7 +40,7 @@ dependencies:
- pytest-cov
- pytest-env
- rasterio=1.0
- scipy=1.0 # Policy allows for 1.2, but scipy>=1.1 breaks numpy=1.14
- scipy=1.2 # Policy allows for 1.3
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use 1.3 then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was getting segmentation faults locally. I'll bump once I fix the tests.

- seaborn=0.9
# - sparse # See py36-min-nep18.yml
- toolz=0.10
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/py36-min-nep18.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- dask=2.4
- distributed=2.4
- numpy=1.17
- pandas=0.24
- pandas=0.25
- pint=0.9 # Actually not enough as it doesn't implement __array_function__yet!
- pytest
- pytest-cov
Expand Down
4 changes: 2 additions & 2 deletions doc/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Required dependencies
---------------------

- Python (3.6 or later)
- `numpy <http://www.numpy.org/>`__ (1.14 or later)
- `pandas <http://pandas.pydata.org/>`__ (0.24 or later)
- `numpy <http://www.numpy.org/>`__ (1.15 or later)
- `pandas <http://pandas.pydata.org/>`__ (0.25 or later)

Optional dependencies
---------------------
Expand Down
9 changes: 9 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ v0.15.0 (unreleased)

Breaking changes
~~~~~~~~~~~~~~~~
- Bumped minimum tested versions for dependencies:
- numpy 1.15
- pandas 0.25
- scipy 1.3
- bottleneck 1.3
- h5py 2.10
- rasterio 1.1
Copy link
Contributor

Choose a reason for hiding this comment

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

py36-min-all-deps.yml should have matching changes for bottleneck, h5py, rasterio

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I'm doing this incrementally since the env wasn't getting created locally.

- pseudonetcdf
Copy link
Contributor

Choose a reason for hiding this comment

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

what about pseudonetcdf?


- Remove ``compat`` and ``encoding`` kwargs from ``DataArray``, which
have been deprecated since 0.12. (:pull:`3650`).
Instead, specify the encoding when writing to disk or set
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
]

PYTHON_REQUIRES = ">=3.6"
INSTALL_REQUIRES = ["numpy >= 1.14", "pandas >= 0.24"]
INSTALL_REQUIRES = ["numpy >= 1.15", "pandas >= 0.25"]
needs_pytest = {"pytest", "test", "ptr"}.intersection(sys.argv)
SETUP_REQUIRES = ["pytest-runner >= 4.2"] if needs_pytest else []
TESTS_REQUIRE = ["pytest >= 2.7.1"]
Expand Down
2 changes: 1 addition & 1 deletion xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -2969,7 +2969,7 @@ def quantile(

See Also
--------
numpy.nanpercentile, pandas.Series.quantile, Dataset.quantile
numpy.nanquantile, pandas.Series.quantile, Dataset.quantile

Examples
--------
Expand Down
8 changes: 2 additions & 6 deletions xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4466,11 +4466,7 @@ def _set_sparse_data_from_dataframe(

idx = dataframe.index
if isinstance(idx, pd.MultiIndex):
try:
codes = idx.codes
except AttributeError:
# deprecated since pandas 0.24
codes = idx.labels
codes = idx.codes
dcherian marked this conversation as resolved.
Show resolved Hide resolved
coords = np.stack([np.asarray(code) for code in codes], axis=0)
is_sorted = idx.is_lexsorted
else:
Expand Down Expand Up @@ -5171,7 +5167,7 @@ def quantile(

See Also
--------
numpy.nanpercentile, pandas.Series.quantile, DataArray.quantile
numpy.nanquantile, pandas.Series.quantile, DataArray.quantile

Examples
--------
Expand Down
2 changes: 1 addition & 1 deletion xarray/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ def quantile(self, q, dim=None, interpolation="linear", keep_attrs=None):

See Also
--------
numpy.nanpercentile, pandas.Series.quantile, Dataset.quantile,
numpy.nanquantile, pandas.Series.quantile, Dataset.quantile,
DataArray.quantile

Examples
Expand Down
7 changes: 1 addition & 6 deletions xarray/core/nputils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@


def _validate_axis(data, axis):
ndim = data.ndim
if not -ndim <= axis < ndim:
raise IndexError(f"axis {axis!r} out of bounds [-{ndim}, {ndim})")
if axis < 0:
axis += ndim
return axis
return np.core.multiarray.normalize_axis_index(axis, data.ndim)
dcherian marked this conversation as resolved.
Show resolved Hide resolved


def _select_along_axis(values, idx, axis):
Expand Down
12 changes: 3 additions & 9 deletions xarray/core/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,7 @@ def quantile(self, q, dim=None, interpolation="linear", keep_attrs=None):

See Also
--------
numpy.nanpercentile, pandas.Series.quantile, Dataset.quantile,
numpy.nanquantile, pandas.Series.quantile, Dataset.quantile,
DataArray.quantile
"""

Expand All @@ -1734,10 +1734,6 @@ def quantile(self, q, dim=None, interpolation="linear", keep_attrs=None):
scalar = utils.is_scalar(q)
q = np.atleast_1d(np.asarray(q, dtype=np.float64))

# TODO: remove once numpy >= 1.15.0 is the minimum requirement
if np.count_nonzero(q < 0.0) or np.count_nonzero(q > 1.0):
raise ValueError("Quantiles must be in the range [0, 1]")

if dim is None:
dim = self.dims

Expand All @@ -1746,9 +1742,7 @@ def quantile(self, q, dim=None, interpolation="linear", keep_attrs=None):

def _wrapper(npa, **kwargs):
# move quantile axis to end. required for apply_ufunc

# TODO: use np.nanquantile once numpy >= 1.15.0 is the minimum requirement
return np.moveaxis(np.nanpercentile(npa, **kwargs), 0, -1)
return np.moveaxis(np.nanquantile(npa, **kwargs), 0, -1)

axis = np.arange(-1, -1 * len(dim) - 1, -1)
result = apply_ufunc(
Expand All @@ -1760,7 +1754,7 @@ def _wrapper(npa, **kwargs):
output_dtypes=[np.float64],
output_sizes={"quantile": len(q)},
dask="parallelized",
kwargs={"q": q * 100, "axis": axis, "interpolation": interpolation},
kwargs={"q": q, "axis": axis, "interpolation": interpolation},
)

# for backward compatibility
Expand Down
8 changes: 1 addition & 7 deletions xarray/plot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,6 @@ def _add_colorbar(primitive, ax, cbar_ax, cbar_kwargs, cmap_params):

def _rescale_imshow_rgb(darray, vmin, vmax, robust):
assert robust or vmin is not None or vmax is not None
# TODO: remove when min numpy version is bumped to 1.13
# There's a cyclic dependency via DataArray, so we can't import from
# xarray.ufuncs in global scope.
from xarray.ufuncs import maximum, minimum

# Calculate vmin and vmax automatically for `robust=True`
if robust:
Expand Down Expand Up @@ -579,9 +575,7 @@ def _rescale_imshow_rgb(darray, vmin, vmax, robust):
# After scaling, downcast to 32-bit float. This substantially reduces
# memory usage after we hand `darray` off to matplotlib.
darray = ((darray.astype("f8") - vmin) / (vmax - vmin)).astype("f4")
with warnings.catch_warnings():
warnings.filterwarnings("ignore", "xarray.ufuncs", PendingDeprecationWarning)
return minimum(maximum(darray, 0), 1)
return np.minimum(np.maximum(darray, 0), 1)


def _update_axes(
Expand Down
4 changes: 0 additions & 4 deletions xarray/tests/test_dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ def test_repr_multiindex(self):
)
assert expected == repr(self.mda)

@pytest.mark.skipif(
LooseVersion(np.__version__) < "1.15",
reason="old versions of numpy have different printing behavior",
)
def test_repr_multiindex_long(self):
mindex_long = pd.MultiIndex.from_product(
[["a", "b", "c", "d"], [1, 2, 3, 4, 5, 6, 7, 8]],
Expand Down