zrb 0.15.0__py3-none-any.whl → 0.17.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. zrb/__init__.py +5 -0
  2. zrb/__main__.py +0 -3
  3. zrb/action/runner.py +12 -3
  4. zrb/advertisement.py +4 -0
  5. zrb/builtin/_helper/reccuring_action.py +0 -23
  6. zrb/builtin/devtool/install/_input.py +2 -4
  7. zrb/builtin/devtool/install/helix/resource/config.toml +2 -1
  8. zrb/builtin/process/pid/get_by_name.py +1 -1
  9. zrb/builtin/project/create/template/project.sh +1 -0
  10. zrb/builtin/schedule.py +14 -10
  11. zrb/builtin/watch_changes.py +15 -14
  12. zrb/config/config.py +21 -14
  13. zrb/helper/accessories/color.py +5 -2
  14. zrb/helper/accessories/icon.py +4 -0
  15. zrb/helper/accessories/name.py +4 -0
  16. zrb/helper/accessories/untyped_color.py +10 -0
  17. zrb/helper/advertisement.py +3 -0
  18. zrb/helper/callable.py +9 -1
  19. zrb/helper/cli.py +2 -0
  20. zrb/helper/codemod/add_argument_to_function.py +6 -0
  21. zrb/helper/codemod/add_argument_to_function_call.py +6 -0
  22. zrb/helper/codemod/add_assert_resource.py +4 -0
  23. zrb/helper/codemod/add_function_call.py +4 -0
  24. zrb/helper/codemod/add_import_module.py +4 -0
  25. zrb/helper/codemod/add_key_value_to_dict.py +6 -0
  26. zrb/helper/codemod/add_property_to_class.py +6 -0
  27. zrb/helper/codemod/add_upstream_to_task.py +4 -0
  28. zrb/helper/codemod/append_code_to_function.py +6 -0
  29. zrb/helper/codemod/format_code.py +4 -0
  30. zrb/helper/default_env.py +2 -0
  31. zrb/helper/docker_compose/fetch_external_env.py +6 -0
  32. zrb/helper/docker_compose/file.py +4 -0
  33. zrb/helper/docstring.py +5 -0
  34. zrb/helper/env_map/fetch.py +4 -0
  35. zrb/helper/file/copy_tree.py +3 -0
  36. zrb/helper/file/match.py +4 -0
  37. zrb/helper/file/text.py +4 -0
  38. zrb/helper/git/detect_changes.py +4 -0
  39. zrb/helper/loader/load_module.py +2 -0
  40. zrb/helper/log.py +1 -1
  41. zrb/helper/map/conversion.py +4 -0
  42. zrb/helper/python_task.py +3 -0
  43. zrb/helper/render_data.py +4 -0
  44. zrb/helper/string/conversion.py +13 -36
  45. zrb/helper/string/jinja.py +4 -0
  46. zrb/helper/string/modification.py +4 -0
  47. zrb/helper/string/parse_replacement.py +4 -0
  48. zrb/helper/string/untyped_conversion.py +49 -0
  49. zrb/helper/task.py +4 -0
  50. zrb/helper/typecheck.py +6 -7
  51. zrb/helper/typing.py +32 -12
  52. zrb/helper/util.py +4 -0
  53. zrb/runner.py +3 -0
  54. zrb/task/any_task.py +5 -0
  55. zrb/task/any_task_event_handler.py +4 -0
  56. zrb/task/base_remote_cmd_task.py +4 -0
  57. zrb/task/base_task/base_task.py +5 -1
  58. zrb/task/checker.py +7 -3
  59. zrb/task/cmd_task.py +14 -2
  60. zrb/task/decorator.py +4 -0
  61. zrb/task/docker_compose_task.py +4 -0
  62. zrb/task/flow_task.py +4 -0
  63. zrb/task/http_checker.py +14 -1
  64. zrb/task/looper.py +40 -0
  65. zrb/task/notifier.py +4 -0
  66. zrb/task/parallel.py +4 -0
  67. zrb/task/path_checker.py +14 -1
  68. zrb/task/path_watcher.py +65 -41
  69. zrb/task/port_checker.py +14 -1
  70. zrb/task/recurring_task.py +5 -0
  71. zrb/task/remote_cmd_task.py +4 -0
  72. zrb/task/resource_maker.py +14 -1
  73. zrb/task/rsync_task.py +4 -0
  74. zrb/task/server.py +190 -0
  75. zrb/task/task.py +4 -0
  76. zrb/task/time_watcher.py +50 -18
  77. zrb/task/watcher.py +100 -0
  78. zrb/task/wiki_task.py +4 -0
  79. zrb/task_env/constant.py +5 -0
  80. zrb/task_env/env.py +4 -0
  81. zrb/task_env/env_file.py +4 -0
  82. zrb/task_group/group.py +4 -0
  83. zrb/task_input/any_input.py +4 -0
  84. zrb/task_input/base_input.py +4 -0
  85. zrb/task_input/bool_input.py +4 -0
  86. zrb/task_input/choice_input.py +4 -0
  87. zrb/task_input/constant.py +5 -0
  88. zrb/task_input/float_input.py +4 -0
  89. zrb/task_input/int_input.py +4 -0
  90. zrb/task_input/password_input.py +4 -0
  91. zrb/task_input/str_input.py +4 -0
  92. zrb/task_input/task_input.py +4 -0
  93. {zrb-0.15.0.dist-info → zrb-0.17.0.dist-info}/METADATA +1 -1
  94. {zrb-0.15.0.dist-info → zrb-0.17.0.dist-info}/RECORD +97 -92
  95. {zrb-0.15.0.dist-info → zrb-0.17.0.dist-info}/LICENSE +0 -0
  96. {zrb-0.15.0.dist-info → zrb-0.17.0.dist-info}/WHEEL +0 -0
  97. {zrb-0.15.0.dist-info → zrb-0.17.0.dist-info}/entry_points.txt +0 -0
