procman.utils module

procman utils for file handling and config parsing.

procman.utils.get_userscripts(usr_cfg, usr_file, demo_mode=False)[source]

Get user scripts from Munchified user cfg.

Parameters:
  • usr_cfg (Munch) – user configuration

  • usr_file (Path) – user config file

  • demo_mode (bool) – run example scripts (self-test)

Returns:

list of user scripts

Return type:

List[str]

procman.utils.load_base_config()[source]

Load initial procman config with our baseline example values. This is used to both run the example flask app and provide a user-facing example configuration.

Returns:

Munch config obj

Return type:

Munch

procman.utils.load_config(ufile='', file_extension='.yaml', file_encoding='utf-8')[source]

Load yaml configuration file and munchify the data. If ENV path or local file is not found in current directory, the default cfg will be loaded. Note that passing ufile as a parameter overrides the above default.

Parameters:
  • ufile (str) – path string for config file

  • file_extension (str) – file extension with leading separator

  • file_encoding (str) – file encoding of config file

Returns:

cfg Munch and file Path

Raises:

FileTypeError – if the input file is not yml

Return type:

Tuple[Munch, Path]