Skip to content
forked from pydata/xarray

Commit cbd5afb

Browse files
committed
Merge remote-tracking branch 'upstream/master' into compat-override
* upstream/master: chunk sparse arrays (pydata#3202) Annotations for .data_vars() and .coords() (pydata#3207) Remove duck_array_ops.as_like_arrays() (pydata#3204) Match mypy version between CI and pre-commit hook (pydata#3203) BUG fix +test .sel method gives error with float32 values (pydata#3153) fix precommit file (pydata#3201) Enforce mypy compliance in CI (pydata#3197)
2 parents 29396fe + c782637 commit cbd5afb

17 files changed

+245
-179
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
- [ ] Closes #xxxx
44
- [ ] Tests added
5-
- [ ] Passes `black .` & `flake8`
5+
- [ ] Passes `black . && mypy . && flake8`
66
- [ ] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API

.pre-commit-config.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ repos:
1010
rev: v2.2.3
1111
hooks:
1212
- id: flake8
13+
- repo: https://github.com/pre-commit/mirrors-mypy
14+
rev: v0.720 # Must match ci/requirements/*.yml
15+
hooks:
16+
- id: mypy
1317
# run these occasionally, ref discussion https://github.com/pydata/xarray/pull/3194
1418
# - repo: https://github.com/asottile/pyupgrade
1519
# rev: v1.22.1

azure-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
- template: ci/azure/install.yml
7676
- bash: |
7777
source activate xarray-tests
78-
mypy . || exit 0
78+
mypy .
7979
displayName: mypy type checks
8080
8181
- job: Docs

ci/requirements/py36.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ dependencies:
1515
- pytest-env
1616
- coveralls
1717
- flake8
18+
- mypy==0.720 # Must match .pre-commit-config.yaml
1819
- numpy>=1.12
1920
- pandas>=0.19
2021
- pip
@@ -34,5 +35,4 @@ dependencies:
3435
- iris>=1.10
3536
- pydap
3637
- lxml
37-
- pip:
38-
- mypy==0.711
38+

ci/requirements/py37.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dependencies:
1616
- pytest-env
1717
- coveralls
1818
- flake8
19+
- mypy==0.720 # Must match .pre-commit-config.yaml
1920
- numpy>=1.12
2021
- pandas>=0.19
2122
- pip
@@ -32,5 +33,4 @@ dependencies:
3233
- lxml
3334
- pydap
3435
- pip:
35-
- mypy==0.650
3636
- numbagg

doc/whats-new.rst

+25-11
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,42 @@ What's New
1313
import xarray as xr
1414
np.random.seed(123456)
1515
16-
.. _whats-new.0.12.4:
16+
.. _whats-new.0.13.0:
1717

18-
v0.12.4 (unreleased)
19-
-------------------
18+
v0.13.0 (unreleased)
19+
--------------------
2020

2121
This release increases the minimum required Python version from 3.5.0 to 3.5.3
2222
(:issue:`3089`). By `Guido Imperiale <https://github.com/crusaderky>`_.
2323

2424
New functions/methods
2525
~~~~~~~~~~~~~~~~~~~~~
2626

27-
- Added :py:meth:`DataArray.broadcast_like` and :py:meth:`Dataset.broadcast_like`.
28-
By `Deepak Cherian <https://github.com/dcherian>`_ and `David Mertz
29-
<http://github.com/DavidMertz>`_.
27+
- xarray can now wrap around any
28+
`NEP18 <https://www.numpy.org/neps/nep-0018-array-function-protocol.html>`_ compliant
29+
numpy-like library (important: read notes about NUMPY_EXPERIMENTAL_ARRAY_FUNCTION in
30+
the above link). Added explicit test coverage for
31+
`sparse <https://github.com/pydata/sparse>`_. (:issue:`3117`, :issue:`3202`)
32+
By `Nezar Abdennur <https://github.com/nvictus>`_
33+
and `Guido Imperiale <https://github.com/crusaderky>`_.
3034

31-
- The xarray package is now discoverably by mypy (although typing hints
32-
coverage is not complete yet). mypy users can now remove from their setup.cfg
33-
the lines::
35+
- The xarray package is now discoverable by mypy (although typing hints coverage is not
36+
complete yet). mypy type checking is now enforced by CI. Libraries that depend on
37+
xarray and use mypy can now remove from their setup.cfg the lines::
3438

3539
[mypy-xarray]
3640
ignore_missing_imports = True
3741

38-
By `Guido Imperiale <https://github.com/crusaderky>`_
42+
(:issue:`2877`, :issue:`3088`, :issue:`3090`, :issue:`3112`, :issue:`3117`,
43+
:issue:`3207`)
44+
By `Guido Imperiale <https://github.com/crusaderky>`_
45+
and `Maximilian Roos <https://github.com/max-sixty>`_.
3946

40-
- Dataset plotting API for visualizing dependences between two `DataArray`s!
47+
- Added :py:meth:`DataArray.broadcast_like` and :py:meth:`Dataset.broadcast_like`.
48+
By `Deepak Cherian <https://github.com/dcherian>`_ and `David Mertz
49+
<http://github.com/DavidMertz>`_.
50+
51+
- Dataset plotting API for visualizing dependencies between two `DataArray`s!
4152
Currently only :py:meth:`Dataset.plot.scatter` is implemented.
4253
By `Yohai Bar Sinai <https://github.com/yohai>`_ and `Deepak Cherian <https://github.com/dcherian>`_
4354

@@ -62,6 +73,9 @@ Bug fixes
6273
- XFAIL several tests which are expected to fail on ARM systems
6374
due to a ``datetime`` issue in NumPy (:issue:`2334`).
6475
By `Graham Inggs <https://github.com/ginggs>`_.
76+
- Fix KeyError that arises when using .sel method with float values
77+
different from coords float type (:issue:`3137`).
78+
By `Hasan Ahmad <https://github.com/HasanAhmadQ7>`_.
6579
- Fixed bug in ``combine_by_coords()`` causing a `ValueError` if the input had
6680
an unused dimension with coordinates which were not monotonic (:issue:`3150`).
6781
By `Tom Nicholas <http://github.com/TomNicholas>`_.

xarray/core/common.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ def wrapped_func(self, dim=None, axis=None, skipna=None, **kwargs):
4646

4747
else:
4848

49-
def wrapped_func(
50-
self,
51-
dim=None,
52-
axis=None, # type: ignore
53-
**kwargs
54-
):
49+
def wrapped_func(self, dim=None, axis=None, **kwargs): # type: ignore
5550
return self.reduce(func, dim, axis, allow_lazy=True, **kwargs)
5651

5752
return wrapped_func

0 commit comments

Comments
 (0)