zrb 0.0.86__py3-none-any.whl → 0.0.87__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.
- zrb/__init__.py +3 -1
- zrb/action/runner.py +7 -3
- zrb/builtin/__init__.py +1 -1
- zrb/builtin/base64.py +1 -1
- zrb/builtin/devtool/devtool_install.py +3 -1
- zrb/builtin/env.py +6 -3
- zrb/builtin/explain.py +3 -1
- zrb/builtin/generator/__init__.py +4 -8
- zrb/builtin/generator/app_generator/add.py +6 -6
- zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/add.py +60 -50
- zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/container.py +1 -1
- zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/deployment.py +2 -2
- zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/image.py +1 -1
- zrb/builtin/generator/app_generator/template/_automate/snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/local.py +4 -2
- zrb/builtin/generator/cmd_task/add.py +6 -6
- zrb/builtin/generator/cmd_task/template/_automate/snake_zrb_task_name.py +1 -1
- zrb/builtin/generator/{_common → common}/helper.py +6 -0
- zrb/builtin/generator/{_common → common}/task_factory.py +9 -5
- zrb/builtin/generator/docker_compose_task/add.py +8 -8
- zrb/builtin/generator/docker_compose_task/template/_automate/snake_zrb_task_name.py +1 -1
- zrb/builtin/generator/fastapp/add.py +24 -24
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_common.py +2 -1
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/container.py +1 -1
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/deployment.py +1 -1
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/frontend.py +1 -1
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/image.py +1 -1
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/load_test.py +3 -2
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/local.py +1 -1
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/test.py +2 -4
- zrb/builtin/generator/fastapp_crud/add.py +8 -121
- zrb/builtin/generator/fastapp_crud/helper.py +115 -0
- zrb/builtin/generator/fastapp_crud/{add_navigation.py → task_factory.py} +5 -3
- zrb/builtin/generator/fastapp_field/add.py +8 -280
- zrb/builtin/generator/fastapp_field/helper.py +283 -0
- zrb/builtin/generator/fastapp_module/add.py +19 -328
- zrb/builtin/generator/fastapp_module/helper.py +326 -0
- zrb/builtin/generator/pip_package/add.py +8 -8
- zrb/builtin/generator/pip_package/template/_automate/snake_zrb_package_name/local.py +1 -1
- zrb/builtin/generator/project/create.py +5 -3
- zrb/builtin/generator/project_task/task_factory.py +33 -21
- zrb/builtin/generator/project_task/template/_automate/_project/build_project_images.py +1 -1
- zrb/builtin/generator/project_task/template/_automate/_project/deploy_project.py +1 -1
- zrb/builtin/generator/project_task/template/_automate/_project/destroy_project.py +1 -1
- zrb/builtin/generator/project_task/template/_automate/_project/push_project_images.py +1 -1
- zrb/builtin/generator/project_task/template/_automate/_project/remove_project_containers.py +1 -1
- zrb/builtin/generator/project_task/template/_automate/_project/start_project.py +1 -1
- zrb/builtin/generator/project_task/template/_automate/_project/start_project_containers.py +1 -1
- zrb/builtin/generator/project_task/template/_automate/_project/stop_project_containers.py +1 -1
- zrb/builtin/generator/python_task/add.py +6 -6
- zrb/builtin/generator/python_task/template/_automate/snake_zrb_task_name.py +1 -1
- zrb/builtin/generator/simple_python_app/add.py +28 -30
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/container.py +1 -1
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/deployment.py +1 -1
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/image.py +1 -1
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/local.py +1 -1
- zrb/builtin/git.py +1 -1
- zrb/builtin/md5.py +1 -1
- zrb/builtin/project.py +1 -1
- zrb/builtin/ubuntu.py +1 -1
- zrb/config/config.py +8 -6
- zrb/helper/accessories/color.py +5 -1
- zrb/helper/accessories/icon.py +2 -0
- zrb/helper/accessories/name.py +2 -0
- zrb/helper/advertisement.py +1 -0
- zrb/helper/cli.py +5 -1
- zrb/helper/codemod/add_argument_to_function.py +3 -0
- zrb/helper/codemod/add_argument_to_function_call.py +3 -0
- zrb/helper/codemod/add_assert_resource.py +2 -0
- zrb/helper/codemod/add_function_call.py +2 -0
- zrb/helper/codemod/add_import_module.py +3 -0
- zrb/helper/codemod/add_key_value_to_dict.py +2 -0
- zrb/helper/codemod/add_property_to_class.py +3 -0
- zrb/helper/codemod/add_upstream_to_task.py +3 -0
- zrb/helper/codemod/append_code_to_function.py +3 -0
- zrb/helper/codemod/format_code.py +2 -0
- zrb/helper/default_env.py +2 -0
- zrb/helper/docker_compose/fetch_external_env.py +3 -0
- zrb/helper/docker_compose/file.py +4 -0
- zrb/helper/env_map/fetch.py +7 -0
- zrb/helper/file/text.py +4 -0
- zrb/helper/git/detect_changes.py +4 -0
- zrb/helper/loader/load_module.py +2 -0
- zrb/helper/map/conversion.py +2 -0
- zrb/helper/string/conversion.py +5 -0
- zrb/helper/string/double_quote.py +6 -2
- zrb/helper/string/jinja.py +2 -0
- zrb/helper/string/parse_replacement.py +2 -0
- zrb/helper/util.py +13 -0
- zrb/task/any_task.py +2 -2
- zrb/task/base_task.py +15 -15
- zrb/task/base_task_composite.py +3 -3
- zrb/task/cmd_task.py +2 -2
- zrb/task/decorator.py +2 -2
- zrb/task/docker_compose_task.py +2 -2
- zrb/task/flow_task.py +5 -5
- zrb/task/http_checker.py +2 -2
- zrb/task/path_checker.py +2 -2
- zrb/task/port_checker.py +2 -2
- zrb/task/resource_maker.py +3 -5
- zrb/task_input/any_input.py +23 -0
- zrb/task_input/base_input.py +46 -43
- zrb/task_input/float_input.py +0 -1
- {zrb-0.0.86.dist-info → zrb-0.0.87.dist-info}/METADATA +1 -1
- {zrb-0.0.86.dist-info → zrb-0.0.87.dist-info}/RECORD +111 -108
- zrb/config.toml +0 -0
- /zrb/builtin/generator/{_common → common}/__init__.py +0 -0
- /zrb/builtin/generator/{_common → common}/task_input.py +0 -0
- /zrb/builtin/{_group.py → group.py} +0 -0
- /zrb/task_input/{_constant.py → constant.py} +0 -0
- {zrb-0.0.86.dist-info → zrb-0.0.87.dist-info}/LICENSE +0 -0
- {zrb-0.0.86.dist-info → zrb-0.0.87.dist-info}/WHEEL +0 -0
- {zrb-0.0.86.dist-info → zrb-0.0.87.dist-info}/entry_points.txt +0 -0
@@ -1,18 +1,18 @@
|
|
1
1
|
from typing import Any
|
2
|
-
from
|
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 ..
|
7
|
+
from ..common.helper import (
|
13
8
|
validate_existing_project_dir, validate_inexisting_automation
|
14
9
|
)
|
15
|
-
from ..
|
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,12 +1,13 @@
|
|
1
1
|
from typing import Any, Mapping
|
2
|
-
from
|
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
|
|
@@ -17,6 +18,7 @@ CURRENT_DIR = os.path.dirname(__file__)
|
|
17
18
|
###############################################################################
|
18
19
|
|
19
20
|
|
21
|
+
@typechecked
|
20
22
|
def copy_resource_replacement_mutator(
|
21
23
|
task: ResourceMaker, replacements: Mapping[str, str]
|
22
24
|
) -> Mapping[str, str]:
|
@@ -1,9 +1,11 @@
|
|
1
1
|
from typing import Any, List, Optional
|
2
|
-
from
|
3
|
-
from ..
|
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.
|
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[
|
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[
|
55
|
-
upstreams: Optional[List[
|
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[
|
71
|
-
upstreams: Optional[List[
|
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[
|
87
|
-
upstreams: Optional[List[
|
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[
|
103
|
-
upstreams: Optional[List[
|
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[
|
119
|
-
upstreams: Optional[List[
|
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[
|
135
|
-
upstreams: Optional[List[
|
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[
|
151
|
-
upstreams: Optional[List[
|
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[
|
167
|
-
upstreams: Optional[List[
|
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
|
-
|
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,14 +1,14 @@
|
|
1
1
|
from typing import Any
|
2
|
-
from
|
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
|
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.
|
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
|
3
|
-
|
4
|
-
|
5
|
-
from
|
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 ..
|
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
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
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.
|
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.
|
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
|
zrb/builtin/git.py
CHANGED
zrb/builtin/md5.py
CHANGED
zrb/builtin/project.py
CHANGED
zrb/builtin/ubuntu.py
CHANGED
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
|
4
|
+
import importlib.metadata as metadata
|
4
5
|
|
5
6
|
|
6
|
-
|
7
|
+
@typechecked
|
8
|
+
def get_version() -> str:
|
7
9
|
try:
|
8
|
-
|
9
|
-
|
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'):
|
zrb/helper/accessories/color.py
CHANGED
@@ -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
|
-
|
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,
|
zrb/helper/accessories/icon.py
CHANGED
zrb/helper/accessories/name.py
CHANGED
zrb/helper/advertisement.py
CHANGED
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 == '':
|
@@ -1,6 +1,8 @@
|
|
1
|
+
from typeguard import typechecked
|
1
2
|
import libcst as cst
|
2
3
|
|
3
4
|
|
5
|
+
@typechecked
|
4
6
|
class AddArgumentTransformer(cst.CSTTransformer):
|
5
7
|
def __init__(
|
6
8
|
self, function_name: str, argument_name: str, argument_type: str
|
@@ -26,6 +28,7 @@ class AddArgumentTransformer(cst.CSTTransformer):
|
|
26
28
|
return updated_node
|
27
29
|
|
28
30
|
|
31
|
+
@typechecked
|
29
32
|
def add_argument_to_function(
|
30
33
|
code: str, function_name: str, argument_name: str, argument_type: str
|
31
34
|
) -> str:
|
@@ -1,6 +1,8 @@
|
|
1
|
+
from typeguard import typechecked
|
1
2
|
import libcst as cst
|
2
3
|
|
3
4
|
|
5
|
+
@typechecked
|
4
6
|
class AddArgumentTransformer(cst.CSTTransformer):
|
5
7
|
def __init__(self, function_name: str, argument_name: str):
|
6
8
|
self.function_name = function_name
|
@@ -21,6 +23,7 @@ class AddArgumentTransformer(cst.CSTTransformer):
|
|
21
23
|
return updated_node
|
22
24
|
|
23
25
|
|
26
|
+
@typechecked
|
24
27
|
def add_argument_to_function_call(
|
25
28
|
code: str, function_name: str, argument_name: str
|
26
29
|
) -> str:
|