From 99ee8c6ca54057a9b994d7685f36236f2d5a69d9 Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Tue, 3 Dec 2024 20:17:45 +0100 Subject: [PATCH] Add Pyproject pre-commit hooks (#9840) * add taplo pre-commit hook * move TODO https://github.com/tamasfe/taplo/issues/706 * add validate-pyproject pre-commit hook --- .pre-commit-config.yaml | 10 ++++++++++ pyproject.toml | 21 ++++++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7e22cf8ab37..8d2b2ee809e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -63,3 +63,13 @@ repos: rev: ebf0b5e44d67f8beaa1cd13a0d0393ea04c6058d hooks: - id: validate-cff + - repo: https://github.com/ComPWA/taplo-pre-commit + rev: v0.9.3 + hooks: + - id: taplo-format + args: ["--option", "array_auto_collapse=false"] + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.23 + hooks: + - id: validate-pyproject + additional_dependencies: ["validate-pyproject-schema-store[all]"] diff --git a/pyproject.toml b/pyproject.toml index 3ac1a024195..e6c63c4d010 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] authors = [ - {name = "xarray Developers", email = "xarray@googlegroups.com"}, + { name = "xarray Developers", email = "xarray@googlegroups.com" }, ] classifiers = [ "Development Status :: 5 - Production/Stable", @@ -16,7 +16,7 @@ classifiers = [ ] description = "N-D labeled arrays and datasets in Python" dynamic = ["version"] -license = {text = "Apache-2.0"} +license = { text = "Apache-2.0" } name = "xarray" readme = "README.md" requires-python = ">=3.10" @@ -50,7 +50,16 @@ dev = [ "sphinx_autosummary_accessors", "xarray[complete]", ] -io = ["netCDF4", "h5netcdf", "scipy", 'pydap; python_version<"3.10"', "zarr", "fsspec", "cftime", "pooch"] +io = [ + "netCDF4", + "h5netcdf", + "scipy", + 'pydap; python_version<"3.10"', + "zarr", + "fsspec", + "cftime", + "pooch", +] etc = ["sparse"] parallel = ["dask[complete]"] viz = ["cartopy", "matplotlib", "nc-time-axis", "seaborn"] @@ -249,7 +258,7 @@ extend-select = [ "RUF", ] extend-safe-fixes = [ - "TID252", # absolute imports + "TID252", # absolute imports ] ignore = [ "E402", # module level import not at top of file @@ -327,7 +336,9 @@ filterwarnings = [ "default:the `pandas.MultiIndex` object:FutureWarning:xarray.tests.test_variable", "default:Using a non-tuple sequence for multidimensional indexing is deprecated:FutureWarning", "default:Duplicate dimension names present:UserWarning:xarray.namedarray.core", - "default:::xarray.tests.test_strategies", # TODO: remove once we know how to deal with a changed signature in protocols + + # TODO: remove once we know how to deal with a changed signature in protocols + "default:::xarray.tests.test_strategies", ] log_cli_level = "INFO"