{"id":1041,"library":"yamllint","title":"yamllint","description":"yamllint is a linter for YAML files written in Python, version 1.38.0. It checks not only for syntax validity but also for common weirdnesses like key repetition and cosmetic issues such as line length, trailing spaces, and indentation. The project is actively maintained with regular releases.","status":"active","version":"1.38.0","language":"python","source_language":"en","source_url":"https://github.com/adrienverge/yamllint","tags":["YAML","lint","linter","syntax-checker","code-quality"],"install":[{"cmd":"pip install yamllint","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Core dependency for YAML parsing.","package":"pyyaml","optional":false},{"reason":"Used for `.gitignore`-style path matching in configuration. Requires `>=1.0.0` since yamllint 1.38.0.","package":"pathspec","optional":false}],"imports":[{"symbol":"YamlLintConfig","correct":"from yamllint.config import YamlLintConfig"},{"symbol":"linter","correct":"from yamllint import linter"},{"note":"Represents a detected linting issue; returned by `linter.run`.","symbol":"LintProblem","correct":"from yamllint.linter import LintProblem"}],"quickstart":{"code":"import io\nfrom yamllint.config import YamlLintConfig\nfrom yamllint import linter\n\nyaml_content = \"\"\"\nkey: value \nanother_key:   with_trailing_spaces\n  nested: item\n\"\"\"\n\n# Use a default configuration or load a custom one\nconfig_string = \"extends: default\\nrules:\\n  trailing-spaces: enable\\n  indentation: enable\"\nconf = YamlLintConfig(content=config_string)\n\n# Lint the YAML content from a string buffer\nproblems = linter.run(io.StringIO(yaml_content), conf)\n\nfound_issues = []\nfor p in problems:\n    found_issues.append(f\"Line {p.line}, Column {p.column}: {p.desc} (Rule: {p.rule})\")\n\nif found_issues:\n    print(\"YAML linting issues found:\")\n    for issue in found_issues:\n        print(issue)\nelse:\n    print(\"No YAML linting issues found.\")\n","lang":"python","description":"This quickstart demonstrates how to programmatically lint a YAML string using `yamllint`. It creates a `YamlLintConfig` and then uses `linter.run` with an `io.StringIO` object to process the YAML content, iterating over any `LintProblem` objects found."},"warnings":[{"fix":"Upgrade Python to 3.10+ or pin `yamllint` to an older compatible version.","message":"yamllint has progressively dropped support for older Python versions. As of 1.38.0, Python 3.9 is no longer supported, and Python 3.8 was dropped in 1.36.0. Users on older Python environments will need to upgrade their Python version or use an older yamllint version.","severity":"breaking","affected_versions":"<1.38.0 (for Python 3.9+), <1.36.0 (for Python 3.8+)"},{"fix":"Run `yamllint` with the `--strict` (or `-s`) option in CI/CD environments: `yamllint --strict .`","message":"By default, the `yamllint` CLI exits with code 1 only if errors are found, not warnings. This can lead to CI/CD pipelines passing silently even with warnings. To make warnings also cause a non-zero exit code, use the strict mode.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Explicitly specify a configuration file using the `-c` option (`yamllint -c /path/to/myconfig.yaml file.yaml`) or disable automatic config search for specific use cases. Be aware of your project's directory structure for `.yamllint` files.","message":"yamllint automatically discovers and loads configuration files named `.yamllint`, `.yamllint.yaml`, or `.yamllint.yml` in the current working directory or any parent directory. This implicit loading can lead to unexpected linting rules being applied if a configuration file exists upstream that you are unaware of or did not intend to use.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Avoid `yamllint` version 1.35.0 if programmatic file ignoration is critical; upgrade to 1.35.1 or newer, or downgrade to 1.34.x or older.","message":"The API for `linter.run` experienced a change in version 1.35.0 regarding how file ignoration was handled, which was then reverted in 1.35.1. If you programmatically interact with `linter.run` and rely on specific file path handling or ignoration behavior, this version range could introduce unexpected results.","severity":"breaking","affected_versions":"1.35.0"}],"env_vars":null,"last_verified":"2026-05-12T22:57:09.833Z","next_check":"2026-06-27T00:00:00.000Z","problems":[{"fix":"Run yamllint using `python -m yamllint <file.yaml>` or add the pip binaries directory (e.g., `~/.local/bin` on Linux/macOS) to your system's PATH.","cause":"The directory where pip installed the `yamllint` executable is not included in your system's PATH environment variable.","error":"yamllint: command not found"},{"fix":"Review the `.yamllint` file for syntax errors, ensuring it's valid YAML and conforms to the `yamllint` configuration specification.","cause":"The specified `.yamllint` configuration file contains invalid YAML syntax, such as duplicate keys, incorrect indentation, or an unsupported structure.","error":"yamllint: error: Invalid config file: <path/to/.yamllint>"},{"fix":"Run `yamllint --help` to see the list of valid options, or consult the `yamllint` documentation for the correct command-line arguments.","cause":"You are attempting to use a command-line option that does not exist, is misspelled, or is deprecated for your installed `yamllint` version.","error":"yamllint: error: No such option: --<some-option>"},{"fix":"Install the package using pip: `pip install yamllint`.","cause":"The `yamllint` Python package is not installed in the active Python environment where your script or application is attempting to import it.","error":"ModuleNotFoundError: No module named 'yamllint'"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.38.0","cli_name":"yamllint","install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.17,"mem_mb":3.5,"disk_size":"20.8M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.18,"mem_mb":3.5,"disk_size":"20.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.6,"import_time_s":0.11,"mem_mb":3.5,"disk_size":"22M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.12,"mem_mb":3.5,"disk_size":"22M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.37,"mem_mb":4,"disk_size":"23.0M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.44,"mem_mb":4,"disk_size":"23.0M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.7,"import_time_s":0.33,"mem_mb":4,"disk_size":"24M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.32,"mem_mb":4,"disk_size":"24M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.27,"mem_mb":3.9,"disk_size":"14.9M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.3,"mem_mb":3.9,"disk_size":"14.9M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.6,"import_time_s":0.29,"mem_mb":3.9,"disk_size":"16M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.32,"mem_mb":3.9,"disk_size":"16M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.24,"mem_mb":4.2,"disk_size":"14.6M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.27,"mem_mb":4.2,"disk_size":"14.5M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.6,"import_time_s":0.26,"mem_mb":4,"disk_size":"16M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.29,"mem_mb":4,"disk_size":"16M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.14,"mem_mb":3.6,"disk_size":"20.3M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.18,"mem_mb":3.6,"disk_size":"20.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":2.1,"import_time_s":0.15,"mem_mb":3.6,"disk_size":"21M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":3.6,"disk_size":"21M"}]},"quickstart_checks":{"last_tested":"2026-04-24","tag":null,"tag_description":null,"results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}