Registry / devops / guardpycfn

guardpycfn

JSON →
library0.1.0pypypi✓ verified 80d ago

Python bindings for AWS CloudFormation Guard (cfn-guard) via pyo3. Allows programmatic validation of CloudFormation templates against custom policies. Current version: 0.1.0. Release cadence: early stage, low frequency.

pip install guardpycfn
INSTALL
IMPORT
SIG · GUARDPYCFN
G
guardpycfn
devopspythonv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

guardpycfn
import guardpycfn
from guardpycfn import Guard
validate_with_guard
from guardpycfn import validate_with_guard
from guardpycfn import Guard

Validate a CloudFormation template against a rule set.

from guardpycfn import Guard import json template = json.dumps({ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "Bucket": { "Type": "AWS::S3::Bucket", "Properties": { "BucketName": "my-bucket" } } } }) rules = """ let require_encryption = %{ Resources.* == { Type: /AWS::S3::Bucket/ Properties.BucketEncryption exists } } rule require_encryption when %require_encryption """ guard = Guard() result = guard.validate(template, rules) print(result)
Debug
Known issues
gotchaTemplate must be valid JSON string (not dict).
fix
Always json.dumps(template) before passing to guard.validate().
affects: all
gotchaRules must be provided as string; guard.validate() does not accept file paths.
fix
Read rule file content first: with open('rules.guard') as f: rules = f.read()
affects: all
deprecatedThe validate_file() method is deprecated in favor of validate() with string inputs.
fix
Use guard.validate(template_string, rules_string) instead.
affects: 0.1.0
Upgrade
Version history
0.1.0latest on PyPI · released Oct 15, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources

No resource links recorded.