Skip to main content

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:

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyvider_cty-0.0.1026.tar.gz (65.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyvider_cty-0.0.1026-py3-none-any.whl (88.9 kB view details)

Uploaded Python 3

File details

Details for the file pyvider_cty-0.0.1026.tar.gz.

File metadata

  • Download URL: pyvider_cty-0.0.1026.tar.gz
  • Upload date:
  • Size: 65.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for pyvider_cty-0.0.1026.tar.gz
Algorithm Hash digest
SHA256 9c0fe2a4041a3e9680c8293f52ab59de892cb246e406207114346357e7c2f090
MD5 dcba36cb599162620d26bbc1e2dc621e
BLAKE2b-256 7eba36c4631aa02c7286868a7f77e69eb034bf89abcf8488ef9d1886210cf05e

See more details on using hashes here.

File details

Details for the file pyvider_cty-0.0.1026-py3-none-any.whl.

File metadata

File hashes

Hashes for pyvider_cty-0.0.1026-py3-none-any.whl
Algorithm Hash digest
SHA256 322d63dbcd7c80f2c65a31685e6e10b9eecd1127e9f384f7a0f45f6d7dd2b9f9
MD5 b8ed98961c649ab280ad1be6860f4dca
BLAKE2b-256 d2cae5be3ef61f9bbde1a33ecc9a0948b1610b6dd76e068016dbb419239d82a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page