Pure-Python implementation of the go-cty type system with strong validation, serialization, and Terraform interoperability
Project description
pyvider.cty
PREVIEW RELEASE
This is a preview release of pyvider.cty. While the core functionality is complete and well-tested, this release is intended for early adopters and feedback gathering. Please report any issues or suggestions.
Overview
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.
Installation
uv add pyvider-cty
Quick Example
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
Documentation
Comprehensive documentation is available in the docs/ directory:
- Getting Started - Quick start and installation guide
- User Guide - Complete guide to all features
- How-To Guides - Practical task-oriented guides
- API Reference - Complete API documentation
Or start with the documentation index.
Known Limitations
- Python 3.11+ Required: Due to modern type features and syntax used.
- Performance: The library is not yet optimized for performance-critical applications involving very large or deeply nested data structures. Performance is reasonable for typical use cases.
Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
License
Apache License 2.0. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyvider_cty-0.0.1111.tar.gz.
File metadata
- Download URL: pyvider_cty-0.0.1111.tar.gz
- Upload date:
- Size: 66.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51fc9e919a4cc1dbe18b213b2cc003e7c06268df8b38385339ea7ad888f0e9ab
|
|
| MD5 |
51ecf7c7a3a774ee2f448aab44d4dc37
|
|
| BLAKE2b-256 |
9c84e694036677072b71361545b2fa4b12e65bdc2403d64df7074472106a06b2
|
File details
Details for the file pyvider_cty-0.0.1111-py3-none-any.whl.
File metadata
- Download URL: pyvider_cty-0.0.1111-py3-none-any.whl
- Upload date:
- Size: 90.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd6ff2045343fd4e77b44000cbcda98239bace6c061a56a395b07cb56d5a5cbf
|
|
| MD5 |
40eb26f38fd66345f26a21b37b3ee8ac
|
|
| BLAKE2b-256 |
27f86b4ad64e46f2f381c2e2bd7c77bcd5b1d87e2546d2e5369c2746fde135ee
|