zrb/__init__.py CHANGED
@@ -32,8 +32,10 @@ from zrb.task.resource_maker import (
32
32
  get_default_resource_skip_parsing,
33
33
  )
34
34
  from zrb.task.rsync_task import RsyncTask
35
+ from zrb.task.server import Controller, Server
35
36
  from zrb.task.task import Task
36
37
  from zrb.task.time_watcher import TimeWatcher
38
+ from zrb.task.watcher import Watcher
37
39
  from zrb.task.wiki_task import create_wiki_tasks
38
40
  from zrb.task_env.env import Env
39
41
  from zrb.task_env.env_file import EnvFile
@@ -74,6 +76,9 @@ assert HTTPChecker
74
76
  assert PortChecker
75
77
  assert PathChecker
76
78
  assert PathWatcher
79
+ assert Controller
80
+ assert Server
81
+ assert Watcher
77
82
  assert TimeWatcher
78
83
  assert ResourceMaker
79
84
  assert FlowTask
zrb/__main__.py CHANGED
@@ -1,10 +1,7 @@
1
- from zrb.helper.accessories.color import colored
2
1
  from zrb.helper.cli import create_cli
3
2
  from zrb.helper.default_env import inject_default_env
4
- from zrb.helper.log import logger
5
3
 
6
4
  inject_default_env()
7
- logger.info(colored("Create CLI instance", attrs=["dark"]))
8
5
  cli = create_cli()
9
6
 
10
7
  if __name__ == "__main__":
zrb/action/runner.py CHANGED
@@ -9,6 +9,8 @@ from zrb.helper.typing import Any, Callable, List, Mapping, Union
9
9
  from zrb.task.any_task import AnyTask
10
10
  from zrb.task_group.group import Group as TaskGroup
11
11
 
12
+ logger.debug(colored("Loading zrb.action.runner", attrs=["dark"]))
13
+
12
14
  CliSubcommand = Union[click.Group, click.Command]
13
15
 
14
16
 
@@ -88,7 +90,7 @@ class Runner:
88
90
  task_inputs = task._get_combined_inputs()
89
91
  task_cli_name = task.get_cli_name()
90
92
  task_description = task.get_description()
91
- callback = self.__wrap_task_function(task)
93
+ callback = self.__get_wrapped_task_function(task)
92
94
  command = click.Command(
93
95
  callback=callback, name=task_cli_name, help=task_description
94
96
  )
