diff --git a/README.md b/README.md index f05fd80759656cdaed2a26cbf4d9c5e9c3279766..17d6a9ca7cf3c2cd8b7ff34a1b7e50e8ecb9c67f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,47 @@ # pyyaml-loaders + +[PyPI package page](https://pypi.org/project/pyyaml-loaders/). + PyYAML loaders with enhanced functionalities. + + +## Description + +### `IgnoreLoader` + +Ignore all constructors with tag `!`. Load YAML file as is. + + +### `IncludeLoader` + +Tag: `!include` + +Include values from other fields in the same YAML file, or from other file, while potentially replacing a subfield in the included field with a given value. + +Syntax: +```yaml +!include [OTHER_FILE#]FIELD_TO_INCLUDE [SUBFIELD_TO_REPLACE:VALUE_TO_REPLACE_WITH] +``` + + +## Installation + +```bash +pip install pyyaml-loaders +``` + + +## Usage + +In preamble: + +```python +from pyyaml_loaders import IncludeLoader, IgnoreLoader +``` + +When loading YAML file: +```python +with open(yaml_file, "r") as f: + data = yaml.load(f, IncludeLoader) +``` +(or `IgnoreLoader` instead of `IncludeLoader`)