zrb 0.0.86__py3-none-any.whl → 0.0.88__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 (121) hide show
  1. zrb/__init__.py +3 -1
  2. zrb/action/runner.py +7 -3
  3. zrb/builtin/__init__.py +1 -1
  4. zrb/builtin/base64.py +1 -1
  5. zrb/builtin/devtool/devtool_install.py +13 -4
  6. zrb/builtin/devtool/helix/install-language-server.sh +33 -0
  7. zrb/builtin/env.py +6 -3
  8. zrb/builtin/explain.py +3 -1
  9. zrb/builtin/generator/__init__.py +4 -8
  10. zrb/builtin/generator/app_generator/add.py +15 -6
  11. zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/add.py +62 -52
  12. zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/cmd/app-start.sh +1 -6
  13. zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/container.py +1 -1
  14. zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/deployment.py +2 -2
  15. zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/image.py +1 -1
  16. zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/local.py +4 -2
  17. zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/src/kebab-zrb-app-name/src/.gitignore +2 -0
  18. zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/src/kebab-zrb-app-name/src/Dockerfile +10 -5
  19. zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/src/kebab-zrb-app-name/src/go.work +1 -0
  20. zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/src/kebab-zrb-app-name/src/main.go +28 -0
  21. zrb/builtin/generator/cmd_task/add.py +6 -6
  22. zrb/builtin/generator/cmd_task/template/_automate/snake_zrb_task_name.py +1 -1
  23. zrb/builtin/generator/{_common → common}/helper.py +6 -0
  24. zrb/builtin/generator/{_common → common}/task_factory.py +9 -5
  25. zrb/builtin/generator/docker_compose_task/add.py +8 -8
  26. zrb/builtin/generator/docker_compose_task/template/_automate/snake_zrb_task_name.py +1 -1
  27. zrb/builtin/generator/fastapp/add.py +24 -24
  28. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_common.py +2 -1
  29. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/container.py +1 -1
  30. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/deployment.py +1 -1
  31. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/frontend.py +1 -1
  32. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/image.py +1 -1
  33. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/load_test.py +3 -2
  34. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/local.py +1 -1
  35. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/test.py +2 -4
  36. zrb/builtin/generator/fastapp_crud/add.py +8 -121
  37. zrb/builtin/generator/fastapp_crud/helper.py +115 -0
  38. zrb/builtin/generator/fastapp_crud/{add_navigation.py → task_factory.py} +5 -3
  39. zrb/builtin/generator/fastapp_field/add.py +8 -280
  40. zrb/builtin/generator/fastapp_field/helper.py +283 -0
  41. zrb/builtin/generator/fastapp_module/add.py +19 -328
  42. zrb/builtin/generator/fastapp_module/helper.py +326 -0
  43. zrb/builtin/generator/pip_package/add.py +8 -8
  44. zrb/builtin/generator/pip_package/template/_automate/snake_zrb_package_name/local.py +1 -1
  45. zrb/builtin/generator/project/create.py +10 -3
  46. zrb/builtin/generator/project/template/template.env +1 -1
  47. zrb/builtin/generator/project_task/task_factory.py +33 -21
  48. zrb/builtin/generator/project_task/template/_automate/_project/build_project_images.py +1 -1
  49. zrb/builtin/generator/project_task/template/_automate/_project/deploy_project.py +1 -1
  50. zrb/builtin/generator/project_task/template/_automate/_project/destroy_project.py +1 -1
  51. zrb/builtin/generator/project_task/template/_automate/_project/push_project_images.py +1 -1
  52. zrb/builtin/generator/project_task/template/_automate/_project/remove_project_containers.py +1 -1
  53. zrb/builtin/generator/project_task/template/_automate/_project/start_project.py +1 -1
  54. zrb/builtin/generator/project_task/template/_automate/_project/start_project_containers.py +1 -1
  55. zrb/builtin/generator/project_task/template/_automate/_project/stop_project_containers.py +1 -1
  56. zrb/builtin/generator/python_task/add.py +6 -6
  57. zrb/builtin/generator/python_task/template/_automate/snake_zrb_task_name.py +1 -1
  58. zrb/builtin/generator/simple_python_app/add.py +28 -30
  59. zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/container.py +1 -1
  60. zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/deployment.py +1 -1
  61. zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/image.py +1 -1
  62. zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/local.py +1 -1
  63. zrb/builtin/git.py +1 -1
  64. zrb/builtin/md5.py +1 -1
  65. zrb/builtin/project.py +1 -1
  66. zrb/builtin/ubuntu.py +3 -3
  67. zrb/config/config.py +8 -6
  68. zrb/helper/accessories/color.py +5 -1
  69. zrb/helper/accessories/icon.py +2 -0
  70. zrb/helper/accessories/name.py +2 -0
  71. zrb/helper/advertisement.py +1 -0
  72. zrb/helper/cli.py +5 -1
  73. zrb/helper/codemod/add_argument_to_function.py +3 -0
  74. zrb/helper/codemod/add_argument_to_function_call.py +3 -0
  75. zrb/helper/codemod/add_assert_resource.py +2 -0
  76. zrb/helper/codemod/add_function_call.py +2 -0
  77. zrb/helper/codemod/add_import_module.py +3 -0
  78. zrb/helper/codemod/add_key_value_to_dict.py +2 -0
  79. zrb/helper/codemod/add_property_to_class.py +3 -0
  80. zrb/helper/codemod/add_upstream_to_task.py +3 -0
  81. zrb/helper/codemod/append_code_to_function.py +3 -0
  82. zrb/helper/codemod/format_code.py +2 -0
  83. zrb/helper/default_env.py +2 -0
  84. zrb/helper/docker_compose/fetch_external_env.py +3 -0
  85. zrb/helper/docker_compose/file.py +4 -0
  86. zrb/helper/env_map/fetch.py +7 -0
  87. zrb/helper/file/text.py +4 -0
  88. zrb/helper/git/detect_changes.py +4 -0
  89. zrb/helper/loader/load_module.py +2 -0
  90. zrb/helper/map/conversion.py +2 -0
  91. zrb/helper/string/conversion.py +5 -0
  92. zrb/helper/string/double_quote.py +6 -2
  93. zrb/helper/string/jinja.py +2 -0
  94. zrb/helper/string/parse_replacement.py +2 -0
  95. zrb/helper/util.py +13 -0
  96. zrb/task/any_task.py +2 -2
  97. zrb/task/base_task.py +15 -15
  98. zrb/task/base_task_composite.py +3 -3
  99. zrb/task/cmd_task.py +2 -2
  100. zrb/task/decorator.py +2 -2
  101. zrb/task/docker_compose_task.py +2 -2
  102. zrb/task/flow_task.py +5 -5
  103. zrb/task/http_checker.py +2 -2
  104. zrb/task/path_checker.py +2 -2
  105. zrb/task/port_checker.py +2 -2
  106. zrb/task/resource_maker.py +3 -5
  107. zrb/task_input/any_input.py +23 -0
  108. zrb/task_input/base_input.py +46 -43
  109. zrb/task_input/float_input.py +0 -1
  110. {zrb-0.0.86.dist-info → zrb-0.0.88.dist-info}/METADATA +1 -1
  111. {zrb-0.0.86.dist-info → zrb-0.0.88.dist-info}/RECORD +118 -114
  112. zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/src/kebab-zrb-app-name/src/main.py +0 -20
  113. zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/src/kebab-zrb-app-name/src/requirements.txt +0 -1
  114. zrb/config.toml +0 -0
  115. /zrb/builtin/generator/{_common → common}/__init__.py +0 -0
  116. /zrb/builtin/generator/{_common → common}/task_input.py +0 -0
  117. /zrb/builtin/{_group.py → group.py} +0 -0
  118. /zrb/task_input/{_constant.py → constant.py} +0 -0
  119. {zrb-0.0.86.dist-info → zrb-0.0.88.dist-info}/LICENSE +0 -0
  120. {zrb-0.0.86.dist-info → zrb-0.0.88.dist-info}/WHEEL +0 -0
  121. {zrb-0.0.86.dist-info → zrb-0.0.88.dist-info}/entry_points.txt +0 -0
