Skip to main content

hiyapyco

HiYaPyCo - A Hierarchical Yaml Python Config

Description

A simple python lib allowing hierarchical overlay of config files in YAML syntax, offering different merge methods and variable interpolation based on jinja2.

Key Features

  • hierarchical overlay of multiple YAML files

  • multiple merge methods for hierarchical YAML files

  • variable interpolation using jinja2

Requirements

  • PyYAML aka. python-yaml

  • Jinja2 aka. python-jinja2

Python Version

HiYaPyCo was designed to run on both current major python versions without changes. Tested versions:

  • 2.6

  • 2.7

  • 3.2

Usage

A simple example:

import hiyapyco
conf = hiyapyco.load('yamlfile1' [,'yamlfile2' [,'yamlfile3' [...]]] [,kwargs])
print(hiyapyco.dump(conf))

args

All args are handled as file names. They may be strings or list of strings.

kwargs

  • method: bit (one of the listed below):

    • hiyapyco.METHOD_SIMPLE: replace values (except for lists a simple merge is performed) (default method)

    • hiyapyco.METHOD_MERGE: perform a deep merge

  • interpolate: boolean : perform interpolation after the merge (default: False)

  • failonmissingfiles: boolean : fail if a supplied YAML file can not be found (default: True)

  • loglevel: int : loglevel for the hiyapyco logger; should be one of the valid levels from logging: ‘WARN’, ‘ERROR’, ‘DEBUG’, ‘I NFO’, ‘WARNING’, ‘CRITICAL’, ‘NOTSET’ (default: default of logging)

  • loglevelmissingfiles: int : one of the valid levels from logging: ‘WARN’, ‘ERROR’, ‘DEBUG’, ‘INFO’, ‘WARNING’, ‘CRITICAL’, ‘NOTSET’ (default: logging.ERROR if failonmissingfiles = True, else logging.WARN)

interpolation

The default jinja2.Environment for the interpolation is

hiyapyco.jinja2env = Environment(undefined=Undefined)

This means that undefined vars will be ignored and replaced with a empty string. If you like to change the jinja2 Environment used for the interpolation, set hiyapyco.jinja2env before calling hiyapyco.load!

If you like to keep the undefined var as string but raise no error, use

hiyapyco.jinja2env = Environment(undefined=DebugUndefined)

If you like to raise a error on undefined vars, use

hiyapyco.jinja2env = Environment(undefined=StrictUndefined)

See: jinja2.Environment

Install

From Source

GitHub

git clone https://github.com/zerwes/hiyapyco
cd hiyapyco
sudo python setup.py install

PyPi

Download the latest or desired version of the source package from https://pypi.python.org/pypi/HiYaPyCo. Unpack the archive and install by executing:

sudo python setup.py install

pip

Install the latest wheel package using:

pip install HiYaPyCo

debian packages

echo "deb http://repo.zero-sys.net/hiyapyco/deb ./" > /etc/apt/sources.list.d/hiyapyco.list
gpg --keyserver subkeys.pgp.net --recv-key ED7D414C
gpg --armor --export ED7D414C | apt-key add -
apt-get update
apt-get install python3-hiyapyco python-hiyapyco

rpm packages

use http://repo.zero-sys.net/hiyapyco/rpm as URL for the yum repo and http://jwhoisserver.net/key.asc as the URL for the key.

License

  1. 2014 Klaus Zerwes zero-sys.net This package is free software. This software is licensed under the terms of the GNU LESSER GENERAL PUBLIC LICENSE version 3 or later, as published by the Free Software Foundation. See https://www.gnu.org/licenses/lgpl.html

Metadata

Release files for HiYaPyCo 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for HiYaPyCo 0.1.1
File Size Uploaded Provenance Actions
HiYaPyCo-0.1.1.tar.gz 11.5 kB Without provenance Details for HiYaPyCo-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for HiYaPyCo 0.1.1
File Interpreter ABI Platform Actions
HiYaPyCo-0.1.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for HiYaPyCo-0.1.1-py2.py3-none-any.whl

Total release size: 20.2 kB

Release files / HiYaPyCo-0.1.1.tar.gz

Download URL HiYaPyCo-0.1.1.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b2766e611e643493de088c4b52134716f5f79d766a253e3c031b182bc4086eb6
BLAKE2b-256 checksum
How to use checksums
efefcec74ba5d564991e937723eaa2da168572dd169eba4e1a4cfaa8b3f994fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / HiYaPyCo-0.1.1-py2.py3-none-any.whl

Download URL HiYaPyCo-0.1.1-py2.py3-none-any.whl
Size 8.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b56fa4e557bd7e29f260fc4392add33cda3dff7171903f7411adf2c367923605
BLAKE2b-256 checksum
How to use checksums
e2d61bfd1a76a3c96021fecafff4ed71466f8c64deb6adbc585d93cdca66e1f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for HiYaPyCo 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page