nmk.model.model
nmk main model
Classes
nmk model definition |
Module Contents
- class nmk.model.model.NmkModel
nmk model definition
- args: argparse.Namespace
Command line parsed args
- file_paths: list[pathlib.Path] = []
List of parsed project file paths
- file_models: dict[pathlib.Path, object]
Dict of file models indexed by path
- config: dict[str, nmk.model.config.NmkConfig]
Dict of config item instances
- tasks: dict[str, nmk.model.task.NmkTask]
Dict of task instances
- default_task: nmk.model.task.NmkTask = None
Default task instance
- tasks_config: dict[str, nmk.model.config.NmkConfig]
Inner tasks config dict
- pip_args: str = ''
pip command extra args
- overridden_refs: dict[str, pathlib.Path]
Dict of overridden references
- path_finder: _NmkPathFinder
Path finder instance
- add_config(name: str, path: pathlib.Path | None, init_value: str | int | bool | list[Any] | dict[str, Any] | None = None, resolver: object = None, task_config: bool = False, resolver_params: nmk.model.config.NmkDictConfig | None = None, adapt_type: bool = False) nmk.model.config.NmkConfig
Add a config item to model
- Parameters:
name – config item name
path – project file defining this item
init_value – initial value for config item
resolver – resolver instance for this item
task_config – use inner task config dict
resolver_params – resolver parameters
adapt_type – when overriding, adapt value type to overridden type (if possible, works for str->int and str->bool)
- Returns:
created config item instance
- load_class(qualified_class: str, expected_type: object) object
Create referenced class instance
- Parameters:
qualified_class – fully qualified class name
expected_type – expected instance type
- Returns:
created class instance
- add_task(task: nmk.model.task.NmkTask)
Add task instance to model
- Parameters:
task – task instance to be added
- set_default_task(name: str)
Default task setter
- Parameters:
name – name of the new default task
- replace_remote(remote: str, local: pathlib.Path)
Replace remote reference by local remote reference
- Parameters:
remote – remote name
local – local remote path
- check_remote_ref(remote: str) pathlib.Path
Check remote reference to potentially replace it by its local equivalent
- Parameters:
remote – remote name
- Returns:
resolved remote path