mloq.config.prompt
Contents
mloq.config.prompt
#
This file contains the logic defining all the parameters needed to set up a project with mloq.
Module Contents#
Classes#
Defines a configuration parameter. |
|
Define a configuration parameter that can take multiple values from a pre-defined set of values. |
|
Define a configuration parameter that can take a string value. |
|
Define a configuration parameter that can take an integer value. |
|
Define a configuration parameter that can take a floating point value. |
|
Defines a boolean configuration parameter. |
|
Manage all the functionality needed to display a cli prompt. |
|
Configurable class that allows to define the parameter values interactively using CLI prompts. |
Attributes#
- mloq.config.prompt.Choices#
- class mloq.config.prompt.PromptParam(name, target, **kwargs)[source]#
Defines a configuration parameter.
- It allows to parse a configuration value from different sources in the following order:
Environment variable named as MLOQ_PARAM_NAME
Values defined in mloq.yaml
Interactive promp from CLI (Optional)
- Parameters
name (str) –
target (mloq.config.configuration.Configurable) –
- property param#
Get the param.Parameter object corresponding to the current configuration parameter.
- Return type
param.Parameter
- property value#
Return the value of the configuration parameter.
- Return type
Any
- property config#
Return the value of the parameter as defined in its config DictConfig.
- Return type
Any
- __call__(interactive=False, default=None, **kwargs)[source]#
Return the value of the parameter parsing it from the different input sources available.
- Parameters
interactive (bool) – Prompt the user to input the value from CLI if it’s not defined in config or as en environment variable.
default (Optional[Any]) – Default value displayed in the interactive mode.
**kwargs – Passed to click.prompt in interactive mode. Overrides the values defined in __init__
- Returns
Value of the parameter.
- class mloq.config.prompt.MultiChoicePrompt(name, target, choices=None, **kwargs)[source]#
Bases:
PromptParam
Define a configuration parameter that can take multiple values from a pre-defined set of values.
- It allows to parse a configuration value from different sources in the following order:
Environment variable named as MLOQ_PARAM_NAME
Values defined in mloq.yaml
Interactive promp from CLI (Optional)
- Parameters
name (str) –
target (mloq.config.configuration.Configurable) –
choices (Optional[Choices]) –
- class mloq.config.prompt.StringPrompt(name, target, **kwargs)[source]#
Bases:
PromptParam
Define a configuration parameter that can take a string value.
- It allows to parse a configuration value from different sources in the following order:
Environment variable named as MLOQ_PARAM_NAME
Values defined in mloq.yaml
Interactive promp from CLI (Optional)
- Parameters
name (str) –
target (mloq.config.configuration.Configurable) –
- class mloq.config.prompt.IntPrompt(name, target, **kwargs)[source]#
Bases:
PromptParam
Define a configuration parameter that can take an integer value.
- It allows to parse a configuration value from different sources in the following order:
Environment variable named as MLOQ_PARAM_NAME
Values defined in mloq.yaml
Interactive promp from CLI (Optional)
- Parameters
name (str) –
target (mloq.config.configuration.Configurable) –
- class mloq.config.prompt.FloatPrompt(name, target, **kwargs)[source]#
Bases:
PromptParam
Define a configuration parameter that can take a floating point value.
- It allows to parse a configuration value from different sources in the following order:
Environment variable named as MLOQ_PARAM_NAME
Values defined in mloq.yaml
Interactive promp from CLI (Optional)
- Parameters
name (str) –
target (mloq.config.configuration.Configurable) –
- class mloq.config.prompt.BooleanPrompt(name, target, **kwargs)[source]#
Bases:
PromptParam
Defines a boolean configuration parameter.
- It allows to parse a configuration value from different sources in the following order:
Environment variable named as MLOQ_PARAM_NAME
Values defined in mloq.yaml
Interactive promp from CLI (Optional)
- Parameters
name (str) –
target (mloq.config.configuration.Configurable) –
- mloq.config.prompt.PARAM_TO_PROMPT#
- class mloq.config.prompt.Prompt(target)[source]#
Manage all the functionality needed to display a cli prompt.
It allows to interactively define the values of the different parameters of a class.
- Parameters
target (Promptable) –
- __call__(key, inplace=False, **kwargs)[source]#
Display the a prompt to interactively define the parameter values of target.
- Parameters
key (str) –
inplace (bool) –
- Return type
Any
- _init_prompts()[source]#
Initialize the prompts corresponding to the target Promptable parameters.
- Return type
None
- class mloq.config.prompt.Promptable(**kwargs)[source]#
Bases:
mloq.config.configuration.Configurable
Configurable class that allows to define the parameter values interactively using CLI prompts.
It contains a prompt attribute in charge of managing the prompting functionality for the param.Parameters defined.