clack.types module

Custom types used by clack live here.

class ClackConfig(*args, **kwargs)[source]

Bases: Protocol

Application Configuration Protocol

In other words, this class describes what an application Config object should look like.

dict()[source]

Converts Config class into a dictionary.

Return type:

dict[str, Any]

classmethod from_cli_args(argv)[source]

Constructs a new Config object from command-line arguments.

Parameters:

argv (Sequence[str]) –

Return type:

TypeVar(Config_T, bound= ClackConfig)

class ClackConfigFile(path)[source]

Bases: Protocol

The protocol used for configuration file classes.

Parameters:

path (Union[str, Path]) –

extensions
get(key)[source]

Getter for values in this config file.

Parameters:

key (str) –

Return type:

Union[Ok[Any, ErisError], Err[Any, ErisError]]

classmethod new(path, **kwargs)[source]

Construct a new ClackConfigFile object.

Parameters:
  • path (Union[str, Path]) –

  • kwargs (Any) –

Return type:

TypeVar(ConfigFile_T, bound= ClackConfigFile)

path
set(key, value, *, allow_new=False)[source]

Setter for values in this config file.

Parameters:
  • key (str) –

  • value (Any) –

  • allow_new (bool) –

Return type:

LazyResult[Any, ErisError]

to_dict()[source]

Converts this configuration file into a dict.

Return type:

Union[Ok[dict[str, Any], ErisError], Err[dict[str, Any], ErisError]]

class ClackMain(*args, **kwargs)[source]

Bases: Protocol

Type of the main() function returned by main_factory().

class ClackNewCommand(*args, **kwargs)[source]

Bases: Protocol

Type of the function returned by new_command_factory().