@@ -106,12 +108,19 @@ class Runner:
106
108
  command.params.append(click.Option(param_decl, **options))
107
109
  return command
108
110
 
109
- def __wrap_task_function(self, task: AnyTask) -> Callable[..., Any]:
111
+ def __get_wrapped_task_function(self, task: AnyTask) -> Callable[..., Any]:
110
112
  def wrapped_function(*args: Any, **kwargs: Any) -> Any:
111
- function = task.to_function(env_prefix=self.__env_prefix, raise_error=True)
113
+ function = task.to_function(
114
+ env_prefix=self.__env_prefix,
115
+ raise_error=True,
116
+ should_clear_xcom=True,
117
+ should_stop_looper=True,
118
+ )
112
119
  try:
113
120
  function(*args, **kwargs)
114
121
  except Exception:
115
122
  sys.exit(1)
123
+ finally:
124
+ task.clear_xcom()
116
125
 
117
126
  return wrapped_function
zrb/advertisement.py CHANGED
@@ -1,6 +1,10 @@
1
+ from zrb.helper.accessories.color import colored
1
2
  from zrb.helper.advertisement import Advertisement
3
+ from zrb.helper.log import logger
2
4
  from zrb.helper.typing import List
3
5
 
6
+ logger.debug(colored("Loading zrb.advertisement", attrs=["dark"]))
7
+
4
8
  # flake8: noqa E501
5
9
 
6
10
  advertisements: List[Advertisement] = [
@@ -1,6 +1,4 @@
1
- from zrb.helper.typing import Any
2
1
  from zrb.task.cmd_task import CmdTask
3
- from zrb.task.decorator import python_task
4
2
  from zrb.task.notifier import Notifier
5
3
  from zrb.task.task import Task
6
4
  from zrb.task_input.str_input import StrInput
@@ -8,8 +6,6 @@ from zrb.task_input.str_input import StrInput
8
6
 
9
7
  def create_recurring_action(
10
8
  notif_title: str,
11
- trigger_caption: str,
12
- trigger_xcom_key: str,
13
9
  default_message: str = "👋",
14
10
  ) -> Task:
15
11
  # define inputs
@@ -23,16 +19,11 @@ def create_recurring_action(
23
19
  default="",
24
20
  prompt="Command to be executed",
25
21
  )
26
- # define tasks
27
- show_trigger_info = _create_show_trigger_info(
28
- trigger_caption=trigger_caption, trigger_xcom_key=trigger_xcom_key
29
- )
30
22
  run_command = CmdTask(
31
23
  name="run-command",
32
24
  icon="⚙️",
33
25
  color="blue",
34
26
  inputs=[command_input],
35
- upstreams=[show_trigger_info],
36
27
  should_execute='{{ input.command != "" }}',
37
28
  cmd="{{ input.command }}",
38
29
  )
@@ -43,7 +34,6 @@ def create_recurring_action(
43
34
  inputs=[message_input],
44
35
  title=notif_title,
45
36
  message="{{ input.message }}",
46
- upstreams=[show_trigger_info],
47
37
  should_execute='{{ input.message != "" }}',
48
38
  )
49
39
  # return aggregator task
@@ -53,16 +43,3 @@ def create_recurring_action(
53
43
  upstreams=[run_command, notify],
54
44
  retry=0,
55
45
  )
56
-
57
-
58
- def _create_show_trigger_info(trigger_caption: str, trigger_xcom_key: str) -> Task:
59
- @python_task(
60
- name="show-trigger-info",
61
- icon="🔍",
62
- color="magenta",
63
- )
64
- def show_trigger_info(*args: Any, **kwargs: Any):
65
- task: Task = kwargs.get("_task")
66
- task.print_out(f"{trigger_caption}: {task.get_xcom(trigger_xcom_key)}")
67
-
68
- return show_trigger_info
@@ -1,11 +1,9 @@
1
- from zrb.config.config import get_current_shell
1
+ from zrb.config.config import default_shell
2
2
  from zrb.task_input.str_input import StrInput
3
3
 
4
- current_shell = get_current_shell()
5
-
6
4
  terminal_config_file_input = StrInput(
7
5
  name="config-file",
8
6
  shortcut="c",
9
7
  prompt="Config file",
10
- default="~/.zshrc" if current_shell == "zsh" else "~/.bashrc",
8
+ default="~/.zshrc" if default_shell == "zsh" else "~/.bashrc",
11
9
  )
@@ -3,6 +3,7 @@ theme = "gruvbox_transparent"
3
3
  [editor]
4
4
  line-number = "relative"
5
5
  mouse = true
6
+ bufferline = "always"
6
7
 
7
8
  [editor.cursor-shape]
8
9
  insert = "bar"
@@ -16,4 +17,4 @@ enable = true
16
17
  hidden = false
17
18
  git-ignore = false
18
19
  git-global = false
19
- git-exclude = false
20
+ git-exclude = false
@@ -16,7 +16,7 @@ get_process_pid_by_name = CmdTask(
16
16
  prompt="Process name to be checked",
17
17
  )
18
18
  ],
