From 9a7a26d064d8d41d88793ec14ada9e51d8ebfdfa Mon Sep 17 00:00:00 2001 From: James Lamb Date: Fri, 3 Jan 2025 12:17:14 -0600 Subject: [PATCH] update all pre-commit hooks (#36) Working on #35, I noticed that some of the `pre-commit` hooks here were fairly old. This updates all of them, to pull in bugfixes and improvements. --- .pre-commit-config.yaml | 8 ++++---- src/rapids_metadata/metadata.py | 7 ++----- tests/test_json.py | 18 ++++++++++++------ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bfe0334..e6e0537 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: trailing-whitespace exclude: | @@ -15,7 +15,7 @@ repos: rapids-metadata[.]json$| schemas/rapids-metadata-v[0-9]+[.]json$ - repo: https://github.com/rapidsai/dependency-file-generator - rev: v1.13.11 + rev: v1.17.0 hooks: - id: rapids-dependency-file-generator args: ["--clean"] @@ -24,7 +24,7 @@ repos: hooks: - id: codespell - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.8 + rev: v0.8.5 hooks: - id: ruff args: ["--fix"] @@ -35,7 +35,7 @@ repos: - id: verify-copyright args: [--fix, --main-branch=main] - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.10.0' + rev: 'v1.14.1' hooks: - id: mypy args: [ diff --git a/src/rapids_metadata/metadata.py b/src/rapids_metadata/metadata.py index e5155c2..61e2b04 100644 --- a/src/rapids_metadata/metadata.py +++ b/src/rapids_metadata/metadata.py @@ -1,4 +1,4 @@ -# Copyright (c) 2024, NVIDIA CORPORATION. +# Copyright (c) 2024-2025, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,10 +30,7 @@ @dataclass class RAPIDSPackage: - ( - """Package published by a RAPIDS repository. Includes both Python packages """ - """and Conda packages.""" - ) + """Package published by a RAPIDS repository. Includes both Python packages and Conda packages.""" publishes_prereleases: bool = Field( default=True, diff --git a/tests/test_json.py b/tests/test_json.py index 250e1ef..d36d366 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -1,4 +1,4 @@ -# Copyright (c) 2024, NVIDIA CORPORATION. +# Copyright (c) 2024-2025, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -351,8 +351,10 @@ def check_output(output: str): else: assert output == expected_json - with set_cwd(tmp_path), patch("sys.argv", ["rapids-metadata-json", *args]), patch( - "rapids_metadata.json.all_metadata", mock_metadata + with ( + set_cwd(tmp_path), + patch("sys.argv", ["rapids-metadata-json", *args]), + patch("rapids_metadata.json.all_metadata", mock_metadata), ): rapids_json.main() captured = capsys.readouterr() @@ -363,9 +365,13 @@ def check_output(output: str): captured = capsys.readouterr() check_output(captured.out) - with set_cwd(tmp_path), patch( - "sys.argv", ["rapids-metadata-json", *args, "-o", "rapids-metadata.json"] - ), patch("rapids_metadata.json.all_metadata", mock_metadata): + with ( + set_cwd(tmp_path), + patch( + "sys.argv", ["rapids-metadata-json", *args, "-o", "rapids-metadata.json"] + ), + patch("rapids_metadata.json.all_metadata", mock_metadata), + ): rapids_json.main() with open("rapids-metadata.json") as f: written_json = f.read()