Skip to main content

yamlguard

CI PyPI License: MIT

Check your YAML files before you commit or deploy them. yamlguard catches syntax errors and style issues, and can scan supported infrastructure files for security problems with Checkov.

Install the yamlguard CLI from PyPI, or use the Docker image pooyanazad/yamlguard. Both run the same validator; Docker includes Checkov.

Install and run

Python

Requires Python 3.9 or newer. Create a virtual environment so the installation stays separate from your system Python.

Linux / macOS:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install yamlguard

Windows — Command Prompt:

py -m venv .venv
.venv\Scripts\activate
python -m pip install yamlguard

In PowerShell, activate the environment with .\.venv\Scripts\Activate.ps1 instead.

Then check a file:

yamlguard config.yaml

The base installation checks syntax with PyYAML and style with yamllint. To add security scanning, install the optional extra in the same environment:

python -m pip install "yamlguard[security]"
yamlguard deployment.yaml

Checkov checks supported infrastructure formats, such as Kubernetes manifests. Without Checkov, syntax and style checks still run, with a warning that security scanning was skipped.

Docker

With Docker installed, open a terminal in the folder containing your YAML files and run the command for your shell. On Windows, use Docker Desktop with Linux containers.

Linux / macOS:

docker run --rm -v "$(pwd):/data:ro" pooyanazad/yamlguard:latest config.yaml

Windows — PowerShell:

docker run --rm -v "${PWD}:/data:ro" pooyanazad/yamlguard:latest config.yaml

Windows — Command Prompt:

docker run --rm -v "%cd%:/data:ro" pooyanazad/yamlguard:latest config.yaml

These commands mount your current folder read-only at /data. Use paths within that folder, such as config.yaml or ./configs/. Files must be readable by the container's non-root user.

Images support linux/amd64 and linux/arm64. The examples use latest, which follows new publications and scheduled rebuilds. For reproducible CI runs, replace :latest with the versioned tag shown under Latest release.

Everyday examples

yamlguard config.yaml                        # Check one file
yamlguard config.yaml deployment.yml         # Check several files
yamlguard ./configs/                         # Check all .yaml and .yml files recursively
yamlguard "./configs/**/*.yaml"              # Let yamlguard expand the pattern
yamlguard ./configs/ --no-security            # Run syntax and style checks only
yamlguard deployment.yaml --timeout 60       # Limit each validator subprocess to 60 seconds

With Docker, pass these same arguments after the image name. For example, replace config.yaml in the Docker command with ./configs/ --no-security.

Run yamlguard --help for all options. You can also run the CLI as python -m yamlguard. Missing paths are skipped with a warning; the command fails if no files remain.

Reports and exit codes

Text output is the default. For CI or other tools, export a report:

yamlguard ./configs/ --format json > results.json
yamlguard ./configs/ --format junit > test-results.xml
yamlguard ./configs/ --format sarif > results.sarif

JSON returns one object for one file or an array for several files. JUnit XML works with test-report viewers; SARIF 2.1.0 works with compatible code-scanning tools. Upload reports through your CI configuration.

In version 3.5.0 and newer, machine-readable reports go to stdout and warnings go to stderr.

Exit code Meaning
0 No findings, or only Medium / Low / Info findings.
1 Critical / High findings, a validator failure, no matching files, or a required dependency is missing.
2 Invalid command-line arguments.

Syntax errors are Critical. Lint errors are Medium and warnings are Low, so lint findings alone do not fail the command. Checkov findings without a severity default to High.

  • Empty, comment-only, and explicit null documents are syntactically valid (syntax_valid: true in JSON) and emit an Info notice without failing the command.
  • Readable files with syntax errors still run yamllint (and Checkov when enabled) so you retain lint feedback alongside the syntax error.
  • Unreadable, non-UTF-8, and binary files are Critical validation failures (syntax_valid: false, exit 1) and skip downstream yamllint and Checkov scans. (Behavior change: earlier versions reported binary files as a non-failing Medium warning.)

Releases · Report an issue · Contributing · Maintainer release guide

Latest release

v3.5.2-20261123 — 2026-11-23

Changes since v3.5.1-20261011 (32 non-merge commits).

  • --no-security skips Checkov startup and scanning. Syntax and yamllint checks still run.
  • Python callers can set ToolAvailability(yamllint=False) to skip linting and see that skip in the validation result.
  • Validation reports show which tools completed, skipped, or failed. When yamllint or Checkov fails to produce usable results, the CLI exits with an error.
  • Empty, comment-only, and null-only documents remain syntactically valid. Unreadable, undecodable, and binary inputs fail validation and skip downstream checks.
  • YAML file discovery skips symbolic links.

Full changelog

Docker image: pooyanazad/yamlguard:v3.5.2-20261123

Metadata

Release files for yamlguard 3.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yamlguard 3.5.2
File Size Uploaded Provenance Actions
yamlguard-3.5.2.tar.gz 173.2 kB With provenance Details for yamlguard-3.5.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yamlguard 3.5.2
File Interpreter ABI Platform Actions
yamlguard-3.5.2-py3-none-any.whl Python 3 none any Details for yamlguard-3.5.2-py3-none-any.whl

Total release size: 196.8 kB

Release files / yamlguard-3.5.2.tar.gz

Download URL yamlguard-3.5.2.tar.gz
Size 173.2 kB
Tags Source
SHA-256 checksum
How to use checksums
16ec4d2e207a183af9cb614474b7cf63cc981fb9b15d9a57c17bab9eae1fa53b
BLAKE2b-256 checksum
How to use checksums
bc7a191b8a515838ca2432032208a88d0e77dda72f09e652cfcaa8a6ff806f04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / yamlguard-3.5.2-py3-none-any.whl

Download URL yamlguard-3.5.2-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
879b68b35562546c5b1e02cb028366797bbf8ccbf10b72b72e3bc70edfa436f5
BLAKE2b-256 checksum
How to use checksums
b669083af2027320818327412cf723c3413cc2d413fabb081db6b12e1631d3b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for yamlguard 3.5.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for yamlguard-3.5.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page