mrkeyoor.com_
Mon 21 Sept 21:58 UTC
PyPIUtilsupdated 20 Sept 2026

yamllint review

yamllint checks YAML text for parser errors, duplicate keys, indentation, trailing spaces, line length, quoting, truth-like values, and other source conventions. It reports every configured problem with its file, line, column, severity, and rule ID through a CLI or Python iterator. It does not know Kubernetes kinds, GitHub Actions fields, or an application's schema. Version 1.38.0 adds Python 3.14, removes Python 3.9, changes `yaml-files` and `ignore` to follow gitignore behavior, and adds `quote-type: consistent` to the quoted-strings rule.

Verdict

yamllint 1.38.0 installed in 0.5 seconds, used 4 MB across 3 packages, and returned 0 audit findings in our sandbox. Add it for YAML syntax and source-policy checks, then pair it with a domain validator when fields and value types matter.

We installed it

Lab card: what happened when we installed yamllintScreenshot of yamllint documentation
Install✓ · 0.5s3 packages on disk · 4 MB
Importimport yamllint in 0.02s · pure Python · requires Python >=3.10
Known vulns0(pip-audit)

Answers from our run

Does yamllint install cleanly?

Yes. In a fresh container with an empty cache, pip install yamllint finished in 0.5s, leaving 3 packages and 4 MB on disk. pip-audit reported no known vulnerabilities.

What does yamllint need to run?

Python >=3.10, and nothing compiled: it is pure Python. In our run import yamllint succeeded in 0.02s.

yamllint or strictyaml: which should you use?

strictyaml: Choose it when Python should parse a deliberately restricted YAML subset and validate values against an application schema. yamllint 1.38.0 installed in 0.5 seconds, used 4 MB across 3 packages, and returned 0 audit findings in our sandbox.

When should you not use yamllint?

The goal is validating Kubernetes, OpenAPI, GitHub Actions, or application fields. yamllint checks YAML syntax and presentation, not a domain schema.

API stability4/5The command shape, default and relaxed presets, rule map, inline directives, and `linter.run()` iterator have stayed recognizable. File selection has changed before: 1.35.0 altered filtering and 1.35.1 reverted that API behavior. Version 1.38.0 changes path matching to follow gitignore rules, so an upgrade should include `--list-files` output alongside ordinary lint fixtures.
Docs5/5The official manual explains config discovery, every rule and option, default values, inline disable syntax, whole-file and per-rule ignores, file selection, output formats, editor connections, pre-commit, GitHub and GitLab examples, and the Python API. Examples make warning levels and custom policy readable. The main conceptual omission is a prominent warning that syntax and style linting cannot validate Kubernetes or another domain schema.
Maintenance5/5Version 1.38.0 was released on January 13, 2026, and GitHub records a push on August 19. The project is unarchived, has 3,448 stars, and shows 166 open issues and pull requests in the combined counter. The current release adds Python 3.14, drops Python 3.9, adopts pathspec 1 or newer, improves config diagnostics, fixes indentation messages, and adds consistent quote selection. Its pace suits a mature linter.
Ecosystem4/5The supplied package count is 8,442,877 downloads per week. yamllint is available from PyPI and operating-system package managers and integrates with pre-commit, editors, GitHub annotations, GitLab, and generic parsable output. One config can follow a repository through those tools. Its deliberate limit is YAML text, so Kubernetes manifests, workflows, and custom config formats still need a second checker for schema and semantics.

Use it if

  • People edit YAML in the repository and CI should catch duplicate keys, invalid indentation, and stray whitespace.
  • One `.yamllint` file should drive local commands, pre-commit, editor integrations, and CI annotations.
  • Style preferences should remain warnings while syntax and selected mistakes block the build.
  • A Python program needs structured lint problems for YAML text without loading application objects.
Skip it if

Setup reality

We installed yamllint 1.38.0 in a clean Python 3.12 Bookworm sandbox. The operation finished in 0.5 seconds, left 3 packages, and occupied 4 MB. The package declares 8 direct dependencies, requires Python 3.10 or newer, and is pure Python. import yamllint completed in 0.02 seconds, and pip-audit found 0 known vulnerabilities. There is no py.typed marker. Our package probe did not identify a license, although current PyPI metadata says GPL-3.0-or-later.

Without -c, yamllint searches for .yamllint, .yamllint.yaml, or .yamllint.yml, including parent directories. Begin with extends: default or extends: relaxed, then record intentional changes. GitHub Actions needs a decision around the truthy rule because on is a workflow key but resembles a YAML 1.1 boolean. Narrow that exception; disabling a whole workflow hides unrelated duplicate-key and whitespace findings.

