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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yaml_oop-0.0.12.tar.gz.
File metadata
- Download URL: yaml_oop-0.0.12.tar.gz
- Upload date:
- Size: 22.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f51d100a08e14e646b9d169bb7d0e0592ddd5e314331b9c91bc4b7aecd00b2c7
|
|
| MD5 |
2993c6149fd6b4166d16bcbe5a78538f
|
|
| BLAKE2b-256 |
83a99f1bb23e6e45cde40fc04b406b03b0e8ab35933c7161b35159f3934aae5b
|
Provenance
The following attestation bundles were made for yaml_oop-0.0.12.tar.gz:
Publisher:
python-app.yaml on eshen2210/yaml_oop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yaml_oop-0.0.12.tar.gz -
Subject digest:
f51d100a08e14e646b9d169bb7d0e0592ddd5e314331b9c91bc4b7aecd00b2c7 - Sigstore transparency entry: 630269735
- Sigstore integration time:
-
Permalink:
eshen2210/yaml_oop@1bc59b141957f9c79ad038f66f701881db4db1cb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eshen2210
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-app.yaml@1bc59b141957f9c79ad038f66f701881db4db1cb -
Trigger Event:
push
-
Statement type:
File details
Details for the file yaml_oop-0.0.12-py3-none-any.whl.
File metadata
- Download URL: yaml_oop-0.0.12-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e69b5ea56b93244538f66709f03f0d8c49f50d127de625bbcee4e4384b117d0d
|
|
| MD5 |
404c158d2e0c499c1412b8ec0aaa56ba
|
|
| BLAKE2b-256 |
8571ac49a725ad1fe5d84c8d1d8692e34de5deae9001156d42365fd35611230d
|
Provenance
The following attestation bundles were made for yaml_oop-0.0.12-py3-none-any.whl:
Publisher:
python-app.yaml on eshen2210/yaml_oop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yaml_oop-0.0.12-py3-none-any.whl -
Subject digest:
e69b5ea56b93244538f66709f03f0d8c49f50d127de625bbcee4e4384b117d0d - Sigstore transparency entry: 630269737
- Sigstore integration time:
-
Permalink:
eshen2210/yaml_oop@1bc59b141957f9c79ad038f66f701881db4db1cb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eshen2210
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-app.yaml@1bc59b141957f9c79ad038f66f701881db4db1cb -
Trigger Event:
push
-
Statement type: