Metadata-Version: 2.1
Name: phiera
Version: 2.0.14
Summary: a python hiera parser
Home-page: https://github.com/Nike-Inc/phiera
License: Apache 2.0
Author: Andrei Zbikowski, Rob King
Maintainer: Mohamed Abdul Huq Ismail
Maintainer-email: Abdul.Ismail@nike.com
Requires-Python: >=3.7,<4.0
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: PyYAML (>=5.4.1,<6.0.0)
Project-URL: Repository, https://github.com/Nike-Inc/phiera
Description-Content-Type: text/markdown

Phiera
---

[![codecov](https://codecov.io/gh/Nike-Inc/phiera/branch/master/graph/badge.svg?token=J9slc2blRx)](https://codecov.io/gh/Nike-Inc/phiera)
[![Test](https://github.com/Nike-Inc/phiera/actions/workflows/python-test.yaml/badge.svg)](https://github.com/Nike-Inc/phiera/actions/workflows/python-test.yaml)
[![PyPi Release](https://github.com/Nike-Inc/phiera/actions/workflows/python-build.yaml/badge.svg)](https://github.com/Nike-Inc/phiera/actions/workflows/python-build.yaml)
![License](https://img.shields.io/pypi/l/phiera)
![Python Versions](https://img.shields.io/pypi/pyversions/phiera)
![Python Wheel](https://img.shields.io/pypi/wheel/phiera)

Phiera is a fork of [Piera](https://github.com/b1naryth1ef/pierahttps://github.com/b1naryth1ef/piera), a lightweight, pure-Python [Hiera](http://docs.puppetlabs.com/hiera/) parser. Piera was originally built to provide Python tooling access to Puppet/Hiera configurations. The original Piera is currently not feature complete; lacking some less-used interpolation and loading features.

Table of content
* [Why](#why)
* [Installation](#installation)
* [Usage](#usage)
* [Unit Tests](#tests)

# <a name="why"></a> Why?:

Piera/Phiera generalizes Puppet Hiera's hierarchical storage system; making a simple, very flexible, abstracted, and DRY mechanism for managing complex configuration data available to a broad set of tooling and applicable to a broad set of problems.

Phiera builds on the original Piera work, adding:
  
  - Python3 compatibility
  - Support for deep merging
  - Support for configuration as a dict

# <a name="installation"></a> Installation:

### From PyPi:
```shell script
pip install phiera
```

### From GitHub:
```shell script
pip install git+https://github.com/Nike-Inc/phiera#egg=phiera
```


### Manually

```bash
git clone git@github.com/Nike-Inc/phiera.git
cd phiera
python setup.py install
```

# <a name="usage"></a> Usage:

```python
import phiera

h = phiera.Hiera("my_hiera.yaml")

# You can use phiera to simply interact with your structured Hiera data

# key: 'value'
assert h.get("key") == "value"

# key_alias: '%{alias('key')}'
assert h.get("key_alias") == "value"

# key_hiera: 'OHAI %{hiera('key_alias')}'
assert h.get("key_hiera") == "OHAI value"

# Give phiera context
assert h.get("my_context_based_key", name='test01', environment='qa') == "context is great!"
```

# <a name="tests"></a> Unit Tests:

```bash
poetry run pytest --cov-report=html --cov=phiera --cov-fail-under=80 tests/
```

