promptprep.config module

Handles configuration settings for PromptPrep.

Makes it easy to save your preferred settings and load them later.

class promptprep.config.ConfigManager[source]

Bases: object

Lets you save and load your PromptPrep settings.

DEFAULT_CONFIG_DIR = '/home/docs/.promptprep'
DEFAULT_CONFIG_FILE = '/home/docs/.promptprep/config.json'
static apply_config_to_args(config_dict: Dict[str, Any], args: Namespace) Namespace[source]

Updates your current settings with values from a config file.

Parameters:
  • config_dict – Settings loaded from your config file

  • args – Your current command-line arguments

Returns:

Your updated settings

classmethod ensure_config_dir() None[source]

Creates the config directory if it doesn’t exist yet.

classmethod load_config(config_file: str | None = None) Dict[str, Any][source]

Loads your saved settings from a file.

Parameters:

config_file – Where to load from. Uses ~/.promptprep/config.json if not specified

Returns:

Your saved settings as a dictionary

Raises:

FileNotFoundError – When the config file doesn’t exist

classmethod save_config(args: Namespace, config_file: str | None = None) str[source]

Saves your current settings to a file for later use.

Parameters:
  • args – Your command-line arguments

  • config_file – Where to save the config. Uses ~/.promptprep/config.json if not specified

Returns:

The path where your config was saved