Skip to main content

Pure-Python implementation of the go-cty type system with strong validation, serialization, and Terraform interoperability

Project description

🌊🪢 Pyvider CTY

License Python 3.11+ uv Ruff CI

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.

✨ Key Features

  • 🎯 Complete Type System - Full implementation of go-cty primitives, collections, and structural types
  • 🔄 Cross-Language Compatibility - JSON/MessagePack serialization for Go interoperability
  • Type-Safe Validation - Strong validation with detailed error messages
  • 🏷️ Marks System - Attach metadata to values without modification
  • 🧭 Path Navigation - Type-safe access to nested data structures
  • 📚 Standard Library - Comprehensive collection of type functions

Quick Start

Note: pyvider-cty is in pre-release (v0.x.x). APIs and features may change before 1.0 release.

  1. Install: uv add pyvider-cty
  2. Follow the Getting Started guide.
  3. See the Quick Example below.

Documentation

Comprehensive documentation is available in the docs/ directory:

Or start with the documentation index.

Development

Quick Start

# 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.

Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

License

Apache License 2.0. See LICENSE for details.

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

Known Limitations

  • Python 3.11+ Required: Due to modern type features and syntax used.
  • Performance: The library is not optimized for performance-critical applications involving very large or deeply nested data structures. Performance is reasonable for typical use cases.

Copyright (c) provide.io LLC.

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.3.31.post2.tar.gz (66.8 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.3.31.post2-py3-none-any.whl (89.0 kB view details)

Uploaded Python 3

File details

Details for the file pyvider_cty-0.3.31.post2.tar.gz.

File metadata

  • Download URL: pyvider_cty-0.3.31.post2.tar.gz
  • Upload date:
  • Size: 66.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyvider_cty-0.3.31.post2.tar.gz
Algorithm Hash digest
SHA256 adef2a44671dc542f6114509e4a0c243f17b01c6c0335cff4dadbf9717d20629
MD5 d7a8582e696b21651af6f34d787b4ae2
BLAKE2b-256 f3be865b3be3fd0e55be452b8ee482a5210ccbaa723e6460a2e846c8d368d681

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvider_cty-0.3.31.post2.tar.gz:

Publisher: release.yml on provide-io/pyvider-cty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvider_cty-0.3.31.post2-py3-none-any.whl.

File metadata

File hashes

Hashes for pyvider_cty-0.3.31.post2-py3-none-any.whl
Algorithm Hash digest
SHA256 9ae6d9f1d408f38f07fc5a13d02d09435a1e5599347324d27f81bc0b5f265cac
MD5 519ab8dd0112fb2c06f94ab3c5b449cd
BLAKE2b-256 f2dc4a22c597322905cc8167cfeb08d225162d98c20c6d2898e3390b14aff43b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvider_cty-0.3.31.post2-py3-none-any.whl:

Publisher: release.yml on provide-io/pyvider-cty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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