Skip to main content

A Python library that enables features such as inheritance, variables, and instantiation in YAML files.

Project description

yaml_quilt

A Python library that enables inheritance, variables, and instantiation in YAML files via inline declarations.

Installation

pip install yaml_quilt

Overview

YamlQuilt is a Python library that allows templating of YAML files using inline declarations and depth-first search (DFS) traversal. This is accomplished through three key features: Variables, File Inheritance, and Declarative Rules. These declaration rules include inheritance rules such as abstract, sealed, private, etc and variable replacement rules such as default, optional, global, etc. The DFS approach allows declarative rules to persist to child elements, even across inherited files.

YamlQuilt aims for yaml readability by avoiding {{ Helm-style }} templating and in-line programming logic. YamlQuilt's in-line declarations use a minimal format that always places declaration in the beginning of an element. YamlQuilt eliminates templating logic in Python and and calls YAML files the same way you would pyyaml's load():

import yaml
from yaml_quilt import stitch, YamlQuiltException

# Define variables in Python code
injected_variables = {
    "<var1>": "value1"
}

# Process YAML with injected variables
try:
  result = stitch(
      file_path="root_config.yaml",
      directory="/path/to/config",
      Loader=yaml.SafeLoader,
      variables=injected_variables
  )
except YamlQuiltException as e:
   print(f"Error: {e}")

Processing behavior is defined within the Yaml file via in-line declarations.

# config.yaml
(patch): config_path/patch.yaml
(override) base_key1: <variable1>
---
# patch.yaml
(abstract) base_key1:
base_key2: value2
---
# yaml_quilt output
base_key1: value1
base_key2: value2

Documentation

Full documentation is available at https://eshen2210.github.io/yaml_quilt/.

License

MIT License

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

yaml_quilt-0.1.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

yaml_quilt-0.1.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file yaml_quilt-0.1.0.tar.gz.

File metadata

  • Download URL: yaml_quilt-0.1.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yaml_quilt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 65f7e67d69c4e23f7c2b5caaeb8c9f3bc8d6cf28bccc45284a6fce666c770ee1
MD5 bb85e37ff015265ec76acd836c003f86
BLAKE2b-256 a4fb1c79fd661a8f3bea5967b6f0925f31dbc287fea7b8c4f183259a907d42cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for yaml_quilt-0.1.0.tar.gz:

Publisher: python-app.yaml on eshen2210/yaml_quilt

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

File details

Details for the file yaml_quilt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: yaml_quilt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yaml_quilt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98d74f19b52df90f9d81e9dd7b00db063e0cfc47001ca36b55918e8b59fb5f8c
MD5 aeeec7cd412c36d7177495823845417f
BLAKE2b-256 26d8623e5511d278b1fc9bab9d69b2a6927a1575a8b42b858de2ec9463627505

See more details on using hashes here.

Provenance

The following attestation bundles were made for yaml_quilt-0.1.0-py3-none-any.whl:

Publisher: python-app.yaml on eshen2210/yaml_quilt

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