19
- cmd="pgrep {{ input.name }}",
19
+ cmd='pgrep "{{ input.name }}" || exit 0',
20
20
  checking_interval=3,
21
21
  )
22
22
  runner.register(get_process_pid_by_name)
@@ -56,6 +56,7 @@ reload() {
56
56
  fi
57
57
 
58
58
  log_info 'Install'
59
+ poetry lock --no-update
59
60
  poetry install
60
61
 
61
62
  if [ "$IS_TERMUX" = "1" ]
zrb/builtin/schedule.py CHANGED
@@ -1,10 +1,10 @@
1
1
  from zrb.builtin._helper.reccuring_action import create_recurring_action
2
2
  from zrb.runner import runner
3
- from zrb.task.recurring_task import RecurringTask
3
+ from zrb.task.server import Controller, Server
4
4
  from zrb.task.time_watcher import TimeWatcher
5
5
  from zrb.task_input.str_input import StrInput
6
6
 
7
- schedule = RecurringTask(
7
+ schedule = Server(
8
8
  name="schedule",
9
9
  icon="📅",
10
10
  color="yellow",
@@ -17,15 +17,19 @@ schedule = RecurringTask(
17
17
  description="Schedule cron pattern to show the message",
18
18
  ),
19
19
  ],
20
- triggers=[
21
- TimeWatcher(
22
- name="watch-time", color="cyan", icon="⏰", schedule="{{input.schedule}}"
20
+ controllers=[
21
+ Controller(
22
+ name="periodic",
23
+ trigger=TimeWatcher(
24
+ name="watch-time",
25
+ color="cyan",
26
+ icon="⏰",
27
+ schedule="{{input.schedule}}",
28
+ ),
29
+ action=create_recurring_action(
30
+ notif_title="Schedule",
31
+ ),
23
32
  )
24
33
  ],
25
- task=create_recurring_action(
26
- notif_title="Schedule",
27
- trigger_caption="Schedule",
28
- trigger_xcom_key="watch-time.scheduled-time",
29
- ),
30
34
  )
31
35
  runner.register(schedule)
@@ -1,10 +1,10 @@
1
1
  from zrb.builtin._helper.reccuring_action import create_recurring_action
2
2
  from zrb.runner import runner
3
3
  from zrb.task.path_watcher import PathWatcher
4
- from zrb.task.recurring_task import RecurringTask
4
+ from zrb.task.server import Controller, Server
5
5
  from zrb.task_input.str_input import StrInput
6
6
 
7
- watch_changes = RecurringTask(
7
+ watch_changes = Server(
8
8
  name="watch-changes",
9
9
  icon="🕵️",
10
10
  color="yellow",
@@ -23,19 +23,20 @@ watch_changes = RecurringTask(
23
23
  description="Ignored file pattern",
24
24
  ),
25
25
  ],
26
- triggers=[
27
- PathWatcher(
28
- name="watch-path",
29
- color="cyan",
30
- icon="👀",
31
- path="{{input.pattern}}",
32
- ignored_path="{{input.ignored_pattern}}",
26
+ controllers=[
27
+ Controller(
28
+ name="watch",
29
+ trigger=PathWatcher(
30
+ name="watch-path",
31
+ color="cyan",
32
+ icon="👀",
33
+ path="{{input.pattern}}",
34
+ ignored_path="{{input.ignored_pattern}}",
35
+ ),
36
+ action=create_recurring_action(
37
+ notif_title="Watch",
38
+ ),
33
39
  )
34
40
  ],
35
- task=create_recurring_action(
36
- notif_title="Watch",
37
- trigger_caption="File changes",
38
- trigger_xcom_key="watch-path.file",
39
- ),
40
41
  )
41
42
  runner.register(watch_changes)
zrb/config/config.py CHANGED
@@ -1,17 +1,17 @@
1
1
  import importlib.metadata as metadata
2
2
  import os
3
3
 
4
- from zrb.helper.string.conversion import to_boolean, to_logging_level
5
- from zrb.helper.typecheck import typechecked
4
+ from zrb.helper.string.untyped_conversion import (
5
+ untyped_to_boolean,
6
+ untyped_to_logging_level,
7
+ )
6
8
 
7
9
 
8
- @typechecked
9
- def get_version() -> str:
10
+ def _get_version() -> str:
10
11
  return metadata.version("zrb")
11
12
 
12
13
 
13
- @typechecked
14
- def get_current_shell() -> str:
14
+ def _get_current_shell() -> str:
15
15
  current_shell = os.getenv("SHELL", "")
16
16
  if current_shell.endswith("zsh"):
17
17
  return "zsh"
@@ -24,17 +24,24 @@ def _get_valid_container_backend(container_backend: str) -> str:
24
24
  return "docker"
25
25
 
26
26
 
27
- tmp_dir = os.getenv("ZRB_TMP_DIR", "/tmp")
28
- default_shell = os.getenv("ZRB_SHELL", get_current_shell())
27
+ def _get_default_tmp_dir() -> str:
28
+ if os.path.isdir("/tmp"):
29
+ return "/tmp"
30
+ return os.path.expanduser(os.path.join("~", ".tmp"))
31
+
32
+
33
+ tmp_dir = os.getenv("ZRB_TMP_DIR", _get_default_tmp_dir())
34
+ default_shell = os.getenv("ZRB_SHELL", _get_current_shell())
29
35
  init_script_str = os.getenv("ZRB_INIT_SCRIPTS", "")
30
36
  init_scripts = init_script_str.split(":") if init_script_str != "" else []
31
- logging_level = to_logging_level(os.getenv("ZRB_LOGGING_LEVEL", "WARNING"))
32
- should_load_builtin = to_boolean(os.getenv("ZRB_SHOULD_LOAD_BUILTIN", "1"))
37
+ logging_level = untyped_to_logging_level(os.getenv("ZRB_LOGGING_LEVEL", "WARNING"))
38
+ should_load_builtin = untyped_to_boolean(os.getenv("ZRB_SHOULD_LOAD_BUILTIN", "1"))
33
39
  env_prefix = os.getenv("ZRB_ENV", "")
34
- show_advertisement = to_boolean(os.getenv("ZRB_SHOW_ADVERTISEMENT", "1"))
35
- show_prompt = to_boolean(os.getenv("ZRB_SHOW_PROMPT", "1"))
36
- show_time = to_boolean(os.getenv("ZRB_SHOW_TIME", "1"))
37
- version = get_version()
40
+ show_advertisement = untyped_to_boolean(os.getenv("ZRB_SHOW_ADVERTISEMENT", "1"))
41
+ show_prompt = untyped_to_boolean(os.getenv("ZRB_SHOW_PROMPT", "1"))
42
+ show_time = untyped_to_boolean(os.getenv("ZRB_SHOW_TIME", "1"))
43
+ version = _get_version()
38
44
  container_backend = _get_valid_container_backend(
39
45
  os.getenv("ZRB_CONTAINER_BACKEND", "docker")
40
46
  )
47
+ enable_type_checking = untyped_to_boolean(os.getenv("ZRB_ENABLE_TYPE_CHECKING", "1"))
@@ -1,11 +1,14 @@
1
1
  import random
2
2
 
3
3
  from termcolor import COLORS
4
- from termcolor import colored as term_colored
5
4
 
5
+ from zrb.helper.accessories.untyped_color import untyped_colored
6
+ from zrb.helper.log import logger
6
7
  from zrb.helper.typecheck import typechecked
7
8
  from zrb.helper.typing import Iterable, Optional
8
9
 
10
+ logger.debug(untyped_colored("Loading zrb.helper.accessories.color", attrs=["dark"]))
11
+
9
12
 
10
13
  @typechecked
11
14
  def get_random_color() -> str:
@@ -37,4 +40,4 @@ def colored(
37
40
  on_color: Optional[str] = None,
38
41
  attrs: Optional[Iterable[str]] = None,
39
42
  ) -> str:
40
- return term_colored(text, color, on_color, attrs)
43
+ return untyped_colored(text, color, on_color, attrs)
@@ -1,7 +1,11 @@
1
1
  import random
2
2
 
3
+ from zrb.helper.accessories.color import colored
4
+ from zrb.helper.log import logger
3
5
  from zrb.helper.typecheck import typechecked
4
6
 
7
+ logger.debug(colored("Loading zrb.helper.accessories.icon", attrs=["dark"]))
8
+
5
9
 
6
10
  @typechecked
7
11
  def get_random_icon() -> str:
@@ -1,8 +1,12 @@
1
1
  import random
2
2
  import string
3
3
 
4
+ from zrb.helper.accessories.color import colored
5
+ from zrb.helper.log import logger
4
6
  from zrb.helper.typecheck import typechecked
5
7
 
8
+ logger.debug(colored("Loading zrb.helper.accessories.name", attrs=["dark"]))
9
+
6
10
 
7
11
  @typechecked
8
12
  def get_random_name(
@@ -0,0 +1,10 @@
1
+ from termcolor import colored as term_colored
2
+
3
+
4
+ def untyped_colored(
5
+ text,
6
+ color=None,
7
+ on_color=None,
8
+ attrs=None,
9
+ ) -> str:
10
+ return term_colored(text, color, on_color, attrs)
@@ -4,9 +4,12 @@ import re
4
4
  import sys
5
5
 
6
6
  from zrb.helper.accessories.color import colored
7
+ from zrb.helper.log import logger
7
8
  from zrb.helper.typecheck import typechecked
8
9
  from zrb.helper.typing import Iterable, Optional
9
10
 
11
+ logger.debug(colored("Loading zrb.helper.advertisement", attrs=["dark"]))
12
+
10
13
 
11
14
  @typechecked
12
15
  class Advertisement:
zrb/helper/callable.py CHANGED
@@ -1,8 +1,16 @@
1
+ import asyncio
1
2
  import inspect
2
3
  from typing import Any, Callable
3
4
 
5
+ from zrb.helper.accessories.color import colored
6
+ from zrb.helper.log import logger
7
+
8
+ logger.debug(colored("Loading zrb.helper.callable", attrs=["dark"]))
9
+
4
10
 
5
11
  async def run_async(fn: Callable, *args: Any, **kwargs: Any) -> Any:
6
12
  if inspect.iscoroutinefunction(fn):
7
13
  return await fn(*args, **kwargs)
8
- return fn(*args, **kwargs)
14
+ coro = asyncio.to_thread(fn, *args, **kwargs)
15
+ task = asyncio.create_task(coro)
16
+ return await task
zrb/helper/cli.py CHANGED
@@ -11,6 +11,8 @@ from zrb.helper.log import logger
11
11
  from zrb.helper.typecheck import typechecked
12
12
  from zrb.runner import runner
13
13
 
14
+ logger.debug(colored("Loading zrb.helper.cli", attrs=["dark"]))
15
+
14
16
  HELP = f"""
15
17
  bb
16
18
  zzzzz rr rr bb
@@ -1,7 +1,13 @@
1
1
  import libcst as cst
2
2
 
3
+ from zrb.helper.accessories.color import colored
4
+ from zrb.helper.log import logger
3
5
  from zrb.helper.typecheck import typechecked
4
6
 
7
+ logger.debug(
8
+ colored("Loading zrb.helper.codemod.add_argument_to_function", attrs=["dark"])
9
+ )
10
+
5
11
 
6
12
  @typechecked
7
13
  class AddArgumentTransformer(cst.CSTTransformer):
@@ -1,7 +1,13 @@
1
1
  import libcst as cst
2
2
 
3
+ from zrb.helper.accessories.color import colored
4
+ from zrb.helper.log import logger
3
5
  from zrb.helper.typecheck import typechecked
4
6
 
7
+ logger.debug(
8
+ colored("Loading zrb.helper.codemod.add_argument_to_function_call", attrs=["dark"])
9
+ )
10
+
5
11
 
6
12
  @typechecked
7
13
  class AddArgumentTransformer(cst.CSTTransformer):
@@ -1,7 +1,11 @@
1
1
  import libcst as cst
2
2
 
3
+ from zrb.helper.accessories.color import colored
4
+ from zrb.helper.log import logger
3
5
  from zrb.helper.typecheck import typechecked
4
6
 
7
+ logger.debug(colored("Loading zrb.helper.codemod.add_assert_resource", attrs=["dark"]))
8
+
5
9
 
6
10
  @typechecked
7
11
  def add_assert_resource(code: str, resource: str) -> str:
@@ -1,7 +1,11 @@
1
1
  import libcst as cst
2
2
 
3
+ from zrb.helper.accessories.color import colored
4
+ from zrb.helper.log import logger
3
5
  from zrb.helper.typecheck import typechecked
4
6
 
7
+ logger.debug(colored("Loading zrb.helper.codemod.add_function_call", attrs=["dark"]))
8
+
5
9
 
6
10
  @typechecked
7
11
  def add_function_call(code: str, function_name: str, parameters: list) -> str:
@@ -1,8 +1,12 @@
1
1
  import libcst as cst
2
2
 
3
+ from zrb.helper.accessories.color import colored
4
+ from zrb.helper.log import logger
3
5
  from zrb.helper.typecheck import typechecked
4
6
  from zrb.helper.typing import Optional, Tuple, Union
5
7
 
8
+ logger.debug(colored("Loading zrb.helper.codemod.add_import_module", attrs=["dark"]))
9
+
6
10
 
7
11
  @typechecked
8
12
  def add_import_module(
@@ -1,7 +1,13 @@
1
1
  import libcst as cst
2
2
 
3
+ from zrb.helper.accessories.color import colored
4
+ from zrb.helper.log import logger
3
5
  from zrb.helper.typecheck import typechecked
4
6
 
7
+ logger.debug(
8
+ colored("Loading zrb.helper.codemod.add_key_value_to_dict", attrs=["dark"])
9
+ )
10
+
5
11
 
6
12
  @typechecked
7
13
  class AddKeyValuePairTransformer(cst.CSTTransformer):
@@ -1,8 +1,14 @@
1
1
  import libcst as cst
2
2
 
3
+ from zrb.helper.accessories.color import colored
4
+ from zrb.helper.log import logger
3
5
  from zrb.helper.typecheck import typechecked
4
6
  from zrb.helper.typing import Optional
5
7
 
8
+ logger.debug(
9
+ colored("Loading zrb.helper.codemod.add_property_to_class", attrs=["dark"])
10
+ )
11
+
6
12
 
7
13
  @typechecked
8
14
  class AddPropertyTransformer(cst.CSTTransformer):
@@ -1,7 +1,11 @@
1
1
  import libcst as cst
2
2
 
3
+ from zrb.helper.accessories.color import colored
4
+ from zrb.helper.log import logger
3
5
  from zrb.helper.typecheck import typechecked
4
6
 
7
+ logger.debug(colored("Loading zrb.helper.codemod.add_upstream_to_task", attrs=["dark"]))
8
+
5
9
 
6
10
  @typechecked
7
11
  class TaskTransformer(cst.CSTTransformer):
@@ -1,7 +1,13 @@
1
1
  import libcst as cst
2
2
 
3
+ from zrb.helper.accessories.color import colored
4
+ from zrb.helper.log import logger
3
5
  from zrb.helper.typecheck import typechecked
4
6
 
7
+ logger.debug(
8
+ colored("Loading zrb.helper.codemod.append_code_to_function", attrs=["dark"])
9
+ )
10
+
5
11
 
6
12
  @typechecked
7
13
  class AppendCodeTransformer(cst.CSTTransformer):
@@ -1,7 +1,11 @@
1
1
  import autopep8
2
2
 
3
+ from zrb.helper.accessories.color import colored
4
+ from zrb.helper.log import logger
3
5
  from zrb.helper.typecheck import typechecked
4
6
 
7
+ logger.debug(colored("Loading zrb.helper.codemod.format_code", attrs=["dark"]))
8
+
5
9
 
6
10
  @typechecked
7
11
  def format_code(code: str) -> str:
zrb/helper/default_env.py CHANGED
@@ -6,9 +6,11 @@ from zrb.helper.log import logger
6
6
  from zrb.helper.typecheck import typechecked
7
7
  from zrb.helper.typing import Mapping, Optional
8
8
 
9
+ logger.debug(colored("Loading zrb.helper.default_env", attrs=["dark"]))
9
10
  _PROJECT_DIR_MAP: Mapping[str, str] = {}
10
11
 
11
12
 
13
+ @lru_cache
12
14
  def inject_default_env():
13
15
  # Inject PYTHONUNBUFFERED
14
16
  if "PYTHONUNBUFFERED" not in os.environ:
@@ -1,6 +1,12 @@
1
+ from zrb.helper.accessories.color import colored
2
+ from zrb.helper.log import logger
1
3
  from zrb.helper.typecheck import typechecked
2
4
  from zrb.helper.typing import Any, List, Mapping
3
5
 
6
+ logger.debug(
7
+ colored("Loading zrb.helper.docker_compose.fetch_external_env", attrs=["dark"])
8
+ )
9
+
4
10
 
5
11
  @typechecked
6
12
  def fetch_compose_file_env_map(data: Any) -> Mapping[str, str]:
@@ -1,8 +1,12 @@
1
1
  from ruamel.yaml import YAML, CommentedMap
2
2
 
3
+ from zrb.helper.accessories.color import colored
4
+ from zrb.helper.log import logger
3
5
  from zrb.helper.typecheck import typechecked
4
6
  from zrb.helper.typing import Any, Mapping
5
7
 
8
+ logger.debug(colored("Loading zrb.helper.docker_compose.file", attrs=["dark"]))
9
+
6
10
 
7
11
  @typechecked
8
12
  def read_compose_file(file_name: str) -> Any:
zrb/helper/docstring.py CHANGED
@@ -1,6 +1,11 @@
1
1
  import inspect
2
2
  import re
3
3
 
4
+ from zrb.helper.accessories.color import colored
5
+ from zrb.helper.log import logger
6
+
7
+ logger.debug(colored("Loading zrb.helper.docstring", attrs=["dark"]))
8
+
4
9
 
5
10
  def get_markdown_from_docstring(cls) -> str:
6
11
  """
@@ -1,3 +1,5 @@
1
+ from zrb.helper.accessories.color import colored
2
+ from zrb.helper.log import logger
1
3
  from zrb.helper.string.jinja import is_probably_jinja
2
4
  from zrb.helper.typecheck import typechecked
3
5
  from zrb.helper.typing import List, Mapping
@@ -5,6 +7,8 @@ from zrb.task.any_task import AnyTask
5
7
  from zrb.task_env.env import Env
6
8
  from zrb.task_group.group import Group
7
9
 
10
+ logger.debug(colored("Loading zrb.helper.env_map.fetch", attrs=["dark"]))
11
+
8
12
 
9
13
  @typechecked
10
14
  def fetch_env_map_from_group(
@@ -2,12 +2,15 @@ import fnmatch
2
2
  import os
3
3
  import shutil
4
4
 
5
+ from zrb.helper.accessories.color import colored
5
6
  from zrb.helper.file.text import read_text_file_async, write_text_file_async
6
7
  from zrb.helper.log import logger
7
8
  from zrb.helper.string.parse_replacement import parse_replacement
8
9
  from zrb.helper.typecheck import typechecked
9
10
  from zrb.helper.typing import Iterable, Mapping, Optional
10
11
 
12
+ logger.debug(colored("Loading zrb.helper.file.copy_tree", attrs=["dark"]))
13
+
11
14
 
12
15
  @typechecked
13
16
  async def copy_tree(