From 430d40f2f848c1d5626ba032eebd3546e6d15522 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 28 Jul 2026 13:33:44 -0500 Subject: [PATCH] chore(ci): enforce 'yamllint' checks --- .pre-commit-config.yaml | 153 +++++++++--------- .pre-commit-hooks.yaml | 16 +- .yamllint.yaml | 37 +++++ .../overlapping-deps/dependencies.yaml | 8 +- .../requirements-pip-dict/dependencies.yaml | 2 +- 5 files changed, 131 insertions(+), 85 deletions(-) create mode 100644 .yamllint.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 70f82094..4e8300c5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,72 +1,81 @@ -ci: - autofix_commit_msg: "chore(ci): pre-commit auto fixes" - autoupdate_commit_msg: "chore(ci): pre-commit autoupdate" - autoupdate_schedule: quarterly -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: 'v6.0.0' - hooks: - - id: end-of-file-fixer - - id: trailing-whitespace - - id: check-builtin-literals - - id: check-executables-have-shebangs - - id: check-json - - id: check-yaml - - id: debug-statements - - id: requirements-txt-fixer - - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v2.3.0' - hooks: - - id: mypy - additional_dependencies: [types-PyYAML] - args: ["--config-file=pyproject.toml", "src/", "docs/"] - pass_filenames: false - - repo: https://github.com/asottile/pyupgrade - rev: 'v3.21.2' - hooks: - - id: pyupgrade - args: - - --py39-plus - - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.37.4 - hooks: - - id: check-metaschema - files: ^src/rapids_dependency_file_generator/schema.json$ - - id: check-jsonschema - files: ^tests/examples/([^/]*)/dependencies.yaml$ - args: ["--schemafile", "src/rapids_dependency_file_generator/schema.json"] - - id: check-github-workflows - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.22 - hooks: - - id: ruff - files: src/.*$ - - id: ruff-format - files: src/.*$ - - repo: https://github.com/rstcheck/rstcheck - rev: v6.2.5 - hooks: - - id: rstcheck - args: ["--config", "pyproject.toml"] - additional_dependencies: - - 'rstcheck[sphinx,toml]' - exclude: - (?x) - ^docs/source/_templates/.*$ - - repo: https://github.com/shellcheck-py/shellcheck-py - rev: v0.11.0.1 - hooks: - - id: shellcheck - - repo: https://github.com/rapidsai/pre-commit-hooks - rev: v1.6.1 - hooks: - - id: verify-pyproject-license - exclude: - (?x) - ^tests/.*$ - - repo: https://github.com/zizmorcore/zizmor-pre-commit - rev: v1.27.0 - hooks: - - id: zizmor -default_language_version: - python: python3 +ci: + autofix_commit_msg: "chore(ci): pre-commit auto fixes" + autoupdate_commit_msg: "chore(ci): pre-commit autoupdate" + autoupdate_schedule: quarterly +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: 'v6.0.0' + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-builtin-literals + - id: check-executables-have-shebangs + - id: check-json + - id: check-yaml + - id: debug-statements + - id: requirements-txt-fixer + - repo: https://github.com/pre-commit/mirrors-mypy + rev: 'v2.3.0' + hooks: + - id: mypy + additional_dependencies: [types-PyYAML] + args: ["--config-file=pyproject.toml", "src/", "docs/"] + pass_filenames: false + - repo: https://github.com/asottile/pyupgrade + rev: 'v3.21.2' + hooks: + - id: pyupgrade + args: + - --py39-plus + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.37.4 + hooks: + - id: check-metaschema + files: ^src/rapids_dependency_file_generator/schema.json$ + - id: check-jsonschema + files: ^tests/examples/([^/]*)/dependencies.yaml$ + args: ["--schemafile", "src/rapids_dependency_file_generator/schema.json"] + - id: check-github-workflows + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.15.22 + hooks: + - id: ruff + files: src/.*$ + - id: ruff-format + files: src/.*$ + - repo: https://github.com/rstcheck/rstcheck + rev: v6.2.5 + hooks: + - id: rstcheck + args: ["--config", "pyproject.toml"] + additional_dependencies: + - 'rstcheck[sphinx,toml]' + exclude: + (?x) + ^docs/source/_templates/.*$ + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.11.0.1 + hooks: + - id: shellcheck + - repo: https://github.com/rapidsai/pre-commit-hooks + rev: v1.6.1 + hooks: + - id: verify-pyproject-license + exclude: + (?x) + ^tests/.*$ + - repo: https://github.com/adrienverge/yamllint + rev: v1.38.0 + hooks: + - id: yamllint + additional_dependencies: [pyyaml] + exclude: | + (?x)^( + .*/output/expected/.*$ + ) + - repo: https://github.com/zizmorcore/zizmor-pre-commit + rev: v1.27.0 + hooks: + - id: zizmor +default_language_version: + python: python3 diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 3a272532..8cbc551c 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,8 +1,8 @@ -- id: rapids-dependency-file-generator - name: RAPIDS dependency file generator - description: Update dependency files according to the RAPIDS dependencies spec - entry: rapids-dependency-file-generator - language: python - files: "dependencies.yaml" - pass_filenames: false - args: [--warn-all, --strict] +- id: rapids-dependency-file-generator + name: RAPIDS dependency file generator + description: Update dependency files according to the RAPIDS dependencies spec + entry: rapids-dependency-file-generator + language: python + files: "dependencies.yaml" + pass_filenames: false + args: [--warn-all, --strict] diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 00000000..ba2cbe16 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,37 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +extends: default + +rules: + anchors: + forbid-undeclared-aliases: true + forbid-duplicated-anchors: true + forbid-unused-anchors: true + braces: + forbid: false + min-spaces-inside: 0 + # allow 1 space for jinja templating in conda recipes + max-spaces-inside: 1 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + brackets: enable + colons: + max-spaces-before: 0 + max-spaces-after: 1 + commas: + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + comments: disable + comments-indentation: disable + document-end: disable + document-start: disable + key-duplicates: + forbid-duplicated-merge-keys: true + line-length: disable + truthy: + allowed-values: ['false', 'true'] + # having problematic value in keys is rare... and also + # GitHub Actions' choie of 'on:' triggers this check + # ref: https://github.com/adrienverge/yamllint/issues/430 + check-keys: false diff --git a/tests/examples/overlapping-deps/dependencies.yaml b/tests/examples/overlapping-deps/dependencies.yaml index 460b5a6d..7a8eab04 100644 --- a/tests/examples/overlapping-deps/dependencies.yaml +++ b/tests/examples/overlapping-deps/dependencies.yaml @@ -44,7 +44,7 @@ dependencies: packages: - pip - pip: - - numpy>=2.0 + - numpy>=2.0 depends_on_pandas: common: - output_types: [conda, requirements, pyproject] @@ -67,9 +67,9 @@ dependencies: # intentional overlap (numpy) with depends_on_numpy's pip list, to # test that pip dependencies don't have duplicates - pip: - # intentionally not in alphabetical order - - numpy>=2.0 - - folium + # intentionally not in alphabetical order + - numpy>=2.0 + - folium rapids_build_skbuild: common: - output_types: [conda, requirements, pyproject] diff --git a/tests/examples/requirements-pip-dict/dependencies.yaml b/tests/examples/requirements-pip-dict/dependencies.yaml index 2a1bee8e..b24230b9 100644 --- a/tests/examples/requirements-pip-dict/dependencies.yaml +++ b/tests/examples/requirements-pip-dict/dependencies.yaml @@ -11,4 +11,4 @@ dependencies: packages: - fsspec>=0.6.0 - pip: - - pandas<1.0 + - pandas<1.0