Skip to main content

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

Project description

yaml_oop

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

Requirements

Python 3.8 or later pyyaml 6.0.2

Features

YAML in-line keywords that enable inheritance and variables from other files. Ultimately, this allows YAML files to be fully modular through in-line modifications of the YAML file.

Inheritance:

Files can be nested within elements of YAML files and apply composition and inheritance logic to concatenante elements. Inheritance logic applies to matching keys within the tree node and to multiple (nested) layers of YAML file inheritance. Multiple inheritance, overriding, and keywords such as sealed, abstract, private is supported.

Variables:

Variables can be injected into YAML files during inheritance or Python code to modify scalar values. Variables allow scalars to represent other scalars, lists, dicts, or dynamic inheritance paths. Variables can also operate on in-line keywords for additional customization.

Supported Keywords:

Multiple keywords can be assigned a single key or sequence element.

(base_config): Specifies file path(s) to inherit elements from base YAML file(s). (variables): Specifies scalar values to replace. Can be injected into root YAML file or (base_config) YAML files or declared in-line and apply to child elements. (override): Overrides values of base YAML files for matching keys. (append) (prepend): Concatenates sequences with a matching parent key. (merge): Applies inheritance rules to sequence items of the same indicies. (abstract) (sealed) (private): To enforce override, prevent override, and hide keys, sequence elements, and variables from inheritance respecitvely. (optional): Deletes keys or sequence elements if variables do not replace values. (carryover): Allows variables to be pass through muliple layers of inheritance.

Installation

pip install yaml_oop

Usage

import yaml
from yaml_oop import oopify

output_yaml = oopify(file_path=input_yaml_path, directory=input_yaml_directory, Loader=yaml.SafeLoader, variables=variables)

Project Structure

yaml_oop/
├── yaml_oop/
│   ├── __init__.py
│   └── yaml_object.py
├── tests/
│   └── test_yaml_object.py
├── example.yaml
├── README.md
└── requirements.txt

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_oop-0.0.9.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

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

yaml_oop-0.0.9-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file yaml_oop-0.0.9.tar.gz.

File metadata

  • Download URL: yaml_oop-0.0.9.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yaml_oop-0.0.9.tar.gz
Algorithm Hash digest
SHA256 73dbf5a05673b2dd1892980bbb35e85e2582dbc8c43df8e3fab2ea891b0fbf3d
MD5 9239641bf8a059f8eda76dbd831d05f6
BLAKE2b-256 e4621474ccdd74bb604b2a288a1147e55486db3b61a01318126dae47fa477a6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for yaml_oop-0.0.9.tar.gz:

Publisher: python-app.yaml on eshen2210/yaml_oop

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_oop-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: yaml_oop-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yaml_oop-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 6666d28fbb65dfc07f104f08d9b19c5f22e2c24a0f18a4ef7ce7db143aae59cb
MD5 9ce1d82d25141a9c2113c653d7e24c34
BLAKE2b-256 1225fbdea66a01e82ad94df0eba19033884b318ac14caefd12a483fd24bce6f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for yaml_oop-0.0.9-py3-none-any.whl:

Publisher: python-app.yaml on eshen2210/yaml_oop

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