From 1e4ae63081cd68d2d5ba6e87ba9d4f0fc8319c01 Mon Sep 17 00:00:00 2001 From: s-weigand Date: Sat, 29 Jan 2022 08:44:45 +0100 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=A9=B9=20Added=20packaging=20to=20ins?= =?UTF-8?q?tall=5Frequires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index f9e0afa6445..2d7b9e7ff39 100644 --- a/setup.cfg +++ b/setup.cfg @@ -77,6 +77,7 @@ python_requires = >=3.8 install_requires = numpy >= 1.18 pandas >= 1.1 + packaging [options.extras_require] io = From 958638a0afd9b468192f55fa55b597fb1c917e91 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 31 Jan 2022 08:49:59 -0800 Subject: [PATCH 2/8] add packaging dep to ci, install instructions, and whatsnew page --- .binder/environment.yml | 1 + ci/install-upstream-wheels.sh | 1 + ci/requirements/doc.yml | 1 + ci/requirements/environment-windows.yml | 1 + ci/requirements/environment.yml | 1 + ci/requirements/py38-bare-minimum.yml | 1 + ci/requirements/py38-min-all-deps.yml | 1 + ci/requirements/py39-all-but-dask.yml | 1 + doc/getting-started-guide/installing.rst | 1 + doc/whats-new.rst | 3 ++- setup.cfg | 2 +- 11 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.binder/environment.yml b/.binder/environment.yml index 6caea42df87..99a7d9f2494 100644 --- a/.binder/environment.yml +++ b/.binder/environment.yml @@ -23,6 +23,7 @@ dependencies: - netcdf4 - numba - numpy + - packaging - pandas - pint - pip diff --git a/ci/install-upstream-wheels.sh b/ci/install-upstream-wheels.sh index 89cc81d0f3f..4c6a8922c26 100755 --- a/ci/install-upstream-wheels.sh +++ b/ci/install-upstream-wheels.sh @@ -40,6 +40,7 @@ python -m pip install \ git+https://github.com/zarr-developers/zarr \ git+https://github.com/Unidata/cftime \ git+https://github.com/mapbox/rasterio \ + git+https://github.com/pypa/packaging \ git+https://github.com/hgrecco/pint \ git+https://github.com/pydata/sparse \ git+https://github.com/intake/filesystem_spec \ diff --git a/ci/requirements/doc.yml b/ci/requirements/doc.yml index a27a26d5cac..e5fcc500f70 100644 --- a/ci/requirements/doc.yml +++ b/ci/requirements/doc.yml @@ -19,6 +19,7 @@ dependencies: - netcdf4>=1.5 - numba - numpy>=1.17 + - packaging>=20.0 - pandas>=1.0 - pooch - pip diff --git a/ci/requirements/environment-windows.yml b/ci/requirements/environment-windows.yml index 05fa5fecba0..6c389c22ce6 100644 --- a/ci/requirements/environment-windows.yml +++ b/ci/requirements/environment-windows.yml @@ -22,6 +22,7 @@ dependencies: - netcdf4 - numba - numpy + - packaging - pandas - pint - pip diff --git a/ci/requirements/environment.yml b/ci/requirements/environment.yml index 46371247c4d..516c964afc7 100644 --- a/ci/requirements/environment.yml +++ b/ci/requirements/environment.yml @@ -25,6 +25,7 @@ dependencies: - numba - numexpr - numpy + - packaging - pandas - pint - pip diff --git a/ci/requirements/py38-bare-minimum.yml b/ci/requirements/py38-bare-minimum.yml index c6e3ac504a8..5986ec7186b 100644 --- a/ci/requirements/py38-bare-minimum.yml +++ b/ci/requirements/py38-bare-minimum.yml @@ -11,4 +11,5 @@ dependencies: - pytest-env - pytest-xdist - numpy=1.18 + - packaging=20.0 - pandas=1.1 diff --git a/ci/requirements/py38-min-all-deps.yml b/ci/requirements/py38-min-all-deps.yml index a6459b92ccb..76e2b28093d 100644 --- a/ci/requirements/py38-min-all-deps.yml +++ b/ci/requirements/py38-min-all-deps.yml @@ -33,6 +33,7 @@ dependencies: - netcdf4=1.5.3 - numba=0.51 - numpy=1.18 + - packaging=20.0 - pandas=1.1 - pint=0.16 - pip diff --git a/ci/requirements/py39-all-but-dask.yml b/ci/requirements/py39-all-but-dask.yml index 21217e79c7c..9c42d5f3b73 100644 --- a/ci/requirements/py39-all-but-dask.yml +++ b/ci/requirements/py39-all-but-dask.yml @@ -23,6 +23,7 @@ dependencies: - netcdf4 - numba - numpy + - packaging - pandas - pint - pip diff --git a/doc/getting-started-guide/installing.rst b/doc/getting-started-guide/installing.rst index 6f437a2dc4c..c14e7d36579 100644 --- a/doc/getting-started-guide/installing.rst +++ b/doc/getting-started-guide/installing.rst @@ -8,6 +8,7 @@ Required dependencies - Python (3.8 or later) - `numpy `__ (1.18 or later) +- `packaging `__ (20.0 or later) - `pandas `__ (1.1 or later) .. _optional-dependencies: diff --git a/doc/whats-new.rst b/doc/whats-new.rst index a33f557a179..3a296298a56 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -33,7 +33,8 @@ Deprecations Bug fixes ~~~~~~~~~ - +- Add `packaging` as a dependency to Xarray (:issue:`6216`, :pull:`6207`). + By `Joseph Nowak `_ and `Joe Hamman `_. Documentation ~~~~~~~~~~~~~ diff --git a/setup.cfg b/setup.cfg index 2d7b9e7ff39..f9f8ae5c4dc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -77,7 +77,7 @@ python_requires = >=3.8 install_requires = numpy >= 1.18 pandas >= 1.1 - packaging + packaging >= 20.0 [options.extras_require] io = From 26421a851cc17b98b2d95e9b99d8e6242c01548c Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 31 Jan 2022 08:52:06 -0800 Subject: [PATCH 3/8] lint --- doc/contributing.rst | 4 ++-- doc/whats-new.rst | 4 ++-- xarray/core/computation.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/contributing.rst b/doc/contributing.rst index f5653fcc65e..18029cc74bf 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -274,13 +274,13 @@ Some other important things to know about the docs: .. ipython:: python x = 2 - x ** 3 + x**3 will be rendered as:: In [1]: x = 2 - In [2]: x ** 3 + In [2]: x**3 Out[2]: 8 Almost all code examples in the docs are run (and the output saved) during the diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 3a296298a56..f2549bb3aa9 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -5102,7 +5102,7 @@ Enhancements .. ipython:: python ds = xray.Dataset(coords={"x": range(100), "y": range(100)}) - ds["distance"] = np.sqrt(ds.x ** 2 + ds.y ** 2) + ds["distance"] = np.sqrt(ds.x**2 + ds.y**2) @savefig where_example.png width=4in height=4in ds.distance.where(ds.distance < 100).plot() @@ -5310,7 +5310,7 @@ Enhancements .. ipython:: python ds = xray.Dataset({"y": ("x", [1, 2, 3])}) - ds.assign(z=lambda ds: ds.y ** 2) + ds.assign(z=lambda ds: ds.y**2) ds.assign_coords(z=("x", ["a", "b", "c"])) These methods return a new Dataset (or DataArray) with updated data or diff --git a/xarray/core/computation.py b/xarray/core/computation.py index 7273d25253d..98cbe1037c6 100644 --- a/xarray/core/computation.py +++ b/xarray/core/computation.py @@ -944,7 +944,7 @@ def apply_ufunc( Calculate the vector magnitude of two arguments: >>> def magnitude(a, b): - ... func = lambda x, y: np.sqrt(x ** 2 + y ** 2) + ... func = lambda x, y: np.sqrt(x**2 + y**2) ... return xr.apply_ufunc(func, a, b) ... From d9e58611e0fcd5c63598505cce196e9cb7cb6755 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 31 Jan 2022 16:54:18 +0000 Subject: [PATCH 4/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/contributing.rst | 4 ++-- doc/whats-new.rst | 4 ++-- xarray/core/computation.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/contributing.rst b/doc/contributing.rst index 18029cc74bf..f5653fcc65e 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -274,13 +274,13 @@ Some other important things to know about the docs: .. ipython:: python x = 2 - x**3 + x ** 3 will be rendered as:: In [1]: x = 2 - In [2]: x**3 + In [2]: x ** 3 Out[2]: 8 Almost all code examples in the docs are run (and the output saved) during the diff --git a/doc/whats-new.rst b/doc/whats-new.rst index f2549bb3aa9..3a296298a56 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -5102,7 +5102,7 @@ Enhancements .. ipython:: python ds = xray.Dataset(coords={"x": range(100), "y": range(100)}) - ds["distance"] = np.sqrt(ds.x**2 + ds.y**2) + ds["distance"] = np.sqrt(ds.x ** 2 + ds.y ** 2) @savefig where_example.png width=4in height=4in ds.distance.where(ds.distance < 100).plot() @@ -5310,7 +5310,7 @@ Enhancements .. ipython:: python ds = xray.Dataset({"y": ("x", [1, 2, 3])}) - ds.assign(z=lambda ds: ds.y**2) + ds.assign(z=lambda ds: ds.y ** 2) ds.assign_coords(z=("x", ["a", "b", "c"])) These methods return a new Dataset (or DataArray) with updated data or diff --git a/xarray/core/computation.py b/xarray/core/computation.py index 98cbe1037c6..7273d25253d 100644 --- a/xarray/core/computation.py +++ b/xarray/core/computation.py @@ -944,7 +944,7 @@ def apply_ufunc( Calculate the vector magnitude of two arguments: >>> def magnitude(a, b): - ... func = lambda x, y: np.sqrt(x**2 + y**2) + ... func = lambda x, y: np.sqrt(x ** 2 + y ** 2) ... return xr.apply_ufunc(func, a, b) ... From ac0cc94ba6d6ede8052a1fd103a6882fc8bd18c8 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 31 Jan 2022 09:20:54 -0800 Subject: [PATCH 5/8] uninstall packaging before installing upstream --- ci/install-upstream-wheels.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/install-upstream-wheels.sh b/ci/install-upstream-wheels.sh index 4c6a8922c26..86c661be56b 100755 --- a/ci/install-upstream-wheels.sh +++ b/ci/install-upstream-wheels.sh @@ -11,6 +11,7 @@ conda uninstall -y --force \ zarr \ cftime \ rasterio \ + packaging \ pint \ sparse \ h5netcdf \ From abbccb5e5152aae1566a5db47056587a1ecd8cce Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 31 Jan 2022 13:12:24 -0800 Subject: [PATCH 6/8] update requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 729a3655125..37417908cf4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,5 @@ # https://help.github.com/en/github/visualizing-repository-data-with-graphs/listing-the-packages-that-a-repository-depends-on numpy >= 1.18 +packaging >= 20.0 pandas >= 1.1 From 4406f36ff72485529ad9b4866c54f0ff2fcbc6b5 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 31 Jan 2022 13:12:55 -0800 Subject: [PATCH 7/8] update whats new and rerun linter --- doc/contributing.rst | 4 ++-- doc/whats-new.rst | 6 +++--- xarray/core/computation.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/contributing.rst b/doc/contributing.rst index f5653fcc65e..18029cc74bf 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -274,13 +274,13 @@ Some other important things to know about the docs: .. ipython:: python x = 2 - x ** 3 + x**3 will be rendered as:: In [1]: x = 2 - In [2]: x ** 3 + In [2]: x**3 Out[2]: 8 Almost all code examples in the docs are run (and the output saved) during the diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 3a296298a56..792bef484d7 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -34,7 +34,7 @@ Deprecations Bug fixes ~~~~~~~~~ - Add `packaging` as a dependency to Xarray (:issue:`6216`, :pull:`6207`). - By `Joseph Nowak `_ and `Joe Hamman `_. + By `Sebastian Weigand `_ and `Joe Hamman `_. Documentation ~~~~~~~~~~~~~ @@ -5102,7 +5102,7 @@ Enhancements .. ipython:: python ds = xray.Dataset(coords={"x": range(100), "y": range(100)}) - ds["distance"] = np.sqrt(ds.x ** 2 + ds.y ** 2) + ds["distance"] = np.sqrt(ds.x**2 + ds.y**2) @savefig where_example.png width=4in height=4in ds.distance.where(ds.distance < 100).plot() @@ -5310,7 +5310,7 @@ Enhancements .. ipython:: python ds = xray.Dataset({"y": ("x", [1, 2, 3])}) - ds.assign(z=lambda ds: ds.y ** 2) + ds.assign(z=lambda ds: ds.y**2) ds.assign_coords(z=("x", ["a", "b", "c"])) These methods return a new Dataset (or DataArray) with updated data or diff --git a/xarray/core/computation.py b/xarray/core/computation.py index 7273d25253d..98cbe1037c6 100644 --- a/xarray/core/computation.py +++ b/xarray/core/computation.py @@ -944,7 +944,7 @@ def apply_ufunc( Calculate the vector magnitude of two arguments: >>> def magnitude(a, b): - ... func = lambda x, y: np.sqrt(x ** 2 + y ** 2) + ... func = lambda x, y: np.sqrt(x**2 + y**2) ... return xr.apply_ufunc(func, a, b) ... From 1c64bd8ef4e62d96ffc96889501d71b36d041fa5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 31 Jan 2022 21:15:52 +0000 Subject: [PATCH 8/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/contributing.rst | 4 ++-- doc/whats-new.rst | 4 ++-- xarray/core/computation.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/contributing.rst b/doc/contributing.rst index 18029cc74bf..f5653fcc65e 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -274,13 +274,13 @@ Some other important things to know about the docs: .. ipython:: python x = 2 - x**3 + x ** 3 will be rendered as:: In [1]: x = 2 - In [2]: x**3 + In [2]: x ** 3 Out[2]: 8 Almost all code examples in the docs are run (and the output saved) during the diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 792bef484d7..520be67211d 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -5102,7 +5102,7 @@ Enhancements .. ipython:: python ds = xray.Dataset(coords={"x": range(100), "y": range(100)}) - ds["distance"] = np.sqrt(ds.x**2 + ds.y**2) + ds["distance"] = np.sqrt(ds.x ** 2 + ds.y ** 2) @savefig where_example.png width=4in height=4in ds.distance.where(ds.distance < 100).plot() @@ -5310,7 +5310,7 @@ Enhancements .. ipython:: python ds = xray.Dataset({"y": ("x", [1, 2, 3])}) - ds.assign(z=lambda ds: ds.y**2) + ds.assign(z=lambda ds: ds.y ** 2) ds.assign_coords(z=("x", ["a", "b", "c"])) These methods return a new Dataset (or DataArray) with updated data or diff --git a/xarray/core/computation.py b/xarray/core/computation.py index 98cbe1037c6..7273d25253d 100644 --- a/xarray/core/computation.py +++ b/xarray/core/computation.py @@ -944,7 +944,7 @@ def apply_ufunc( Calculate the vector magnitude of two arguments: >>> def magnitude(a, b): - ... func = lambda x, y: np.sqrt(x**2 + y**2) + ... func = lambda x, y: np.sqrt(x ** 2 + y ** 2) ... return xr.apply_ufunc(func, a, b) ...