nmk.utils

Functions

run_with_logs(→ subprocess.CompletedProcess[str])

Execute subprocess, and logs output/error streams + error code

run_pip(→ str)

Execute pip command, with logging

is_windows(→ bool)

Returns true if running on Windows, false otherwise

create_dir_symlink(target, link)

Create a directory symbolic link (or something close, according to the OS)

is_condition_set(→ bool)

Verify if task condition is considered to be "true", depending on provided value

Module Contents

nmk.utils.run_with_logs(args: list[str], logger: nmk.logs.NmkLogWrapper = NmkLogger, check: bool = True, cwd: pathlib.Path | None = None) subprocess.CompletedProcess[str]

Execute subprocess, and logs output/error streams + error code

Parameters:
  • args – subprocess commands and arguments

  • logger – logger instance

  • check – if True and subprocess return code is not 0, raise an exception

  • cwd – current working directory for subprocess

Returns:

completed process instance

nmk.utils.run_pip(args: list[str], logger: nmk.logs.NmkLogWrapper = NmkLogger, extra_args: str = '') str

Execute pip command, with logging

Parameters:
  • args – pip command arguments

  • logger – logger instance

  • extra_args – extra arguments (split on spaces and passed to pip command)

Returns:

executed pip command stdout

Deprecated:

This function will be deprecated as soon as buildenv 2.0 is rolled out

nmk.utils.is_windows() bool

Returns true if running on Windows, false otherwise

Create a directory symbolic link (or something close, according to the OS)

Parameters:
  • target – path that will be pointed by the created link

  • link – created link location

nmk.utils.is_condition_set(value: list[Any] | dict[Any, Any] | str | bool | int) bool

Verify if task condition is considered to be “true”, depending on provided value

Parameters:

value – value to be evaluated