@@ -1,18 +1,18 @@
1
1
  from typing import Any
2
- from ..._group import project_add_group
3
- from ....task.decorator import python_task
4
- from ....task.task import Task
5
- from ....task.resource_maker import ResourceMaker
6
- from ....runner import runner
7
- from .._common.task_input import (
2
+ from ..common.task_input import (
8
3
  project_dir_input, package_name_input, package_description_input,
9
4
  package_homepage_input, package_bug_tracker_input,
10
5
  package_author_name_input, package_author_email_input
11
6
  )
12
- from .._common.helper import (
7
+ from ..common.helper import (
13
8
  validate_existing_project_dir, validate_inexisting_automation
14
9
  )
15
- from .._common.task_factory import create_register_module
10
+ from ..common.task_factory import create_register_module
11
+ from ...group import project_add_group
12
+ from ....task.decorator import python_task
13
+ from ....task.task import Task
14
+ from ....task.resource_maker import ResourceMaker
15
+ from ....runner import runner
16
16
 
17
17
  import os
18
18
 
@@ -1,5 +1,5 @@
1
1
  from zrb import CmdTask, runner, StrInput
2
- from zrb.builtin._group import project_group
2
+ from zrb.builtin.group import project_group
3
3
 
4
4
  import os
5
5
 
@@ -1,22 +1,28 @@
1
1
  from typing import Any, Mapping
2
- from ..._group import project_group
2
+ from typeguard import typechecked
3
+ from ..common.task_input import project_dir_input, project_name_input
4
+ from ..project_task.task_factory import create_ensure_project_tasks
5
+ from ...group import project_group
3
6
  from ....task.cmd_task import CmdTask
4
7
  from ....task.decorator import python_task
5
8
  from ....task.resource_maker import ResourceMaker
6
9
  from ....runner import runner
7
10
  from ....config.config import version
8
- from .._common.task_input import project_dir_input, project_name_input
9
- from ..project_task.task_factory import create_ensure_project_tasks
10
11
 
11
12
  import os
12
13
 
13
14
  CURRENT_DIR = os.path.dirname(__file__)
15
+ SYSTEM_USER = os.getenv('USER', 'incognito')
16
+ IMAGE_DEFAULT_NAMESPACE = os.getenv(
17
+ 'PROJECT_IMAGE_DEFAULT_NAMESPACE', 'docker.io/' + SYSTEM_USER
18
+ )
14
19
 
15
20
  ###############################################################################
16
21
  # Replacement Mutator Definitions
17
22
  ###############################################################################
18
23
 
19
24
 
25
+ @typechecked
20
26
  def copy_resource_replacement_mutator(
21
27
  task: ResourceMaker, replacements: Mapping[str, str]
22
28
  ) -> Mapping[str, str]:
@@ -56,6 +62,7 @@ copy_resource = ResourceMaker(
56
62
  replacements={
57
63
  'zrbProjectDir': '{{input.project_dir}}',
58
64
  'zrbProjectName': '{{input.project_name}}',
65
+ 'zrbImageDefaultNamespace': IMAGE_DEFAULT_NAMESPACE,
59
66
  'zrbVersion': version,
60
67
  },
61
68
  replacement_mutator=copy_resource_replacement_mutator,
@@ -1,3 +1,3 @@
1
- export PROJECT_IMAGE_DEFAULT_NAMESPACE=
1
+ export PROJECT_IMAGE_DEFAULT_NAMESPACE=zrbImageDefaultNamespace
2
2
  export PROJECT_USE_VENV=1
3
3
  export PROJECT_AUTO_INSTALL_PIP=1
@@ -1,9 +1,11 @@
1
1
  from typing import Any, List, Optional
2
- from .._common.task_input import project_dir_input
3
- from .._common.task_factory import create_add_upstream
2
+ from typeguard import typechecked
3
+ from ..common.task_input import project_dir_input
4
+ from ..common.task_factory import create_add_upstream
4
5
  from ....task.decorator import python_task
6
+ from ....task.any_task import AnyTask
5
7
  from ....task.task import Task
6
- from ....task_input.task_input import Input
8
+ from ....task_input.any_input import AnyInput
7
9
  from ....helper.codemod.add_import_module import add_import_module
8
10
  from ....helper.codemod.add_assert_resource import add_assert_resource
9
11
  from ....helper.file.copy_tree import copy_tree
@@ -13,8 +15,9 @@ import os
13
15
  CURRENT_DIR = os.path.dirname(__file__)
14
16
 
15
17
 
18
+ @typechecked
16
19
  def create_ensure_project_tasks(
17
- upstreams: Optional[List[Task]] = None
20
+ upstreams: Optional[List[AnyTask]] = None
18
21
  ) -> Task:
19
22
  '''
20
23
  Create a task to ensure there are project tasks under `_automate/_project`
@@ -48,11 +51,12 @@ def create_ensure_project_tasks(
48
51
  return _task
49
52
 
50
53
 
54
+ @typechecked
51
55
  def create_add_build_images_upstream(
52
56
  upstream_module: str,
53
57
  upstream_task_var: str,
54
- inputs: Optional[List[Input]] = None,
55
- upstreams: Optional[List[Task]] = None
58
+ inputs: Optional[List[AnyInput]] = None,
59
+ upstreams: Optional[List[AnyTask]] = None
56
60
  ) -> Task:
57
61
  return create_add_upstream(
58
62
  task_file_name=_get_project_task_file('build_project_images.py'),
@@ -64,11 +68,12 @@ def create_add_build_images_upstream(
64
68
  )
65
69
 
66
70
 
71
+ @typechecked
67
72
  def create_add_deploy_upstream(
68
73
  upstream_module: str,
69
74
  upstream_task_var: str,
70
- inputs: Optional[List[Input]] = None,
71
- upstreams: Optional[List[Task]] = None
75
+ inputs: Optional[List[AnyInput]] = None,
76
+ upstreams: Optional[List[AnyTask]] = None
72
77
  ) -> Task:
73
78
  return create_add_upstream(
74
79
  task_file_name=_get_project_task_file('deploy_project.py'),
@@ -80,11 +85,12 @@ def create_add_deploy_upstream(
80
85
  )
81
86
 
82
87
 
88
+ @typechecked
83
89
  def create_add_destroy_upstream(
84
90
  upstream_module: str,
85
91
  upstream_task_var: str,
86
- inputs: Optional[List[Input]] = None,
87
- upstreams: Optional[List[Task]] = None
92
+ inputs: Optional[List[AnyInput]] = None,
93
+ upstreams: Optional[List[AnyTask]] = None
88
94
  ) -> Task:
89
95
  return create_add_upstream(
90
96
  task_file_name=_get_project_task_file('destroy_project.py'),
@@ -96,11 +102,12 @@ def create_add_destroy_upstream(
96
102
  )
97
103
 
98
104
 
105
+ @typechecked
99
106
  def create_add_push_images_upstream(
100
107
  upstream_module: str,
101
108
  upstream_task_var: str,
102
- inputs: Optional[List[Input]] = None,
103
- upstreams: Optional[List[Task]] = None
109
+ inputs: Optional[List[AnyInput]] = None,
110
+ upstreams: Optional[List[AnyTask]] = None
104
111
  ) -> Task:
105
112
  return create_add_upstream(
106
113
  task_file_name=_get_project_task_file('push_project_images.py'),
@@ -112,11 +119,12 @@ def create_add_push_images_upstream(
112
119
  )
113
120
 
114
121
 
122
+ @typechecked
115
123
  def create_add_remove_containers_upstream(
116
124
  upstream_module: str,
117
125
  upstream_task_var: str,
118
- inputs: Optional[List[Input]] = None,
119
- upstreams: Optional[List[Task]] = None
126
+ inputs: Optional[List[AnyInput]] = None,
127
+ upstreams: Optional[List[AnyTask]] = None
120
128
  ) -> Task:
121
129
  return create_add_upstream(
122
130
  task_file_name=_get_project_task_file('remove_project_containers.py'),
@@ -128,11 +136,12 @@ def create_add_remove_containers_upstream(
128
136
  )
129
137
 
130
138
 
139
+ @typechecked
131
140
  def create_add_start_containers_upstream(
132
141
  upstream_module: str,
133
142
  upstream_task_var: str,
134
- inputs: Optional[List[Input]] = None,
135
- upstreams: Optional[List[Task]] = None
143
+ inputs: Optional[List[AnyInput]] = None,
144
+ upstreams: Optional[List[AnyTask]] = None
136
145
  ) -> Task:
137
146
  return create_add_upstream(
138
147
  task_file_name=_get_project_task_file('start_project_containers.py'),
@@ -144,11 +153,12 @@ def create_add_start_containers_upstream(
144
153
  )
145
154
 
146
155
 
156
+ @typechecked
147
157
  def create_add_start_upstream(
148
158
  upstream_module: str,
149
159
  upstream_task_var: str,
150
- inputs: Optional[List[Input]] = None,
151
- upstreams: Optional[List[Task]] = None
160
+ inputs: Optional[List[AnyInput]] = None,
161
+ upstreams: Optional[List[AnyTask]] = None
152
162
  ) -> Task:
153
163
  return create_add_upstream(
154
164
  task_file_name=_get_project_task_file('start_project.py'),
@@ -160,11 +170,12 @@ def create_add_start_upstream(
160
170
  )
161
171
 
162
172
 
173
+ @typechecked
163
174
  def create_add_stop_containers_upstream(
164
175
  upstream_module: str,
165
176
  upstream_task_var: str,
166
- inputs: Optional[List[Input]] = None,
167
- upstreams: Optional[List[Task]] = None
177
+ inputs: Optional[List[AnyInput]] = None,
178
+ upstreams: Optional[List[AnyTask]] = None
168
179
  ) -> Task:
169
180
  return create_add_upstream(
170
181
  task_file_name=_get_project_task_file('stop_project_containers.py'),
@@ -176,5 +187,6 @@ def create_add_stop_containers_upstream(
176
187
  )
177
188
 
178
189
 
179
- def _get_project_task_file(task_file_name: str):
190
+ @typechecked
191
+ def _get_project_task_file(task_file_name: str) -> str:
180
192
  return os.path.join('_automate', '_project', task_file_name)
@@ -1,4 +1,4 @@
1
- from zrb.builtin._group import project_group
1
+ from zrb.builtin.group import project_group
2
2
  from zrb import Task, runner
3
3
 
4
4
  build_project_images = Task(
@@ -1,4 +1,4 @@
1
- from zrb.builtin._group import project_group
1
+ from zrb.builtin.group import project_group
2
2
  from zrb import Task, runner
3
3
 
4
4
  deploy_project = Task(
@@ -1,4 +1,4 @@
1
- from zrb.builtin._group import project_group
1
+ from zrb.builtin.group import project_group
2
2
  from zrb import Task, runner
3
3
 
4
4
  destroy_project = Task(
@@ -1,4 +1,4 @@
1
- from zrb.builtin._group import project_group
1
+ from zrb.builtin.group import project_group
2
2
  from zrb import Task, runner
3
3
 
4
4
  push_project_images = Task(
@@ -1,4 +1,4 @@
1
- from zrb.builtin._group import project_group
1
+ from zrb.builtin.group import project_group
2
2
  from zrb import Task, runner
3
3
 
4
4
  remove_project_containers = Task(
@@ -1,4 +1,4 @@
1
- from zrb.builtin._group import project_group
1
+ from zrb.builtin.group import project_group
2
2
  from zrb import Task, runner
3
3
 
4
4
  start_project = Task(
@@ -1,4 +1,4 @@
1
- from zrb.builtin._group import project_group
1
+ from zrb.builtin.group import project_group
2
2
  from zrb import Task, runner
3
3
 
4
4
  start_project_containers = Task(
@@ -1,4 +1,4 @@
1
- from zrb.builtin._group import project_group
1
+ from zrb.builtin.group import project_group
2
2
  from zrb import Task, runner
3
3
 
4
4
  stop_project_containers = Task(
@@ -1,14 +1,14 @@
1
1
  from typing import Any
2
- from ..._group import project_add_group
2
+ from ..common.task_input import project_dir_input, task_name_input
3
+ from ..common.helper import (
4
+ validate_existing_project_dir, validate_inexisting_automation
5
+ )
6
+ from ..common.task_factory import create_register_module
3
7
  from ....task.decorator import python_task
4
8
  from ....task.task import Task
5
9
  from ....task.resource_maker import ResourceMaker
6
10
  from ....runner import runner
7
- from .._common.task_input import project_dir_input, task_name_input
8
- from .._common.helper import (
9
- validate_existing_project_dir, validate_inexisting_automation
10
- )
11
- from .._common.task_factory import create_register_module
11
+ from ...group import project_add_group
12
12
 
13
13
  import os
14
14
 
@@ -1,6 +1,6 @@
1
1
  from typing import Any, Mapping
2
2
  from zrb import Task, python_task, runner
3
- from zrb.builtin._group import project_group
3
+ from zrb.builtin.group import project_group
4
4
 
5
5
  ###############################################################################
6
6
  # Task Definitions
@@ -1,17 +1,12 @@
1
1
  from typing import Any
2
- from ..._group import project_add_group
3
- from ....task.task import Task
4
- from ....task.decorator import python_task
5
- from ....task.resource_maker import ResourceMaker
6
- from ....runner import runner
7
- from .._common.task_input import (
2
+ from ..common.helper import (
3
+ validate_existing_project_dir, validate_inexisting_automation
4
+ )
5
+ from ..common.task_input import (
8
6
  project_dir_input, app_name_input, app_image_name_input, http_port_input,
9
7
  env_prefix_input
10
8
  )
11
- from .._common.helper import (
12
- validate_existing_project_dir, validate_inexisting_automation
13
- )
14
- from .._common.task_factory import create_register_module
9
+ from ..common.task_factory import create_register_module
15
10
  from ..project_task.task_factory import (
16
11
  create_ensure_project_tasks, create_add_build_images_upstream,
17
12
  create_add_deploy_upstream, create_add_destroy_upstream,
@@ -19,7 +14,12 @@ from ..project_task.task_factory import (
19
14
  create_add_start_containers_upstream, create_add_start_upstream,
20
15
  create_add_stop_containers_upstream
21
16
  )
22
- from ....helper import util
17
+ from ...group import project_add_group
18
+ from ....task.task import Task
19
+ from ....task.decorator import python_task
20
+ from ....task.resource_maker import ResourceMaker
21
+ from ....runner import runner
22
+ from ....helper.util import to_kebab_case
23
23
 
24
24
  import os
25
25
 
@@ -40,9 +40,7 @@ async def validate(*args: Any, **kwargs: Any):
40
40
  validate_existing_project_dir(project_dir)
41
41
  app_name = kwargs.get('app_name')
42
42
  validate_inexisting_automation(project_dir, app_name)
43
- source_dir = os.path.join(
44
- project_dir, 'src', f'{util.to_kebab_case(app_name)}'
45
- )
43
+ source_dir = os.path.join(project_dir, 'src', f'{to_kebab_case(app_name)}')
46
44
  if os.path.exists(source_dir):
47
45
  raise Exception(f'Source already exists: {source_dir}')
48
46
 
@@ -103,56 +101,56 @@ ensure_project_tasks = create_ensure_project_tasks(
103
101
  upstreams=[copy_resource]
104
102
  )
105
103
 
106
- add_start = create_add_start_upstream(
104
+ add_start_upstream = create_add_start_upstream(
107
105
  upstream_module=f'_automate.{SNAKE_APP_NAME_TPL}.local',
108
106
  upstream_task_var=f'start_{SNAKE_APP_NAME_TPL}',
109
107
  upstreams=[ensure_project_tasks],
110
108
  inputs=[app_name_input]
111
109
  )
112
110
 
113
- add_start_container = create_add_start_containers_upstream(
111
+ add_start_container_upstream = create_add_start_containers_upstream(
114
112
  upstream_module=f'_automate.{SNAKE_APP_NAME_TPL}.container',
115
113
  upstream_task_var=f'start_{SNAKE_APP_NAME_TPL}_container',
116
114
  upstreams=[ensure_project_tasks],
117
115
  inputs=[app_name_input]
118
116
  )
119
117
 
120
- add_stop_container = create_add_stop_containers_upstream(
118
+ add_stop_container_upstream = create_add_stop_containers_upstream(
121
119
  upstream_module=f'_automate.{SNAKE_APP_NAME_TPL}.container',
122
120
  upstream_task_var=f'stop_{SNAKE_APP_NAME_TPL}_container',
123
121
  upstreams=[ensure_project_tasks],
124
122
  inputs=[app_name_input]
125
123
  )
126
124
 
127
- add_remove_container = create_add_remove_containers_upstream(
125
+ add_remove_container_upstream = create_add_remove_containers_upstream(
128
126
  upstream_module=f'_automate.{SNAKE_APP_NAME_TPL}.container',
129
127
  upstream_task_var=f'remove_{SNAKE_APP_NAME_TPL}_container',
130
128
  upstreams=[ensure_project_tasks],
131
129
  inputs=[app_name_input]
132
130
  )
133
131
 
134
- add_build_image = create_add_build_images_upstream(
132
+ add_build_image_upstream = create_add_build_images_upstream(
135
133
  upstream_module=f'_automate.{SNAKE_APP_NAME_TPL}.image',
136
134
  upstream_task_var=f'build_{SNAKE_APP_NAME_TPL}_image',
137
135
  upstreams=[ensure_project_tasks],
138
136
  inputs=[app_name_input]
139
137
  )
140
138
 
141
- add_push_image = create_add_push_images_upstream(
139
+ add_push_image_upstream = create_add_push_images_upstream(
142
140
  upstream_module=f'_automate.{SNAKE_APP_NAME_TPL}.image',
143
141
  upstream_task_var=f'push_{SNAKE_APP_NAME_TPL}_image',
144
142
  upstreams=[ensure_project_tasks],
145
143
  inputs=[app_name_input]
146
144
  )
147
145
 
148
- add_deploy = create_add_deploy_upstream(
146
+ add_deploy_upstream = create_add_deploy_upstream(
149
147
  upstream_module=f'_automate.{SNAKE_APP_NAME_TPL}.deployment',
150
148
  upstream_task_var=f'deploy_{SNAKE_APP_NAME_TPL}',
151
149
  upstreams=[ensure_project_tasks],
152
150
  inputs=[app_name_input]
153
151
  )
154
152
 
155
- add_destroy = create_add_destroy_upstream(
153
+ add_destroy_upstream = create_add_destroy_upstream(
156
154
  upstream_module=f'_automate.{SNAKE_APP_NAME_TPL}.deployment',
157
155
  upstream_task_var=f'destroy_{SNAKE_APP_NAME_TPL}',
158
156
  upstreams=[ensure_project_tasks],
@@ -168,14 +166,14 @@ add_destroy = create_add_destroy_upstream(
168
166
  register_container_module,
169
167
  register_image_module,
170
168
  register_deployment_module,
171
- add_start,
172
- add_start_container,
173
- add_stop_container,
174
- add_remove_container,
175
- add_build_image,
176
- add_push_image,
177
- add_deploy,
178
- add_destroy
169
+ add_start_upstream,
170
+ add_start_container_upstream,
171
+ add_stop_container_upstream,
172
+ add_remove_container_upstream,
173
+ add_build_image_upstream,
174
+ add_push_image_upstream,
175
+ add_deploy_upstream,
176
+ add_destroy_upstream
179
177
  ],
180
178
  runner=runner
181
179
  )
@@ -1,7 +1,7 @@
1
1
  from zrb import (
2
2
  DockerComposeTask, Env, EnvFile, HTTPChecker, ServiceConfig, runner
3
3
  )
4
- from zrb.builtin._group import project_group
4
+ from zrb.builtin.group import project_group
5
5
  from ._common import (
6
6
  RESOURCE_DIR, APP_DIR, local_input, host_input, https_input
7
7
  )
@@ -1,5 +1,5 @@
1
1
  from zrb import CmdTask, Env, EnvFile, IntInput, StrInput, ChoiceInput, runner
2
- from zrb.builtin._group import project_group
2
+ from zrb.builtin.group import project_group
3
3
  from .image import push_snake_zrb_app_name_image, image_input, image_env
4
4
  from ._common import (
5
5
  CURRENT_DIR, DEPLOYMENT_DIR, TEMPLATE_ENV_FILE_NAME
@@ -1,5 +1,5 @@
1
1
  from zrb import DockerComposeTask, Env, StrInput, runner
2
- from zrb.builtin._group import project_group
2
+ from zrb.builtin.group import project_group
3
3
  from ._common import (
4
4
  RESOURCE_DIR, local_input
5
5
  )
@@ -1,5 +1,5 @@
1
1
  from zrb import CmdTask, Env, EnvFile, HTTPChecker, runner
2
- from zrb.builtin._group import project_group
2
+ from zrb.builtin.group import project_group
3
3
  from ._common import (
4
4
  CURRENT_DIR, APP_DIR, TEMPLATE_ENV_FILE_NAME,
5
5
  local_input, host_input, https_input
zrb/builtin/git.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from typing import Any
2
- from ._group import git_group
2
+ from .group import git_group
3
3
  from ..task.decorator import python_task
4
4
  from ..task.task import Task
5
5
  from ..task_input.str_input import StrInput
zrb/builtin/md5.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from typing import Any
2
- from ._group import md5_group
2
+ from .group import md5_group
3
3
  from ..task.decorator import python_task
4
4
  from ..task_input.str_input import StrInput
5
5
  from ..runner import runner
zrb/builtin/project.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from typing import Any, Mapping
2
- from ._group import project_group
2
+ from .group import project_group
3
3
  from ..task.decorator import python_task
4
4
  from ..task_input.bool_input import BoolInput
5
5
  from ..runner import runner
zrb/builtin/ubuntu.py CHANGED
@@ -1,4 +1,4 @@
1
- from ._group import ubuntu_group, ubuntu_install_group
1
+ from .group import ubuntu_group, ubuntu_install_group
2
2
  from ..task.cmd_task import CmdTask
3
3
  from ..runner import runner
4
4
 
@@ -43,8 +43,8 @@ install_packages = CmdTask(
43
43
  'libbz2-dev libreadline-dev libsqlite3-dev libpq-dev python3-dev \\',
44
44
  'llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev \\',
45
45
  'liblzma-dev python3-openssl bison libblas-dev liblapack-dev \\',
46
- 'gfortran rustc fd-find ripgrep wget curl git ncat cmake make tree \\',
47
- 'tmux zsh neovim xdotool xsel'
46
+ 'golang gfortran rustc fd-find ripgrep wget curl git ncat \\',
47
+ 'cmake make tree tmux zsh neovim xdotool xsel'
48
48
  ],
49
49
  upstreams=[update_task],
50
50
  checking_interval=3,
zrb/config/config.py CHANGED
@@ -1,18 +1,20 @@
1
1
  from ..helper.string.conversion import to_boolean, to_logging_level
2
+ from typeguard import typechecked
2
3
  import os
3
- import pkg_resources
4
+ import importlib.metadata as metadata
4
5
 
5
6
 
6
- def get_version():
7
+ @typechecked
8
+ def get_version() -> str:
7
9
  try:
8
- dist = pkg_resources.get_distribution("zrb")
9
- return dist.version
10
- except pkg_resources.DistributionNotFound:
10
+ return metadata.version("zrb")
11
+ except metadata.PackageNotFoundError:
11
12
  import flit
12
13
  meta = flit.read_module_metadata("zrb")
13
- return meta["module"]["version"]
14
+ return str(meta["module"]["version"])
14
15
 
15
16
 
17
+ @typechecked
16
18
  def get_current_shell() -> str:
17
19
  current_shell = os.getenv('SHELL', '')
18
20
  if current_shell.endswith('zsh'):
@@ -1,9 +1,11 @@
1
1
  from typing import Iterable, Optional
2
+ from typeguard import typechecked
2
3
  from termcolor import colored as term_colored, COLORS
3
4
  import random
4
5
 
5
6
 
6
- def get_random_color():
7
+ @typechecked
8
+ def get_random_color() -> str:
7
9
  colors = [
8
10
  'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'light_green',
9
11
  'light_yellow', 'light_blue', 'light_magenta', 'light_cyan',
@@ -11,10 +13,12 @@ def get_random_color():
11
13
  return random.choice(colors)
12
14
 
13
15
 
16
+ @typechecked
14
17
  def is_valid_color(color: str) -> bool:
15
18
  return color in COLORS
16
19
 
17
20
 
21
+ @typechecked
18
22
  def colored(
19
23
  text: str,
20
24
  color: Optional[str] = None,
@@ -1,6 +1,8 @@
1
+ from typeguard import typechecked
1
2
  import random
2
3
 
3
4
 
5
+ @typechecked
4
6
  def get_random_icon() -> str:
5
7
  icons = [
6
8
  '🐶', '🐱', '🐭', '🐹', '🦊', '🐻', '🐨', '🐯', '🦁', '🐮', '🐷', '🍎', '🍐',
@@ -1,7 +1,9 @@
1
+ from typeguard import typechecked
1
2
  import random
2
3
  import string
3
4
 
4
5
 
6
+ @typechecked
5
7
  def get_random_name(
6
8
  separator: str = '-',
7
9
  add_random_digit: bool = True,
@@ -18,6 +18,7 @@ class Advertisement():
18
18
  print(colored(self.content, attrs=['dark']), file=sys.stderr)
19
19
 
20
20
 
21
+ @typechecked
21
22
  def get_advertisement(
22
23
  advertisements: Iterable[Advertisement]
23
24
  ) -> Optional[Advertisement]:
zrb/helper/cli.py CHANGED
@@ -1,6 +1,7 @@
1
+ from typeguard import typechecked
1
2
  from ..runner import runner
2
- from .loader.load_module import load_module
3
3
  from ..config.config import init_scripts, should_load_builtin
4
+ from .loader.load_module import load_module
4
5
  from .log import logger
5
6
  from .accessories.color import colored
6
7
 
@@ -9,6 +10,7 @@ import os
9
10
  import sys
10
11
 
11
12
 
13
+ @typechecked
12
14
  def create_cli() -> click.Group:
13
15
  cli = click.Group(name='zrb', help='Super framework for your super app.')
14
16
  # load from ZRB_INIT_SCRIPTS environment
@@ -31,6 +33,7 @@ def create_cli() -> click.Group:
31
33
  return cli
32
34
 
33
35
 
36
+ @typechecked
34
37
  def _load_zrb_init(project_dir: str):
35
38
  project_script = os.path.join(project_dir, 'zrb_init.py')
36
39
  if not os.path.isfile(project_script):
@@ -43,6 +46,7 @@ def _load_zrb_init(project_dir: str):
43
46
  load_module(script_path=project_script)
44
47
 
45
48
 
49
+ @typechecked
46
50
  def _get_new_python_path(project_dir: str) -> str:
47
51
  current_python_path = os.getenv('PYTHONPATH')
48
52
  if current_python_path is None or current_python_path == '':