CI exit behavior is easy to misread. Normal mode returns failure for errors and permits warnings. --strict also fails on warnings, while --no-warnings suppresses them. Parsable and GitHub annotation formats support automated consumers. Run --list-files before trusting a green job, particularly after upgrading to 1.38.0, because its gitignore-compatible matching changed which paths yaml-files and ignore select.

Inline directives can disable one line, a block, a file, or named rules. They help with a certificate or unavoidable long URL, but each directive creates a lasting blind spot. Put generated and vendored trees in top-level ignores. Prefer a per-rule ignore if only quoting or line length is unsuitable. After yamllint, run the relevant schema validator whenever an unknown field or wrong value type can break deployment.

Patterns

Check named files or a directory lint-files-and-tree

yamllint deploy.yaml .github/workflows/ci.yml
yamllint .
printf '%s\n' 'name: value' | yamllint -

Directory scans obey yaml-files and ignore patterns. Use --list-files to inspect the selected set.

Create a project configuration define-repository-policy

# .yamllint
---
extends: default
rules:
  document-start: disable
  line-length:
    max: 120
    level: warning
  indentation:
    spaces: 2
    indent-sequences: consistent

Keep a style dispute at warning level when it should remain visible without blocking deployment.

Handle the GitHub Actions `on` key allow-actions-on-key

# .yamllint
---
extends: default
rules:
  truthy:
    check-keys: false

This disables truthy checks for every mapping key, not only `on`; truthy values remain checked.

Set CI warning behavior choose-warning-exit-code

yamllint .                 # only errors fail
yamllint --strict .        # warnings fail too
yamllint --no-warnings .   # warnings are omitted

--strict promotes warnings into a failing status, while --no-warnings hides them.

Annotate a GitHub workflow emit-github-annotations

- name: Lint YAML
  run: |
    pip install yamllint==1.38.0
    yamllint --format github --strict .

Pin the CLI so path-selection or rule changes arrive through a reviewed dependency update.

Ignore generated and vendored paths exclude-generated-yaml

# .yamllint
---
extends: default
ignore: |
  /vendor/
  /charts/**/templates/
  *.generated.yaml
  !/charts/values.yaml

Version 1.38.0 follows gitignore matching here. Confirm negations and anchored directories with --list-files.

Relax only line length in docs ignore-rule-for-path

# .yamllint
---
extends: default
rules:
  line-length:
    max: 100
    ignore: |
      /docs/

A rule-level ignore retains parsing, duplicate-key, indentation, and whitespace checks for the same files.

Suppress one named rule disable-specific-finding

url: https://example.com/a/very/long/path  # yamllint disable-line rule:line-length

# yamllint disable rule:comments
legacy: value#fixture
# yamllint enable

Name the rule so other problems on that line or block still appear.

Lint staged YAML run-pre-commit-hook

repos:
  - repo: https://github.com/adrienverge/yamllint
    rev: v1.38.0
    hooks:
      - id: yamllint
        args: [--strict, -c, .yamllint]

The hook checks selected staged files; keep a full-tree CI command for tracked files outside that selection.

Read problems through the Python API collect-python-findings

from yamllint import linter
from yamllint.config import YamlLintConfig

config = YamlLintConfig(file='.yamllint')
with open('deploy.yaml') as stream:
    for problem in linter.run(stream, config, filepath='deploy.yaml'):
        print(problem.line, problem.column, problem.level, problem.rule)

Pass filepath so path-based ignore policy and diagnostic names work with the opened stream.

Choose one quote style per file enforce-consistent-quotes

# .yamllint
---
extends: default
rules:
  quoted-strings:
    quote-type: consistent
    required: only-when-needed

quote-type: consistent was added in 1.38.0 and can be noisy on generated or templated YAML.

Audit lint coverage list-selected-files

yamllint --list-files . | sort

Review this list after ignore or yaml-files changes; a green scan says little if intended manifests were never selected.

Alternatives

PackageRegistryPick it when
strictyamlPyPIChoose it when Python should parse a deliberately restricted YAML subset and validate values against an application schema.
yamalePyPIChoose it when YAML documents need declarative type and field validation after parsing.
ruyamlPyPIChoose it when Python must parse and round-trip YAML while preserving comments, rather than linting repository style.

More utils guides

lru-cache · ajv · type-fest · p-limit · find-up · js-yaml · the whole shelf →

How this guide is made: grounded in the library's documentation, release notes, changelog, and issue history, on a fixed rubric — not a hands-on install of every release. The 50 most-downloaded entries are additionally install-verified in clean containers. Corrections: contact the desk.