zrb 0.6.0__py3-none-any.whl → 0.6.1__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 (316) hide show
  1. zrb/__init__.py +24 -20
  2. zrb/__main__.py +5 -5
  3. zrb/action/runner.py +22 -30
  4. zrb/advertisement.py +10 -9
  5. zrb/builtin/__init__.py +18 -16
  6. zrb/builtin/base64.py +13 -18
  7. zrb/builtin/devtool/__init__.py +14 -3
  8. zrb/builtin/devtool/devtool_install.py +207 -221
  9. zrb/builtin/env.py +9 -12
  10. zrb/builtin/eval.py +9 -9
  11. zrb/builtin/explain.py +73 -74
  12. zrb/builtin/generator/__init__.py +7 -11
  13. zrb/builtin/generator/app_generator/add.py +86 -87
  14. zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/add.py +78 -77
  15. zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/_checker.py +6 -6
  16. zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/_common.py +14 -15
  17. zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/container.py +32 -32
  18. zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/deployment.py +29 -30
  19. zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/image.py +1 -3
  20. zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/local.py +5 -4
  21. zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/src/kebab-zrb-app-name/deployment/__main__.py +24 -32
  22. zrb/builtin/generator/app_generator/template/build-custom-image/_automate/generate_snake_zrb_meta_template_name/add.py +89 -87
  23. zrb/builtin/generator/app_generator/template/build-custom-image/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/_common.py +14 -15
  24. zrb/builtin/generator/app_generator/template/build-custom-image/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/container.py +42 -54
  25. zrb/builtin/generator/app_generator/template/build-custom-image/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/deployment.py +34 -32
  26. zrb/builtin/generator/app_generator/template/build-custom-image/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/image.py +19 -22
  27. zrb/builtin/generator/app_generator/template/build-custom-image/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/local.py +18 -18
  28. zrb/builtin/generator/app_generator/template/http-port/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/_checker.py +10 -10
  29. zrb/builtin/generator/app_generator/template/http-port-build-custom-image/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/local.py +19 -19
  30. zrb/builtin/generator/app_generator/template/use-helm/_automate/generate_snake_zrb_meta_template_name/template/src/kebab-zrb-app-name/deployment/__main__.py +12 -14
  31. zrb/builtin/generator/cmd_task/add.py +23 -25
  32. zrb/builtin/generator/cmd_task/template/_automate/snake_zrb_task_name.py +3 -5
  33. zrb/builtin/generator/common/helper.py +15 -20
  34. zrb/builtin/generator/common/task_factory.py +29 -26
  35. zrb/builtin/generator/common/task_input.py +97 -91
  36. zrb/builtin/generator/docker_compose_task/add.py +38 -39
  37. zrb/builtin/generator/docker_compose_task/template/_automate/snake_zrb_task_name.py +13 -19
  38. zrb/builtin/generator/docker_compose_task/template/src/kebab-zrb-task-name/image/main.py +18 -14
  39. zrb/builtin/generator/fastapp/add.py +94 -90
  40. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_checker.py +28 -27
  41. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_config.py +68 -39
  42. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_env.py +24 -22
  43. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_env_file.py +12 -12
  44. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_get_start_microservices.py +43 -41
  45. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_helper.py +23 -24
  46. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_input.py +21 -20
  47. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-load-test.sh +1 -1
  48. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-start.sh +1 -1
  49. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-test.sh +2 -2
  50. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/container.py +46 -39
  51. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/deployment.py +28 -20
  52. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/frontend.py +21 -27
  53. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/image.py +23 -18
  54. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/load_test.py +35 -36
  55. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/local.py +68 -58
  56. zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/test.py +24 -38
  57. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/__main__.py +23 -21
  58. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/_common.py +72 -75
  59. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/app_helper.py +70 -75
  60. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/helm_postgresql_helper.py +18 -21
  61. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/helm_rabbitmq_helper.py +11 -19
  62. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/helm_redpanda_helper.py +18 -15
  63. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/helm_signoz_helper.py +17 -21
  64. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/docker-compose.yml +12 -12
  65. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/loadtest/locustfile.py +10 -12
  66. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/Dockerfile +1 -0
  67. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/app.py +35 -30
  68. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/app_lifespan.py +21 -17
  69. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/app_state.py +3 -2
  70. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/db_connection.py +18 -20
  71. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/frontend_index.py +5 -6
  72. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/log.py +7 -15
  73. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/messagebus.py +38 -34
  74. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/rpc.py +19 -18
  75. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/config.py +68 -103
  76. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/error.py +11 -10
  77. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/__init__.py +2 -4
  78. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/kafka/admin.py +38 -35
  79. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/kafka/consumer.py +38 -45
  80. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/kafka/publisher.py +26 -29
  81. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/messagebus.py +8 -14
  82. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/mock.py +12 -8
  83. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/rabbitmq/admin.py +37 -44
  84. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/rabbitmq/consumer.py +42 -67
  85. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/rabbitmq/publisher.py +32 -55
  86. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/model/repo_model.py +11 -10
  87. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/__init__.py +2 -2
  88. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/db_entity_mixin.py +3 -6
  89. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/db_repo.py +76 -83
  90. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/repo.py +5 -5
  91. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/search_filter.py +1 -0
  92. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/rpc/__init__.py +1 -1
  93. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/rpc/messagebus/caller.py +17 -19
  94. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/rpc/messagebus/server.py +14 -18
  95. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/rpc/rpc.py +15 -28
  96. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/schema/__init__.py +1 -1
  97. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/schema/base_schema.py +6 -5
  98. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/serializer/__init__.py +1 -3
  99. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/serializer/serializer.py +3 -4
  100. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/helper/async_task.py +3 -5
  101. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/helper/conversion.py +10 -10
  102. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/helper/migration.py +6 -10
  103. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/migrate.py +3 -2
  104. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/api.py +7 -12
  105. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/__init__.py +4 -6
  106. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/access_token_scheme.py +9 -10
  107. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/access_token_util.py +6 -5
  108. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/authorizer.py +4 -4
  109. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/bearer_token_scheme.py +1 -1
  110. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/model/user_model.py +8 -10
  111. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/password_hasher.py +1 -1
  112. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/refresh_token_util.py +7 -6
  113. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/repo/group_repo.py +3 -8
  114. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/repo/permission_repo.py +3 -7
  115. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/repo/user_repo.py +3 -5
  116. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/user.py +12 -7
  117. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/__init__.py +7 -12
  118. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/access_token/scheme.py +7 -12
  119. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/access_token/util.py +20 -30
  120. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/authorizer/authorizer.py +1 -3
  121. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/authorizer/rpc_authorizer.py +5 -12
  122. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/password_hasher/bcrypt_password_hasher.py +3 -8
  123. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/password_hasher/password_hasher.py +0 -1
  124. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/refresh_token/util.py +15 -21
  125. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/group/api.py +42 -49
  126. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/group/model.py +3 -7
  127. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/group/repo.py +18 -16
  128. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/group/rpc.py +26 -41
  129. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/api.py +46 -51
  130. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/model.py +5 -7
  131. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/repo.py +11 -8
  132. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/rpc.py +28 -45
  133. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/table.py +10 -10
  134. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/user/api.py +60 -72
  135. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/user/model.py +32 -61
  136. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/user/repo.py +33 -36
  137. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/user/rpc.py +42 -61
  138. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/event.py +2 -4
  139. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/migrate.py +3 -5
  140. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/register_module.py +11 -12
  141. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/register_permission.py +19 -26
  142. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/rpc.py +5 -13
  143. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/group.py +6 -4
  144. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/permission.py +3 -1
  145. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/request.py +1 -0
  146. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/token.py +2 -2
  147. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/user.py +4 -3
  148. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/api.py +4 -5
  149. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/component/model/activity_model.py +3 -9
  150. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/component/repo/activity_repo.py +3 -7
  151. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/core/historical_repo_model.py +13 -13
  152. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/api.py +22 -23
  153. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/event.py +5 -7
  154. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/model.py +2 -6
  155. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/repo.py +8 -8
  156. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/rpc.py +28 -45
  157. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/table.py +3 -3
  158. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/event.py +4 -8
  159. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/migrate.py +2 -4
  160. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/register_module.py +10 -11
  161. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/rpc.py +3 -5
  162. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/schema/activity.py +3 -1
  163. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/requirements.txt +12 -12
  164. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/auth/test_group_crud.py +76 -106
  165. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/auth/test_permission_crud.py +73 -103
  166. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/auth/test_user_crud.py +92 -122
  167. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/auth/test_user_login.py +107 -134
  168. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/conftest.py +2 -2
  169. zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/test_liveness_and_readiness.py +8 -15
  170. zrb/builtin/generator/fastapp_crud/add.py +74 -79
  171. zrb/builtin/generator/fastapp_crud/helper.py +51 -48
  172. zrb/builtin/generator/fastapp_crud/task_factory.py +17 -14
  173. zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/component/model/snake_zrb_entity_name_model.py +2 -2
  174. zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/component/repo/snake_zrb_entity_name_repo.py +3 -2
  175. zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/snake_zrb_entity_name/api.py +58 -40
  176. zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/snake_zrb_entity_name/model.py +7 -3
  177. zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/snake_zrb_entity_name/repo.py +9 -4
  178. zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/snake_zrb_entity_name/rpc.py +32 -39
  179. zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/schema/snake_zrb_entity_name.py +3 -1
  180. zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/test/snake_zrb_module_name/test_snake_zrb_entity_name.py +68 -98
  181. zrb/builtin/generator/fastapp_field/add.py +143 -85
  182. zrb/builtin/generator/fastapp_field/helper.py +184 -125
  183. zrb/builtin/generator/fastapp_module/add.py +90 -67
  184. zrb/builtin/generator/fastapp_module/helper.py +141 -155
  185. zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/api.py +3 -2
  186. zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/table.py +3 -3
  187. zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/event.py +3 -5
  188. zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/migrate.py +2 -4
  189. zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/register_module.py +10 -11
  190. zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/rpc.py +3 -5
  191. zrb/builtin/generator/pip_package/add.py +39 -40
  192. zrb/builtin/generator/pip_package/template/_automate/snake_zrb_package_name/local.py +30 -30
  193. zrb/builtin/generator/pip_package/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/__init__.py +1 -0
  194. zrb/builtin/generator/pip_package/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/__main__.py +1 -0
  195. zrb/builtin/generator/pip_package/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/util.py +2 -2
  196. zrb/builtin/generator/plugin/create.py +39 -36
  197. zrb/builtin/generator/plugin/template/src/snake_zrb_package_name/__init__.py +1 -1
  198. zrb/builtin/generator/plugin/template/src/snake_zrb_package_name/__main__.py +1 -0
  199. zrb/builtin/generator/plugin/template/src/snake_zrb_package_name/task/example_task.py +6 -4
  200. zrb/builtin/generator/plugin/template/zrb_init.py +27 -27
  201. zrb/builtin/generator/project/create.py +38 -46
  202. zrb/builtin/generator/project/template/.flake8 +3 -0
  203. zrb/builtin/generator/project/template/project.sh +19 -10
  204. zrb/builtin/generator/project_task/task_factory.py +60 -61
  205. zrb/builtin/generator/project_task/template/_automate/_project/__init__.py +2 -2
  206. zrb/builtin/generator/project_task/template/_automate/_project/build_project_images.py +4 -4
  207. zrb/builtin/generator/project_task/template/_automate/_project/deploy_project.py +4 -4
  208. zrb/builtin/generator/project_task/template/_automate/_project/destroy_project.py +4 -4
  209. zrb/builtin/generator/project_task/template/_automate/_project/push_project_images.py +4 -4
  210. zrb/builtin/generator/project_task/template/_automate/_project/remove_project_containers.py +4 -4
  211. zrb/builtin/generator/project_task/template/_automate/_project/start_project.py +4 -4
  212. zrb/builtin/generator/project_task/template/_automate/_project/start_project_containers.py +4 -4
  213. zrb/builtin/generator/project_task/template/_automate/_project/stop_project_containers.py +4 -4
  214. zrb/builtin/generator/python_task/add.py +25 -33
  215. zrb/builtin/generator/python_task/template/_automate/snake_zrb_task_name.py +8 -7
  216. zrb/builtin/generator/simple_python_app/add.py +81 -75
  217. zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/_common.py +14 -15
  218. zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/container.py +46 -61
  219. zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/deployment.py +34 -32
  220. zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/image.py +19 -22
  221. zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/local.py +23 -25
  222. zrb/builtin/generator/simple_python_app/template/src/kebab-zrb-app-name/deployment/__main__.py +24 -32
  223. zrb/builtin/generator/simple_python_app/template/src/kebab-zrb-app-name/src/main.py +18 -14
  224. zrb/builtin/git.py +46 -46
  225. zrb/builtin/group.py +13 -34
  226. zrb/builtin/helper/reccuring_action.py +26 -29
  227. zrb/builtin/md5.py +17 -30
  228. zrb/builtin/process.py +19 -19
  229. zrb/builtin/project.py +13 -15
  230. zrb/builtin/say.py +69 -88
  231. zrb/builtin/schedule.py +15 -19
  232. zrb/builtin/ubuntu.py +44 -35
  233. zrb/builtin/update.py +5 -5
  234. zrb/builtin/version.py +3 -7
  235. zrb/builtin/watch_changes.py +24 -25
  236. zrb/config/config.py +19 -18
  237. zrb/helper/accessories/color.py +18 -6
  238. zrb/helper/accessories/icon.py +24 -3
  239. zrb/helper/accessories/name.py +120 -28
  240. zrb/helper/advertisement.py +9 -13
  241. zrb/helper/callable.py +2 -4
  242. zrb/helper/cli.py +27 -31
  243. zrb/helper/codemod/add_argument_to_function.py +3 -4
  244. zrb/helper/codemod/add_argument_to_function_call.py +4 -7
  245. zrb/helper/codemod/add_assert_resource.py +7 -7
  246. zrb/helper/codemod/add_function_call.py +3 -5
  247. zrb/helper/codemod/add_import_module.py +15 -26
  248. zrb/helper/codemod/add_key_value_to_dict.py +7 -10
  249. zrb/helper/codemod/add_property_to_class.py +10 -8
  250. zrb/helper/codemod/add_upstream_to_task.py +21 -33
  251. zrb/helper/codemod/append_code_to_function.py +6 -13
  252. zrb/helper/codemod/format_code.py +2 -1
  253. zrb/helper/default_env.py +25 -25
  254. zrb/helper/docker_compose/fetch_external_env.py +18 -18
  255. zrb/helper/docker_compose/file.py +5 -4
  256. zrb/helper/docstring.py +44 -47
  257. zrb/helper/env_map/fetch.py +7 -12
  258. zrb/helper/file/copy_tree.py +12 -17
  259. zrb/helper/file/match.py +6 -7
  260. zrb/helper/file/text.py +8 -6
  261. zrb/helper/git/detect_changes.py +9 -8
  262. zrb/helper/loader/load_module.py +14 -13
  263. zrb/helper/log.py +4 -3
  264. zrb/helper/map/conversion.py +4 -5
  265. zrb/helper/python_task.py +2 -4
  266. zrb/helper/render_data.py +25 -18
  267. zrb/helper/string/constant.py +2 -2
  268. zrb/helper/string/conversion.py +17 -16
  269. zrb/helper/string/jinja.py +2 -2
  270. zrb/helper/typecheck.py +6 -4
  271. zrb/helper/typing.py +10 -2
  272. zrb/helper/util.py +44 -40
  273. zrb/task/any_task.py +251 -251
  274. zrb/task/base_remote_cmd_task.py +76 -59
  275. zrb/task/base_task/base_task.py +95 -108
  276. zrb/task/base_task/component/base_task_model.py +73 -71
  277. zrb/task/base_task/component/common_task_model.py +42 -29
  278. zrb/task/base_task/component/pid_model.py +3 -5
  279. zrb/task/base_task/component/renderer.py +26 -36
  280. zrb/task/base_task/component/trackers.py +6 -9
  281. zrb/task/checker.py +14 -9
  282. zrb/task/cmd_task.py +102 -100
  283. zrb/task/decorator.py +19 -13
  284. zrb/task/docker_compose_task.py +127 -98
  285. zrb/task/flow_task.py +16 -19
  286. zrb/task/http_checker.py +40 -36
  287. zrb/task/notifier.py +50 -38
  288. zrb/task/parallel.py +3 -3
  289. zrb/task/path_checker.py +34 -27
  290. zrb/task/path_watcher.py +49 -40
  291. zrb/task/port_checker.py +33 -26
  292. zrb/task/recurring_task.py +36 -42
  293. zrb/task/remote_cmd_task.py +31 -28
  294. zrb/task/resource_maker.py +66 -52
  295. zrb/task/rsync_task.py +24 -21
  296. zrb/task/task.py +4 -3
  297. zrb/task/time_watcher.py +36 -31
  298. zrb/task_env/constant.py +1 -1
  299. zrb/task_env/env.py +33 -31
  300. zrb/task_env/env_file.py +24 -23
  301. zrb/task_group/group.py +27 -30
  302. zrb/task_input/any_input.py +18 -16
  303. zrb/task_input/base_input.py +26 -26
  304. zrb/task_input/bool_input.py +6 -6
  305. zrb/task_input/choice_input.py +11 -9
  306. zrb/task_input/constant.py +1 -1
  307. zrb/task_input/float_input.py +6 -5
  308. zrb/task_input/int_input.py +8 -8
  309. zrb/task_input/password_input.py +9 -9
  310. zrb/task_input/str_input.py +8 -8
  311. zrb/task_input/task_input.py +4 -2
  312. {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/METADATA +3 -1
  313. {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/RECORD +316 -315
  314. {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/LICENSE +0 -0
  315. {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/WHEEL +0 -0
  316. {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/entry_points.txt +0 -0
zrb/builtin/env.py CHANGED
@@ -1,9 +1,9 @@
1
- from zrb.helper.typing import Any, List
2
1
  from zrb.builtin.group import env_group
3
2
  from zrb.helper.accessories.color import colored
3
+ from zrb.helper.typing import Any, List
4
+ from zrb.runner import runner
4
5
  from zrb.task.decorator import python_task
5
6
  from zrb.task.task import Task
6
- from zrb.runner import runner
7
7
 
8
8
  ###############################################################################
9
9
  # Task Definitions
@@ -11,23 +11,20 @@ from zrb.runner import runner
11
11
 
12
12
 
13
13
  @python_task(
14
- name='get',
15
- group=env_group,
16
- description='Get environment values',
17
- runner=runner
14
+ name="get", group=env_group, description="Get environment values", runner=runner
18
15
  )
19
16
  async def get(*args: Any, **kwargs: Any):
20
- task: Task = kwargs['_task']
17
+ task: Task = kwargs["_task"]
21
18
  env_map = task.get_env_map()
22
19
  names = list(env_map.keys())
23
20
  names.sort()
24
- colored_equal = colored('=', color='grey', attrs=['dark'])
21
+ colored_equal = colored("=", color="grey", attrs=["dark"])
25
22
  env_lines: List[str] = []
26
23
  for name in names:
27
24
  value = env_map[name]
28
- colored_name = colored(name, color='green', attrs=['bold'])
29
- colored_value = colored(value, attrs=['bold'])
30
- env_lines.append(f'{colored_name}{colored_equal}{colored_value}')
31
- line_separator = '\n '
25
+ colored_name = colored(name, color="green", attrs=["bold"])
26
+ colored_value = colored(value, attrs=["bold"])
27
+ env_lines.append(f"{colored_name}{colored_equal}{colored_value}")
28
+ line_separator = "\n "
32
29
  task.print_out(line_separator + line_separator.join(env_lines))
33
30
  return env_map
zrb/builtin/eval.py CHANGED
@@ -1,7 +1,7 @@
1
1
  from zrb.helper.typing import Any
2
+ from zrb.runner import runner
2
3
  from zrb.task.decorator import python_task
3
4
  from zrb.task_input.str_input import StrInput
4
- from zrb.runner import runner
5
5
 
6
6
  ###############################################################################
7
7
  # Task Definitions
@@ -9,19 +9,19 @@ from zrb.runner import runner
9
9
 
10
10
 
11
11
  @python_task(
12
- name='eval',
12
+ name="eval",
13
13
  inputs=[
14
14
  StrInput(
15
- name='expression',
16
- shortcut='e',
17
- default='',
18
- description='Python expression',
15
+ name="expression",
16
+ shortcut="e",
17
+ default="",
18
+ description="Python expression",
19
19
  )
20
20
  ],
21
- description='Evaluate Python expression',
21
+ description="Evaluate Python expression",
22
22
  retry=0,
23
- runner=runner
23
+ runner=runner,
24
24
  )
25
25
  async def evaluate(*args: str, **kwargs: Any):
26
- expression: str = kwargs.get('expression', '')
26
+ expression: str = kwargs.get("expression", "")
27
27
  return eval(expression)
zrb/builtin/explain.py CHANGED
@@ -1,9 +1,8 @@
1
- from zrb.helper.typing import Any
2
- from zrb.helper.python_task import show_lines
3
1
  from zrb.builtin.group import explain_group
4
- from zrb.task.decorator import python_task
2
+ from zrb.helper.python_task import show_lines
3
+ from zrb.helper.typing import Any
5
4
  from zrb.runner import runner
6
-
5
+ from zrb.task.decorator import python_task
7
6
 
8
7
  ###############################################################################
9
8
  # Task Definitions
@@ -11,110 +10,110 @@ from zrb.runner import runner
11
10
 
12
11
 
13
12
  @python_task(
14
- name='solid-principle',
13
+ name="solid-principle",
15
14
  group=explain_group,
16
- description='Explain SOLID principle',
17
- runner=runner
15
+ description="Explain SOLID principle",
16
+ runner=runner,
18
17
  )
19
18
  async def explain_solid_principle(*args: Any, **kwargs: Any):
20
19
  show_lines(
21
- kwargs['_task'],
22
- 'S - Single Responsibility Principle',
23
- 'O - Open/Closed Principle',
24
- 'L - Liskov’s Substitution Principle',
25
- 'I - Interface Segregation Principle',
26
- 'D - Dependency Inversion Principle',
27
- '',
28
- 'In software development, Object-Oriented Design plays a crucial role when it comes to writing flexible, scalable, maintainable, and reusable code. There are so many benefits of using OOD but every developer should also have the knowledge of the SOLID principle for good object-oriented design in programming. The SOLID principle was introduced by Robert C. Martin, also known as Uncle Bob and it is a coding standard in programming.', # noqa
29
- '',
30
- 'The SOLID principle helps in reducing tight coupling. Tight coupling means a group of classes are highly dependent on one another which you should avoid in your code. Opposite of tight coupling is loose coupling and your code is considered as a good code when it has loosely-coupled classes. Loosely coupled classes minimize changes in your code, helps in making code more reusable, maintainable, flexible and stable.', # noqa
20
+ kwargs["_task"],
21
+ "S - Single Responsibility Principle",
22
+ "O - Open/Closed Principle",
23
+ "L - Liskov’s Substitution Principle",
24
+ "I - Interface Segregation Principle",
25
+ "D - Dependency Inversion Principle",
26
+ "",
27
+ "In software development, Object-Oriented Design plays a crucial role when it comes to writing flexible, scalable, maintainable, and reusable code. There are so many benefits of using OOD but every developer should also have the knowledge of the SOLID principle for good object-oriented design in programming. The SOLID principle was introduced by Robert C. Martin, also known as Uncle Bob and it is a coding standard in programming.", # noqa
28
+ "",
29
+ "The SOLID principle helps in reducing tight coupling. Tight coupling means a group of classes are highly dependent on one another which you should avoid in your code. Opposite of tight coupling is loose coupling and your code is considered as a good code when it has loosely-coupled classes. Loosely coupled classes minimize changes in your code, helps in making code more reusable, maintainable, flexible and stable.", # noqa
31
30
  )
32
31
 
33
32
 
34
33
  @python_task(
35
- name='yagni-principle',
34
+ name="yagni-principle",
36
35
  group=explain_group,
37
- description='Explain YAGNI principle',
38
- runner=runner
36
+ description="Explain YAGNI principle",
37
+ runner=runner,
39
38
  )
40
39
  async def explain_yagni_principle(*args: Any, **kwargs: Any):
41
40
  show_lines(
42
- kwargs['_task'],
43
- 'Y - You',
44
- 'A - Aren\'t',
45
- 'G - Gonna',
46
- 'N - Need',
47
- 'I - It',
48
- '',
49
- 'YAGNI principle ("You Aren\'t Gonna Need It") is a practice in software development which states that features should only be added when required.', # noqa
50
- '',
51
- 'As a part of the extreme programming (XP) philosophy, YAGNI trims away excess and inefficiency in development to facilitate the desired increased frequency of releases.', # noqa
41
+ kwargs["_task"],
42
+ "Y - You",
43
+ "A - Aren't",
44
+ "G - Gonna",
45
+ "N - Need",
46
+ "I - It",
47
+ "",
48
+ 'YAGNI principle ("You Aren\'t Gonna Need It") is a practice in software development which states that features should only be added when required.', # noqa
49
+ "",
50
+ "As a part of the extreme programming (XP) philosophy, YAGNI trims away excess and inefficiency in development to facilitate the desired increased frequency of releases.", # noqa
52
51
  )
53
52
 
54
53
 
55
54
  @python_task(
56
- name='dry-principle',
55
+ name="dry-principle",
57
56
  group=explain_group,
58
- description='Explain DRY principle',
59
- runner=runner
57
+ description="Explain DRY principle",
58
+ runner=runner,
60
59
  )
61
60
  async def explain_dry_principle(*args: Any, **kwargs: Any):
62
61
  show_lines(
63
- kwargs['_task'],
64
- 'D - Don\'t',
65
- 'R - Repeat',
66
- 'Y - Yourself',
67
- '',
68
- '"Don\'t repeat yourself" (DRY) is a principle of software development aimed at reducing repetition of information which is likely to change, replacing it with abstractions that are less likely to change, or using data normalization which avoids redundancy in the first place.', # noqa
69
- '',
70
- 'The DRY principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system". The principle has been formulated by Andy Hunt and Dave Thomas in their book The Pragmatic Programmer.', # noqa
62
+ kwargs["_task"],
63
+ "D - Don't",
64
+ "R - Repeat",
65
+ "Y - Yourself",
66
+ "",
67
+ '"Don\'t repeat yourself" (DRY) is a principle of software development aimed at reducing repetition of information which is likely to change, replacing it with abstractions that are less likely to change, or using data normalization which avoids redundancy in the first place.', # noqa
68
+ "",
69
+ 'The DRY principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system". The principle has been formulated by Andy Hunt and Dave Thomas in their book The Pragmatic Programmer.', # noqa
71
70
  )
72
71
 
73
72
 
74
73
  @python_task(
75
- name='kiss-principle',
74
+ name="kiss-principle",
76
75
  group=explain_group,
77
- description='Explain KISS principle',
78
- runner=runner
76
+ description="Explain KISS principle",
77
+ runner=runner,
79
78
  )
80
79
  async def explain_kiss_principle(*args: Any, **kwargs: Any):
81
80
  show_lines(
82
- kwargs['_task'],
83
- 'K - Keep',
84
- 'I - It',
85
- 'S - Simple',
86
- 'S - Stupid',
87
- '',
88
- 'KISS, an acronym for "Keep it simple, stupid!", is a design principle noted by the U.S. Navy in 1960. First seen partly in American English by at least 1938, the KISS principle states that most systems work best if they are kept simple rather than made complicated; therefore, simplicity should be a key goal in design, and unnecessary complexity should be avoided.' # noqa
81
+ kwargs["_task"],
82
+ "K - Keep",
83
+ "I - It",
84
+ "S - Simple",
85
+ "S - Stupid",
86
+ "",
87
+ 'KISS, an acronym for "Keep it simple, stupid!", is a design principle noted by the U.S. Navy in 1960. First seen partly in American English by at least 1938, the KISS principle states that most systems work best if they are kept simple rather than made complicated; therefore, simplicity should be a key goal in design, and unnecessary complexity should be avoided.', # noqa
89
88
  )
90
89
 
91
90
 
92
91
  @python_task(
93
- name='zen-of-python',
92
+ name="zen-of-python",
94
93
  group=explain_group,
95
- description='Explain Zen of Python',
96
- runner=runner
94
+ description="Explain Zen of Python",
95
+ runner=runner,
97
96
  )
98
97
  async def explain_zen_of_python(*args: Any, **kwargs: Any):
99
98
  show_lines(
100
- kwargs['_task'],
101
- 'Beautiful is better than ugly.',
102
- 'Explicit is better than implicit.',
103
- 'Simple is better than complex.',
104
- 'Complex is better than complicated.',
105
- 'Flat is better than nested.',
106
- 'Sparse is better than dense.',
107
- 'Readability counts.',
108
- 'Special cases aren\'t special enough to break the rules.',
109
- 'Although practicality beats purity.',
110
- 'Errors should never pass silently.',
111
- 'Unless explicitly silenced.',
112
- 'In the face of ambiguity, refuse the temptation to guess.',
113
- 'There should be one-- and preferably only one --obvious way to do it.', # noqa
114
- 'Although that way may not be obvious at first unless you\'re Dutch.',
115
- 'Now is better than never.',
116
- 'Although never is often better than *right* now.',
117
- 'If the implementation is hard to explain, it\'s a bad idea.',
118
- 'If the implementation is easy to explain, it may be a good idea.',
119
- 'Namespaces are one honking great idea -- let\'s do more of those!',
99
+ kwargs["_task"],
100
+ "Beautiful is better than ugly.",
101
+ "Explicit is better than implicit.",
102
+ "Simple is better than complex.",
103
+ "Complex is better than complicated.",
104
+ "Flat is better than nested.",
105
+ "Sparse is better than dense.",
106
+ "Readability counts.",
107
+ "Special cases aren't special enough to break the rules.",
108
+ "Although practicality beats purity.",
109
+ "Errors should never pass silently.",
110
+ "Unless explicitly silenced.",
111
+ "In the face of ambiguity, refuse the temptation to guess.",
112
+ "There should be one-- and preferably only one --obvious way to do it.", # noqa
113
+ "Although that way may not be obvious at first unless you're Dutch.",
114
+ "Now is better than never.",
115
+ "Although never is often better than *right* now.",
116
+ "If the implementation is hard to explain, it's a bad idea.",
117
+ "If the implementation is easy to explain, it may be a good idea.",
118
+ "Namespaces are one honking great idea -- let's do more of those!",
120
119
  )
@@ -1,19 +1,15 @@
1
- from zrb.builtin.generator.project.create import create_project
2
- from zrb.builtin.generator.plugin import create as create_plugin
1
+ from zrb.builtin.generator.app_generator import add as add_app_generator
3
2
  from zrb.builtin.generator.cmd_task.add import add_cmd_task
4
- from zrb.builtin.generator.docker_compose_task.add import (
5
- add_docker_compose_task
6
- )
7
- from zrb.builtin.generator.python_task.add import add_python_task
8
- from zrb.builtin.generator.simple_python_app import (
9
- add as add_simple_python_app
10
- )
3
+ from zrb.builtin.generator.docker_compose_task.add import add_docker_compose_task
11
4
  from zrb.builtin.generator.fastapp import add as add_fastapp
12
- from zrb.builtin.generator.fastapp_module import add as add_fastapp_module
13
5
  from zrb.builtin.generator.fastapp_crud import add as add_fastapp_crud
14
6
  from zrb.builtin.generator.fastapp_field import add as add_fastapp_field
7
+ from zrb.builtin.generator.fastapp_module import add as add_fastapp_module
15
8
  from zrb.builtin.generator.pip_package import add as add_pip_package
16
- from zrb.builtin.generator.app_generator import add as add_app_generator
9
+ from zrb.builtin.generator.plugin import create as create_plugin
10
+ from zrb.builtin.generator.project.create import create_project
11
+ from zrb.builtin.generator.python_task.add import add_python_task
12
+ from zrb.builtin.generator.simple_python_app import add as add_simple_python_app
17
13
 
18
14
  assert create_project
19
15
  assert create_plugin
@@ -1,21 +1,22 @@
1
- from zrb.helper.typing import Any
2
- from zrb.builtin.generator.common.task_input import project_dir_input
1
+ import os
2
+
3
3
  from zrb.builtin.generator.common.helper import (
4
- validate_existing_project_dir, validate_inexisting_automation
4
+ validate_existing_project_dir,
5
+ validate_inexisting_automation,
5
6
  )
6
7
  from zrb.builtin.generator.common.task_factory import create_register_module
8
+ from zrb.builtin.generator.common.task_input import project_dir_input
7
9
  from zrb.builtin.group import project_add_group
8
- from zrb.task.decorator import python_task
9
- from zrb.task.task import Task
10
+ from zrb.helper.accessories.name import get_random_name
11
+ from zrb.helper.typing import Any
12
+ from zrb.runner import runner
10
13
  from zrb.task.cmd_task import CmdTask
14
+ from zrb.task.decorator import python_task
11
15
  from zrb.task.resource_maker import ResourceMaker
16
+ from zrb.task.task import Task
17
+ from zrb.task_input.bool_input import BoolInput
12
18
  from zrb.task_input.int_input import IntInput
13
19
  from zrb.task_input.str_input import StrInput
14
- from zrb.task_input.bool_input import BoolInput
15
- from zrb.helper.accessories.name import get_random_name
16
- from zrb.runner import runner
17
-
18
- import os
19
20
 
20
21
  CURRENT_DIR = os.path.dirname(__file__)
21
22
 
@@ -24,55 +25,55 @@ CURRENT_DIR = os.path.dirname(__file__)
24
25
  ###############################################################################
25
26
 
26
27
  template_name_input = StrInput(
27
- name='template-name',
28
- shortcut='t',
29
- description='Template name',
30
- prompt='Template name',
31
- default=get_random_name()
28
+ name="template-name",
29
+ shortcut="t",
30
+ description="Template name",
31
+ prompt="Template name",
32
+ default=get_random_name(),
32
33
  )
33
34
 
34
35
  base_image_input = StrInput(
35
- name='base-image',
36
- shortcut='i',
37
- description='Base image',
38
- prompt='Base image',
39
- default='stalchmst/moku:1.0.0'
36
+ name="base-image",
37
+ shortcut="i",
38
+ description="Base image",
39
+ prompt="Base image",
40
+ default="stalchmst/moku:1.0.0",
40
41
  )
41
42
 
42
43
  default_app_port_input = IntInput(
43
- name='default-app-port',
44
- shortcut='p',
45
- description='Default app port',
46
- prompt='Default app port',
47
- default='8080'
44
+ name="default-app-port",
45
+ shortcut="p",
46
+ description="Default app port",
47
+ prompt="Default app port",
48
+ default="8080",
48
49
  )
49
50
 
50
51
  build_custom_image_input = BoolInput(
51
- name='build-custom-image',
52
- description='Whether build custom image or not',
53
- prompt='Does user need to create custom image?',
54
- default=True
52
+ name="build-custom-image",
53
+ description="Whether build custom image or not",
54
+ prompt="Does user need to create custom image?",
55
+ default=True,
55
56
  )
56
57
 
57
58
  is_container_only_input = BoolInput(
58
- name='is-container-only',
59
- description='Whether app only run as container or not',
60
- prompt='Is this container only?',
61
- default=False
59
+ name="is-container-only",
60
+ description="Whether app only run as container or not",
61
+ prompt="Is this container only?",
62
+ default=False,
62
63
  )
63
64
 
64
65
  is_http_port_input = BoolInput(
65
- name='is-http-port',
66
- description='Whether app run on top of HTTP(s) protocol or not',
67
- prompt='Is this a web appp (run on top of HTTP(s))?',
68
- default=False
66
+ name="is-http-port",
67
+ description="Whether app run on top of HTTP(s) protocol or not",
68
+ prompt="Is this a web appp (run on top of HTTP(s))?",
69
+ default=False,
69
70
  )
70
71
 
71
72
  use_helm_input = BoolInput(
72
- name='use-helm',
73
- description='Whether using helm for deployment or not',
74
- prompt='Do you want to use helm for deployment?',
75
- default=False
73
+ name="use-helm",
74
+ description="Whether using helm for deployment or not",
75
+ prompt="Do you want to use helm for deployment?",
76
+ default=False,
76
77
  )
77
78
 
78
79
  ###############################################################################
@@ -91,9 +92,9 @@ inputs = [
91
92
  ]
92
93
 
93
94
  replacements = {
94
- 'zrbMetaTemplateName': '{{input.template_name}}',
95
- 'zrbMetaBaseImage': '{{input.base_image}}',
96
- 'zrbMetaDefaultAppPort': '{{input.default_app_port}}',
95
+ "zrbMetaTemplateName": "{{input.template_name}}",
96
+ "zrbMetaBaseImage": "{{input.base_image}}",
97
+ "zrbMetaDefaultAppPort": "{{input.default_app_port}}",
97
98
  }
98
99
 
99
100
  ###############################################################################
@@ -101,101 +102,99 @@ replacements = {
101
102
  ###############################################################################
102
103
 
103
104
 
104
- @python_task(
105
- name='validate',
106
- inputs=inputs,
107
- retry=0
108
- )
105
+ @python_task(name="validate", inputs=inputs, retry=0)
109
106
  async def validate(*args: Any, **kwargs: Any):
110
- project_dir = kwargs.get('project_dir')
107
+ project_dir = kwargs.get("project_dir")
111
108
  validate_existing_project_dir(project_dir)
112
- template_name = kwargs.get('template_name')
109
+ template_name = kwargs.get("template_name")
113
110
  validate_inexisting_automation(project_dir, template_name)
114
- is_container_only_input: bool = kwargs.get('is_container_only')
115
- build_custom_image_input: bool = kwargs.get('build_custom_image')
111
+ is_container_only_input: bool = kwargs.get("is_container_only")
112
+ build_custom_image_input: bool = kwargs.get("build_custom_image")
116
113
  if not is_container_only_input and not build_custom_image_input:
117
114
  raise Exception(
118
- 'Invalid options: Not is-container-only but not build-custom-image'
115
+ "Invalid options: Not is-container-only but not build-custom-image"
119
116
  )
120
117
 
121
118
 
122
119
  copy_base_resource = ResourceMaker(
123
- name='copy-base-resource',
120
+ name="copy-base-resource",
124
121
  inputs=inputs,
125
122
  upstreams=[validate],
126
123
  replacements=replacements,
127
- template_path=os.path.join(CURRENT_DIR, 'template', 'base'),
128
- destination_path='{{ input.project_dir }}',
129
- excludes=['*/__pycache__']
124
+ template_path=os.path.join(CURRENT_DIR, "template", "base"),
125
+ destination_path="{{ input.project_dir }}",
126
+ excludes=["*/__pycache__"],
130
127
  )
131
128
 
132
129
  copy_http_port_resource = ResourceMaker(
133
- name='copy-http-port-resource',
130
+ name="copy-http-port-resource",
134
131
  inputs=inputs,
135
- should_execute='{{ input.is_http_port }}',
132
+ should_execute="{{ input.is_http_port }}",
136
133
  upstreams=[copy_base_resource],
137
134
  replacements=replacements,
138
- template_path=os.path.join(CURRENT_DIR, 'template', 'http-port'),
139
- destination_path='{{ input.project_dir }}',
140
- excludes=['*/__pycache__']
135
+ template_path=os.path.join(CURRENT_DIR, "template", "http-port"),
136
+ destination_path="{{ input.project_dir }}",
137
+ excludes=["*/__pycache__"],
141
138
  )
142
139
 
143
140
  copy_custom_image_resource = ResourceMaker(
144
- name='copy-custom-image-resource',
141
+ name="copy-custom-image-resource",
145
142
  inputs=inputs,
146
- should_execute='{{ input.build_custom_image }}',
143
+ should_execute="{{ input.build_custom_image }}",
147
144
  upstreams=[copy_http_port_resource],
148
145
  replacements=replacements,
149
- template_path=os.path.join(CURRENT_DIR, 'template', 'build-custom-image'),
150
- destination_path='{{ input.project_dir }}',
151
- excludes=['*/__pycache__']
146
+ template_path=os.path.join(CURRENT_DIR, "template", "build-custom-image"),
147
+ destination_path="{{ input.project_dir }}",
148
+ excludes=["*/__pycache__"],
152
149
  )
153
150
 
154
151
  copy_http_port_custom_image_resource = ResourceMaker(
155
- name='copy-http-port-custom-image-resource',
152
+ name="copy-http-port-custom-image-resource",
156
153
  inputs=inputs,
157
- should_execute='{{ input.is_http_port and input.build_custom_image }}',
154
+ should_execute="{{ input.is_http_port and input.build_custom_image }}",
158
155
  upstreams=[copy_custom_image_resource],
159
156
  replacements=replacements,
160
- template_path=os.path.join(CURRENT_DIR, 'template', 'http-port-build-custom-image'), # noqa
161
- destination_path='{{ input.project_dir }}',
162
- excludes=['*/__pycache__']
157
+ template_path=os.path.join(
158
+ CURRENT_DIR, "template", "http-port-build-custom-image"
159
+ ), # noqa
160
+ destination_path="{{ input.project_dir }}",
161
+ excludes=["*/__pycache__"],
163
162
  )
164
163
 
165
164
  copy_helm_resource = ResourceMaker(
166
- name='copy-helm-resource',
165
+ name="copy-helm-resource",
167
166
  inputs=inputs,
168
- should_execute='{{ input.use_helm }}',
167
+ should_execute="{{ input.use_helm }}",
169
168
  upstreams=[copy_http_port_custom_image_resource],
170
169
  replacements=replacements,
171
- template_path=os.path.join(CURRENT_DIR, 'template', 'use-helm'),
172
- destination_path='{{ input.project_dir }}',
173
- excludes=['*/__pycache__']
170
+ template_path=os.path.join(CURRENT_DIR, "template", "use-helm"),
171
+ destination_path="{{ input.project_dir }}",
172
+ excludes=["*/__pycache__"],
174
173
  )
175
174
 
176
175
  copy_resource = CmdTask(
177
- name='copy-resource',
176
+ name="copy-resource",
178
177
  upstreams=[
179
178
  copy_helm_resource,
180
179
  ],
181
- cmd='echo Resource copied',
180
+ cmd="echo Resource copied",
182
181
  )
183
182
 
184
183
  register_module = create_register_module(
185
- module_path='_automate.generate_{{util.to_snake_case(input.template_name)}}.add', # noqa
186
- alias='generate_{{util.to_snake_case(input.template_name)}}',
184
+ module_path="_automate.generate_{{util.to_snake_case(input.template_name)}}.add", # noqa
185
+ alias="generate_{{util.to_snake_case(input.template_name)}}",
187
186
  inputs=[template_name_input],
188
- upstreams=[copy_resource]
187
+ upstreams=[copy_resource],
189
188
  )
190
189
 
191
190
 
192
191
  @python_task(
193
- name='app-generator',
192
+ name="app-generator",
194
193
  group=project_add_group,
195
194
  upstreams=[register_module],
196
195
  inputs=inputs,
197
- runner=runner
196
+ runner=runner,
198
197
  )
199
198
  async def add_app_generator(*args: Any, **kwargs: Any):
200
- task: Task = kwargs.get('_task')
201
- task.print_out('Success')
199
+ task: Task = kwargs.get("_task")
200
+ task.print_out("Success")