kheops package

Subpackages

Submodules

kheops.app module

Kheops App interface

class kheops.app.GenericInstance

Bases: object

GenericInstance class

Variables
  • name (str or None) – Name of the instace.

  • run (dict) – Json compatible dict for instance runtime data.

name = None
run = {}
class kheops.app.Kheops(config='kheops.yml', namespace='default')

Bases: kheops.app.GenericInstance

Kheops Application Class

lookup2(keys=None, policy=None, scope=None, trace=False, explain=False, validate_schema=False, namespace='default')

Lookup a key in hierarchy

Parameters
  • keys (list[str]) – List of keys to query.

  • scope (dict) – Scope key.

parse_conf(config='kheops.yml')

Parse Kheops configuration

Parameters

config (dict or str or None) – Kheops configuration, can either be a file path or a dict.

Returns

The parsed configuration.

Return type

dict

class kheops.app.KheopsNamespace(app, name, config=None)

Bases: kheops.app.GenericInstance, kheops.controllers.QueryProcessor

Kheops Namespace Class

kheops.cli module

Kheops CLI interface

class kheops.cli.CmdApp

Bases: object

Main CmdApp

cli()

Main cli command

cli_demo()

Display how to use logging

cli_gen_doc()

Generate documentation

cli_lookup()

Lookup database

cli_schema()

Display configuration schema

get_args()

Prepare command line

get_logger(logger_name=None, create_file=False, verbose=0)

Create CmdApp logger

kheops.controllers module

class kheops.controllers.LoadPlugin(plugins)

Bases: object

Generic class to load plugins

load(kind, name)
class kheops.controllers.Query(key, scope)

Bases: object

key = None
scope = None
class kheops.controllers.QueryProcessor

Bases: object

QueryProcessor class provides all the methods to be able to make queries

CHILDREN_INIT(config)
default_lookup_item = {'backend': 'file', 'continue': True, 'path': None}
default_match_rule = {'continue': False, 'key': None, 'strategy': 'merge_deep'}
query(key=None, scope=None, explain=False)

kheops.utils module

Utils class

class kheops.utils.Default

Bases: dict

kheops.utils.glob_files(path, pattern)

Return a list of path that match a glob

kheops.utils.path_assemble_hier(path, sep='/', reverse=False, start_index=0)

Append the previous

kheops.utils.render_template(text, params)

Render template for a given string

kheops.utils.render_template_python(text, params, ignore_missing=True)

Render template for a given string

kheops.utils.schema_validate(config, schema)

Validate a config against a jsonschema

kheops.utils.str_ellipsis(txt, length=60)

Truncate with ellipsis too wide texts