From c47f35db4e73507b4ac729ec23b0faf8ceb5ace1 Mon Sep 17 00:00:00 2001 From: Justus Magin Date: Sat, 30 Dec 2023 23:10:07 +0100 Subject: [PATCH 1/2] ignore a `DeprecationWarning` emitted by `seaborn` (#8576) * move the ignore from the cli to `xarray.tests` * ignore `seaborn` using deprecated API --- .github/workflows/ci-additional.yaml | 9 ++++----- xarray/tests/__init__.py | 20 +++++++++++++++++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 49b10fbbb59..d88ee73ba2f 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -76,11 +76,10 @@ jobs: # Raise an error if there are warnings in the doctests, with `-Werror`. # This is a trial; if it presents an problem, feel free to remove. # See https://github.com/pydata/xarray/issues/7164 for more info. - - # ignores: - # 1. h5py: see https://github.com/pydata/xarray/issues/8537 - python -m pytest --doctest-modules xarray --ignore xarray/tests -Werror \ - -W "ignore:h5py is running against HDF5 1.14.3:UserWarning" + # + # If dependencies emit warnings we can't do anything about, add ignores to + # `xarray/tests/__init__.py`. + python -m pytest --doctest-modules xarray --ignore xarray/tests -Werror mypy: name: Mypy diff --git a/xarray/tests/__init__.py b/xarray/tests/__init__.py index 7e173528222..9d65c3ef021 100644 --- a/xarray/tests/__init__.py +++ b/xarray/tests/__init__.py @@ -71,10 +71,17 @@ def _importorskip( message="'cgi' is deprecated and slated for removal in Python 3.13", category=DeprecationWarning, ) - has_pydap, requires_pydap = _importorskip("pydap.client") has_netCDF4, requires_netCDF4 = _importorskip("netCDF4") -has_h5netcdf, requires_h5netcdf = _importorskip("h5netcdf") +with warnings.catch_warnings(): + # see https://github.com/pydata/xarray/issues/8537 + warnings.filterwarnings( + "ignore", + message="h5py is running against HDF5 1.14.3", + category=UserWarning, + ) + + has_h5netcdf, requires_h5netcdf = _importorskip("h5netcdf") has_pynio, requires_pynio = _importorskip("Nio") has_cftime, requires_cftime = _importorskip("cftime") has_dask, requires_dask = _importorskip("dask") @@ -84,7 +91,14 @@ def _importorskip( has_fsspec, requires_fsspec = _importorskip("fsspec") has_iris, requires_iris = _importorskip("iris") has_numbagg, requires_numbagg = _importorskip("numbagg", "0.4.0") -has_seaborn, requires_seaborn = _importorskip("seaborn") +with warnings.catch_warnings(): + warnings.filterwarnings( + "ignore", + message="is_categorical_dtype is deprecated and will be removed in a future version.", + category=DeprecationWarning, + ) + # seaborn uses the deprecated `pandas.is_categorical_dtype` + has_seaborn, requires_seaborn = _importorskip("seaborn") has_sparse, requires_sparse = _importorskip("sparse") has_cupy, requires_cupy = _importorskip("cupy") has_cartopy, requires_cartopy = _importorskip("cartopy") From 41d33f52f709a765fb0dbfb5b9b4f5ea55173053 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:20:02 +0100 Subject: [PATCH 2/2] [pre-commit.ci] pre-commit autoupdate (#8578) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.6 → v0.1.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.6...v0.1.9) - [github.com/psf/black: 23.11.0 → 23.12.1](https://github.com/psf/black/compare/23.11.0...23.12.1) - [github.com/pre-commit/mirrors-mypy: v1.7.1 → v1.8.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.7.1...v1.8.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * use the compiled version of `black` --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Justus Magin --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 102cfadcb70..464d80d7415 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,13 +18,13 @@ repos: files: ^xarray/ - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.1.6' + rev: 'v0.1.9' hooks: - id: ruff args: ["--fix"] # https://github.com/python/black#version-control-integration - - repo: https://github.com/psf/black - rev: 23.11.0 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 23.12.1 hooks: - id: black-jupyter - repo: https://github.com/keewis/blackdoc @@ -32,10 +32,10 @@ repos: hooks: - id: blackdoc exclude: "generate_aggregations.py" - additional_dependencies: ["black==23.11.0"] + additional_dependencies: ["black==23.12.1"] - id: blackdoc-autoupdate-black - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.7.1 + rev: v1.8.0 hooks: - id: mypy # Copied from setup.cfg