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.1100.tar.gz (64.6 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.1100-py3-none-any.whl (89.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyvider_cty-0.0.1100.tar.gz
Algorithm Hash digest
SHA256 133542639b75d01e22d15440d4737b186f4faa34d8cc740834f63d3e00fd54b3
MD5 6dce3167daf2005e0fea01a954b3ac0c
BLAKE2b-256 f72528462edd06ed0b492e974ffcc087720129117d3cb6ee38474ca49b5f9bfd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyvider_cty-0.0.1100-py3-none-any.whl
Algorithm Hash digest
SHA256 fde884eebd9a93d6ad4636e5ee8477ceb7b11fc77b694b6887e8dd361101c1dd
MD5 6fbd1a27434b3cf3766371e404028fae
BLAKE2b-256 5cb9cbbbf9527de4d250cf9f464705c4705e467454688de513f38860a892e04e

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