Pure-Python implementation of the go-cty type system for Terraform tooling
pyvider.cty provides strong type validation and serialization capabilities for configuration data, designed to work seamlessly with Terraform providers and HashiCorp ecosystem tools.
Note: pyvider-cty is in pre-release (v0.x.x). APIs and features may change before 1.0 release.
uv add pyvider-ctyComprehensive documentation is available in the docs/ directory:
Or start with the documentation index.
# Set up environment
uv sync
# Run common tasks
we run test # Run tests
we run lint # Check code
we run format # Format code
we tasks # See all available commands
See CLAUDE.md for detailed development instructions and architecture information.
We welcome contributions! Please see our Contributing Guidelines for details.
Apache License 2.0. See LICENSE for details.
pyvider.cty is a pure-Python implementation of the go-cty type system, providing strong type validation and serialization capabilities for configuration data. It’s designed to work seamlessly with Terraform providers and other HashiCorp ecosystem tools.
Key Features: Complete type system, cross-language compatibility via MessagePack, type-safe validation, marks system, path navigation, and comprehensive standard library.
uv add pyvider-cty
from pyvider.cty import CtyObject, CtyString, CtyNumber, CtyList
# Define a type schema
user_type = CtyObject(
attribute_types={
"name": CtyString(),
"age": CtyNumber(),
"hobbies": CtyList(element_type=CtyString()),
},
optional_attributes={"age"},
)
# Validate data
user_data = {"name": "Alice", "hobbies": ["reading", "hiking"]}
user_val = user_type.validate(user_data)
# Access validated data
print(f"Name: {user_val['name'].raw_value}") # Output: Alice
Copyright © provide.io LLC.