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
@@ -1,11 +1,12 @@
1
- from zrb.helper.typecheck import typechecked
2
- from zrb.task.task import Task
3
- from zrb.helper.codemod.add_property_to_class import add_property_to_class
4
- from zrb.helper.codemod.add_key_value_to_dict import add_key_value_to_dict
5
- from zrb.helper.file.text import read_text_file_async, write_text_file_async
6
1
  import os
7
2
  import re
8
3
 
4
+ from zrb.helper.codemod.add_key_value_to_dict import add_key_value_to_dict
5
+ from zrb.helper.codemod.add_property_to_class import add_property_to_class
6
+ from zrb.helper.file.text import read_text_file_async, write_text_file_async
7
+ from zrb.helper.typecheck import typechecked
8
+ from zrb.task.task import Task
9
+
9
10
 
10
11
  @typechecked
11
12
  async def add_column_to_insert_page(
@@ -16,36 +17,45 @@ async def add_column_to_insert_page(
16
17
  kebab_entity_name: str,
17
18
  kebab_column_name: str,
18
19
  snake_column_name: str,
19
- capitalized_human_readable_column_name: str
20
+ capitalized_human_readable_column_name: str,
20
21
  ):
21
22
  list_page_file_path = os.path.join(
22
- project_dir, 'src', kebab_app_name, 'src', 'frontend', 'src', 'routes',
23
- kebab_module_name, kebab_entity_name, 'new', '+page.svelte'
23
+ project_dir,
24
+ "src",
25
+ kebab_app_name,
26
+ "src",
27
+ "frontend",
28
+ "src",
29
+ "routes",
30
+ kebab_module_name,
31
+ kebab_entity_name,
32
+ "new",
33
+ "+page.svelte",
24
34
  )
25
- task.print_out(f'Read HTML from: {list_page_file_path}')
35
+ task.print_out(f"Read HTML from: {list_page_file_path}")
26
36
  html_content = await read_text_file_async(list_page_file_path)
27
- task.print_out('Add default value to insert page')
37
+ task.print_out("Add default value to insert page")
28
38
  default_value_regex = r"(.*)(// DON'T DELETE: set field default value here)" # noqa
29
- default_value_subst = '\\n'.join([
30
- f"\\1row.{snake_column_name} = '';",
31
- '\\1\\2'
32
- ])
39
+ default_value_subst = "\\n".join([f"\\1row.{snake_column_name} = '';", "\\1\\2"])
33
40
  html_content = re.sub(
34
41
  default_value_regex, default_value_subst, html_content, 0, re.MULTILINE
35
42
  )
36
- task.print_out('Add field to insert page')
43
+ task.print_out("Add field to insert page")
37
44
  field_regex = r"(.*)(<!-- DON'T DELETE: insert new field here-->)"
38
- field_subst = '\\n'.join([
39
- '\\1<div class="mb-4">',
40
- f'\\1 <label class="block text-gray-700 font-bold mb-2" for="{kebab_column_name}">{capitalized_human_readable_column_name}</label>', # noqa
41
- f'\\1 <input type="text" class="input w-full" id="{kebab_column_name}" placeholder="{capitalized_human_readable_column_name}" bind:value=' + '{row.' + snake_column_name + '} />', # noqa
42
- '\\1</div>',
43
- '\\1\\2'
44
- ])
45
- html_content = re.sub(
46
- field_regex, field_subst, html_content, 0, re.MULTILINE
45
+ field_subst = "\\n".join(
46
+ [
47
+ '\\1<div class="mb-4">',
48
+ f'\\1 <label class="block text-gray-700 font-bold mb-2" for="{kebab_column_name}">{capitalized_human_readable_column_name}</label>', # noqa
49
+ f'\\1 <input type="text" class="input w-full" id="{kebab_column_name}" placeholder="{capitalized_human_readable_column_name}" bind:value='
50
+ + "{row."
51
+ + snake_column_name
52
+ + "} />", # noqa
53
+ "\\1</div>",
54
+ "\\1\\2",
55
+ ]
47
56
  )
48
- task.print_out(f'Write modified HTML to: {list_page_file_path}')
57
+ html_content = re.sub(field_regex, field_subst, html_content, 0, re.MULTILINE)
58
+ task.print_out(f"Write modified HTML to: {list_page_file_path}")
49
59
  await write_text_file_async(list_page_file_path, html_content)
50
60
 
51
61
 
@@ -58,27 +68,40 @@ async def add_column_to_update_page(
58
68
  kebab_entity_name: str,
59
69
  kebab_column_name: str,
60
70
  snake_column_name: str,
61
- capitalized_human_readable_column_name: str
71
+ capitalized_human_readable_column_name: str,
62
72
  ):
63
73
  list_page_file_path = os.path.join(
64
- project_dir, 'src', kebab_app_name, 'src', 'frontend', 'src', 'routes',
65
- kebab_module_name, kebab_entity_name, 'update', '[id]', '+page.svelte'
74
+ project_dir,
75
+ "src",
76
+ kebab_app_name,
77
+ "src",
78
+ "frontend",
79
+ "src",
80
+ "routes",
81
+ kebab_module_name,
82
+ kebab_entity_name,
83
+ "update",
84
+ "[id]",
85
+ "+page.svelte",
66
86
  )
67
- task.print_out(f'Read HTML from: {list_page_file_path}')
87
+ task.print_out(f"Read HTML from: {list_page_file_path}")
68
88
  html_content = await read_text_file_async(list_page_file_path)
69
- task.print_out('Add field to update page')
89
+ task.print_out("Add field to update page")
70
90
  regex = r"(.*)(<!-- DON'T DELETE: insert new field here-->)"
71
- subst = '\\n'.join([
72
- '\\1<div class="mb-4">',
73
- f'\\1 <label class="block text-gray-700 font-bold mb-2" for="{kebab_column_name}">{capitalized_human_readable_column_name}</label>', # noqa
74
- f'\\1 <input type="text" class="input w-full" id="{kebab_column_name}" placeholder="{capitalized_human_readable_column_name}" bind:value=' + '{row.' + snake_column_name + '} />', # noqa
75
- '\\1</div>',
76
- '\\1\\2'
77
- ])
78
- html_content = re.sub(
79
- regex, subst, html_content, 0, re.MULTILINE
91
+ subst = "\\n".join(
92
+ [
93
+ '\\1<div class="mb-4">',
94
+ f'\\1 <label class="block text-gray-700 font-bold mb-2" for="{kebab_column_name}">{capitalized_human_readable_column_name}</label>', # noqa
95
+ f'\\1 <input type="text" class="input w-full" id="{kebab_column_name}" placeholder="{capitalized_human_readable_column_name}" bind:value='
96
+ + "{row."
97
+ + snake_column_name
98
+ + "} />", # noqa
99
+ "\\1</div>",
100
+ "\\1\\2",
101
+ ]
80
102
  )
81
- task.print_out(f'Write modified HTML to: {list_page_file_path}')
103
+ html_content = re.sub(regex, subst, html_content, 0, re.MULTILINE)
104
+ task.print_out(f"Write modified HTML to: {list_page_file_path}")
82
105
  await write_text_file_async(list_page_file_path, html_content)
83
106
 
84
107
 
@@ -91,27 +114,40 @@ async def add_column_to_delete_page(
91
114
  kebab_entity_name: str,
92
115
  kebab_column_name: str,
93
116
  snake_column_name: str,
94
- capitalized_human_readable_column_name: str
117
+ capitalized_human_readable_column_name: str,
95
118
  ):
96
119
  list_page_file_path = os.path.join(
97
- project_dir, 'src', kebab_app_name, 'src', 'frontend', 'src', 'routes',
98
- kebab_module_name, kebab_entity_name, 'delete', '[id]', '+page.svelte'
120
+ project_dir,
121
+ "src",
122
+ kebab_app_name,
123
+ "src",
124
+ "frontend",
125
+ "src",
126
+ "routes",
127
+ kebab_module_name,
128
+ kebab_entity_name,
129
+ "delete",
130
+ "[id]",
131
+ "+page.svelte",
99
132
  )
100
- task.print_out(f'Read HTML from: {list_page_file_path}')
133
+ task.print_out(f"Read HTML from: {list_page_file_path}")
101
134
  html_content = await read_text_file_async(list_page_file_path)
102
- task.print_out('Add field to delete page')
135
+ task.print_out("Add field to delete page")
103
136
  regex = r"(.*)(<!-- DON'T DELETE: insert new field here-->)"
104
- subst = '\\n'.join([
105
- '\\1<div class="mb-4">',
106
- f'\\1 <label class="block text-gray-700 font-bold mb-2" for="{kebab_column_name}">{capitalized_human_readable_column_name}</label>', # noqa
107
- f'\\1 <span id="{kebab_column_name}">' + '{row.' + snake_column_name + '}</span>', # noqa
108
- '\\1</div>',
109
- '\\1\\2'
110
- ])
111
- html_content = re.sub(
112
- regex, subst, html_content, 0, re.MULTILINE
137
+ subst = "\\n".join(
138
+ [
139
+ '\\1<div class="mb-4">',
140
+ f'\\1 <label class="block text-gray-700 font-bold mb-2" for="{kebab_column_name}">{capitalized_human_readable_column_name}</label>', # noqa
141
+ f'\\1 <span id="{kebab_column_name}">'
142
+ + "{row."
143
+ + snake_column_name
144
+ + "}</span>", # noqa
145
+ "\\1</div>",
146
+ "\\1\\2",
147
+ ]
113
148
  )
114
- task.print_out(f'Write modified HTML to: {list_page_file_path}')
149
+ html_content = re.sub(regex, subst, html_content, 0, re.MULTILINE)
150
+ task.print_out(f"Write modified HTML to: {list_page_file_path}")
115
151
  await write_text_file_async(list_page_file_path, html_content)
116
152
 
117
153
 
@@ -124,27 +160,40 @@ async def add_column_to_detail_page(
124
160
  kebab_entity_name: str,
125
161
  kebab_column_name: str,
126
162
  snake_column_name: str,
127
- capitalized_human_readable_column_name: str
163
+ capitalized_human_readable_column_name: str,
128
164
  ):
129
165
  list_page_file_path = os.path.join(
130
- project_dir, 'src', kebab_app_name, 'src', 'frontend', 'src', 'routes',
131
- kebab_module_name, kebab_entity_name, 'detail', '[id]', '+page.svelte'
166
+ project_dir,
167
+ "src",
168
+ kebab_app_name,
169
+ "src",
170
+ "frontend",
171
+ "src",
172
+ "routes",
173
+ kebab_module_name,
174
+ kebab_entity_name,
175
+ "detail",
176
+ "[id]",
177
+ "+page.svelte",
132
178
  )
133
- task.print_out(f'Read HTML from: {list_page_file_path}')
179
+ task.print_out(f"Read HTML from: {list_page_file_path}")
134
180
  html_content = await read_text_file_async(list_page_file_path)
135
- task.print_out('Add field to detail page')
181
+ task.print_out("Add field to detail page")
136
182
  regex = r"(.*)(<!-- DON'T DELETE: insert new field here-->)"
137
- subst = '\\n'.join([
138
- '\\1<div class="mb-4">',
139
- f'\\1 <label class="block text-gray-700 font-bold mb-2" for="{kebab_column_name}">{capitalized_human_readable_column_name}</label>', # noqa
140
- f'\\1 <span id="{kebab_column_name}">' + '{row.' + snake_column_name + '}</span>', # noqa
141
- '\\1</div>',
142
- '\\1\\2'
143
- ])
144
- html_content = re.sub(
145
- regex, subst, html_content, 0, re.MULTILINE
183
+ subst = "\\n".join(
184
+ [
185
+ '\\1<div class="mb-4">',
186
+ f'\\1 <label class="block text-gray-700 font-bold mb-2" for="{kebab_column_name}">{capitalized_human_readable_column_name}</label>', # noqa
187
+ f'\\1 <span id="{kebab_column_name}">'
188
+ + "{row."
189
+ + snake_column_name
190
+ + "}</span>", # noqa
191
+ "\\1</div>",
192
+ "\\1\\2",
193
+ ]
146
194
  )
147
- task.print_out(f'Write modified HTML to: {list_page_file_path}')
195
+ html_content = re.sub(regex, subst, html_content, 0, re.MULTILINE)
196
+ task.print_out(f"Write modified HTML to: {list_page_file_path}")
148
197
  await write_text_file_async(list_page_file_path, html_content)
149
198
 
150
199
 
@@ -156,35 +205,35 @@ async def add_column_to_list_page(
156
205
  kebab_module_name: str,
157
206
  kebab_entity_name: str,
158
207
  snake_column_name: str,
159
- capitalized_human_readable_column_name: str
208
+ capitalized_human_readable_column_name: str,
160
209
  ):
161
210
  list_page_file_path = os.path.join(
162
- project_dir, 'src', kebab_app_name, 'src', 'frontend', 'src', 'routes',
163
- kebab_module_name, kebab_entity_name, '+page.svelte'
211
+ project_dir,
212
+ "src",
213
+ kebab_app_name,
214
+ "src",
215
+ "frontend",
216
+ "src",
217
+ "routes",
218
+ kebab_module_name,
219
+ kebab_entity_name,
220
+ "+page.svelte",
164
221
  )
165
- task.print_out(f'Read HTML from: {list_page_file_path}')
222
+ task.print_out(f"Read HTML from: {list_page_file_path}")
166
223
  html_content = await read_text_file_async(list_page_file_path)
167
224
  # process header
168
- task.print_out('Add column header to table')
225
+ task.print_out("Add column header to table")
169
226
  header_regex = r"(.*)(<!-- DON'T DELETE: insert new column header here-->)"
170
- header_subst = '\\n'.join([
171
- f'\\1<th>{capitalized_human_readable_column_name}</th>',
172
- '\\1\\2'
173
- ])
174
- html_content = re.sub(
175
- header_regex, header_subst, html_content, 0, re.MULTILINE
227
+ header_subst = "\\n".join(
228
+ [f"\\1<th>{capitalized_human_readable_column_name}</th>", "\\1\\2"]
176
229
  )
230
+ html_content = re.sub(header_regex, header_subst, html_content, 0, re.MULTILINE)
177
231
  # process column
178
- task.print_out('Add column to table')
232
+ task.print_out("Add column to table")
179
233
  column_regex = r"(.*)(<!-- DON'T DELETE: insert new column here-->)"
180
- column_subst = '\\n'.join([
181
- '\\1<td>{row.' + snake_column_name + '}</td>',
182
- '\\1\\2'
183
- ])
184
- html_content = re.sub(
185
- column_regex, column_subst, html_content, 0, re.MULTILINE
186
- )
187
- task.print_out(f'Write modified HTML to: {list_page_file_path}')
234
+ column_subst = "\\n".join(["\\1<td>{row." + snake_column_name + "}</td>", "\\1\\2"])
235
+ html_content = re.sub(column_regex, column_subst, html_content, 0, re.MULTILINE)
236
+ task.print_out(f"Write modified HTML to: {list_page_file_path}")
188
237
  await write_text_file_async(list_page_file_path, html_content)
189
238
 
190
239
 
@@ -196,29 +245,30 @@ async def add_column_to_test(
196
245
  snake_module_name: str,
197
246
  snake_entity_name: str,
198
247
  snake_column_name: str,
199
- column_type: str
248
+ column_type: str,
200
249
  ):
201
250
  test_file_path = os.path.join(
202
- project_dir, 'src', kebab_app_name, 'test', snake_module_name,
203
- f'test_{snake_entity_name}.py'
251
+ project_dir,
252
+ "src",
253
+ kebab_app_name,
254
+ "test",
255
+ snake_module_name,
256
+ f"test_{snake_entity_name}.py",
204
257
  )
205
- task.print_out(f'Read code from: {test_file_path}')
258
+ task.print_out(f"Read code from: {test_file_path}")
206
259
  code = await read_text_file_async(test_file_path)
207
- task.print_out(
208
- f'Add column "{snake_column_name}" to the test'
209
- )
260
+ task.print_out(f'Add column "{snake_column_name}" to the test')
210
261
  dict_names = [
211
- 'inserted_success_data', 'to_be_updated_success_data',
212
- 'updated_success_data', 'to_be_deleted_success_data'
262
+ "inserted_success_data",
263
+ "to_be_updated_success_data",
264
+ "updated_success_data",
265
+ "to_be_deleted_success_data",
213
266
  ]
214
267
  for dict_name in dict_names:
215
268
  code = add_key_value_to_dict(
216
- code=code,
217
- dict_name=dict_name,
218
- key=f"'{snake_column_name}'",
219
- value="''"
269
+ code=code, dict_name=dict_name, key=f"'{snake_column_name}'", value="''"
220
270
  )
221
- task.print_out(f'Write modified code to: {test_file_path}')
271
+ task.print_out(f"Write modified code to: {test_file_path}")
222
272
  await write_text_file_async(test_file_path, code)
223
273
 
224
274
 
@@ -231,24 +281,28 @@ async def add_column_to_schema(
231
281
  snake_entity_name: str,
232
282
  pascal_entity_name: str,
233
283
  snake_column_name: str,
234
- column_type: str
284
+ column_type: str,
235
285
  ):
236
286
  schema_file_path = os.path.join(
237
- project_dir, 'src', kebab_app_name, 'src', 'module', snake_module_name,
238
- 'schema', f'{snake_entity_name}.py'
287
+ project_dir,
288
+ "src",
289
+ kebab_app_name,
290
+ "src",
291
+ "module",
292
+ snake_module_name,
293
+ "schema",
294
+ f"{snake_entity_name}.py",
239
295
  )
240
- task.print_out(f'Read code from: {schema_file_path}')
296
+ task.print_out(f"Read code from: {schema_file_path}")
241
297
  code = await read_text_file_async(schema_file_path)
242
- task.print_out(
243
- f'Add column "{snake_column_name}" to the schema'
244
- )
298
+ task.print_out(f'Add column "{snake_column_name}" to the schema')
245
299
  code = add_property_to_class(
246
300
  code=code,
247
- class_name=f'{pascal_entity_name}Data',
301
+ class_name=f"{pascal_entity_name}Data",
248
302
  property_name=snake_column_name,
249
- property_type='str'
303
+ property_type="str",
250
304
  )
251
- task.print_out(f'Write modified code to: {schema_file_path}')
305
+ task.print_out(f"Write modified code to: {schema_file_path}")
252
306
  await write_text_file_async(schema_file_path, code)
253
307
 
254
308
 
@@ -261,23 +315,28 @@ async def add_column_to_repo(
261
315
  snake_entity_name: str,
262
316
  pascal_entity_name: str,
263
317
  snake_column_name: str,
264
- column_type: str
318
+ column_type: str,
265
319
  ):
266
320
  repo_file_path = os.path.join(
267
- project_dir, 'src', kebab_app_name, 'src', 'module', snake_module_name,
268
- 'entity', snake_entity_name, 'repo.py'
321
+ project_dir,
322
+ "src",
323
+ kebab_app_name,
324
+ "src",
325
+ "module",
326
+ snake_module_name,
327
+ "entity",
328
+ snake_entity_name,
329
+ "repo.py",
269
330
  )
270
- task.print_out(f'Read code from: {repo_file_path}')
331
+ task.print_out(f"Read code from: {repo_file_path}")
271
332
  code = await read_text_file_async(repo_file_path)
272
- task.print_out(
273
- f'Add column "{snake_column_name}" to the repo'
274
- )
333
+ task.print_out(f'Add column "{snake_column_name}" to the repo')
275
334
  code = add_property_to_class(
276
335
  code=code,
277
- class_name=f'DBEntity{pascal_entity_name}',
336
+ class_name=f"DBEntity{pascal_entity_name}",
278
337
  property_name=snake_column_name,
279
- property_type='Column',
280
- property_value='Column(String)'
338
+ property_type="Column",
339
+ property_value="Column(String)",
281
340
  )
282
- task.print_out(f'Write modified code to: {repo_file_path}')
341
+ task.print_out(f"Write modified code to: {repo_file_path}")
283
342
  await write_text_file_async(repo_file_path, code)
@@ -1,22 +1,29 @@
1
- from zrb.helper.typing import Any
2
- from zrb.builtin.generator.fastapp_module.helper import (
3
- create_microservice_config, register_module, register_migration,
4
- create_app_config, append_all_enabled_env, append_all_disabled_env,
5
- append_src_template_env, append_deployment_template_env
6
- )
1
+ import asyncio
2
+ import os
3
+
7
4
  from zrb.builtin.generator.common.helper import validate_existing_project_dir
8
5
  from zrb.builtin.generator.common.task_input import (
9
- project_dir_input, app_name_input, module_name_input
6
+ app_name_input,
7
+ module_name_input,
8
+ project_dir_input,
9
+ )
10
+ from zrb.builtin.generator.fastapp_module.helper import (
11
+ append_all_disabled_env,
12
+ append_all_enabled_env,
13
+ append_deployment_template_env,
14
+ append_src_template_env,
15
+ create_app_config,
16
+ create_microservice_config,
17
+ register_migration,
18
+ register_module,
10
19
  )
11
20
  from zrb.builtin.group import project_add_group
12
- from zrb.task.task import Task
21
+ from zrb.helper import util
22
+ from zrb.helper.typing import Any
23
+ from zrb.runner import runner
13
24
  from zrb.task.decorator import python_task
14
25
  from zrb.task.resource_maker import ResourceMaker
15
- from zrb.runner import runner
16
- from zrb.helper import util
17
-
18
- import asyncio
19
- import os
26
+ from zrb.task.task import Task
20
27
 
21
28
  CURRENT_DIR = os.path.dirname(__file__)
22
29
 
@@ -26,35 +33,31 @@ CURRENT_DIR = os.path.dirname(__file__)
26
33
 
27
34
 
28
35
  @python_task(
29
- name='validate',
36
+ name="validate",
30
37
  inputs=[project_dir_input, app_name_input, module_name_input],
31
38
  retry=0,
32
39
  )
33
40
  async def validate(*args: Any, **kwargs: Any):
34
- project_dir = kwargs.get('project_dir')
41
+ project_dir = kwargs.get("project_dir")
35
42
  validate_existing_project_dir(project_dir)
36
- app_name = kwargs.get('app_name')
37
- module_name = kwargs.get('module_name')
43
+ app_name = kwargs.get("app_name")
44
+ module_name = kwargs.get("module_name")
38
45
  snake_module_name = util.to_snake_case(module_name)
39
46
  automation_dir = os.path.join(
40
- project_dir, '_automate', util.to_snake_case(app_name)
47
+ project_dir, "_automate", util.to_snake_case(app_name)
41
48
  )
42
49
  if not os.path.exists(automation_dir):
43
- raise Exception(
44
- f'Automation directory does not exist: {automation_dir}'
45
- )
46
- app_dir = os.path.join(
47
- project_dir, 'src', f'{util.to_kebab_case(app_name)}'
48
- )
50
+ raise Exception(f"Automation directory does not exist: {automation_dir}")
51
+ app_dir = os.path.join(project_dir, "src", f"{util.to_kebab_case(app_name)}")
49
52
  if not os.path.exists(app_dir):
50
- raise Exception(f'App directory does not exist: {app_dir}')
51
- module_path = os.path.join(app_dir, 'src', 'module', snake_module_name)
53
+ raise Exception(f"App directory does not exist: {app_dir}")
54
+ module_path = os.path.join(app_dir, "src", "module", snake_module_name)
52
55
  if os.path.exists(module_path):
53
- raise Exception(f'Module directory already exists: {module_path}')
56
+ raise Exception(f"Module directory already exists: {module_path}")
54
57
 
55
58
 
56
59
  copy_resource = ResourceMaker(
57
- name='copy-resource',
60
+ name="copy-resource",
58
61
  inputs=[
59
62
  project_dir_input,
60
63
  app_name_input,
@@ -62,59 +65,79 @@ copy_resource = ResourceMaker(
62
65
  ],
63
66
  upstreams=[validate],
64
67
  replacements={
65
- 'zrbAppName': '{{input.app_name}}',
66
- 'zrbModuleName': '{{input.module_name}}',
68
+ "zrbAppName": "{{input.app_name}}",
69
+ "zrbModuleName": "{{input.module_name}}",
67
70
  },
68
- template_path=os.path.join(CURRENT_DIR, 'template'),
69
- destination_path='{{ input.project_dir }}',
71
+ template_path=os.path.join(CURRENT_DIR, "template"),
72
+ destination_path="{{ input.project_dir }}",
70
73
  excludes=[
71
- '*/__pycache__',
72
- ]
74
+ "*/__pycache__",
75
+ ],
73
76
  )
74
77
 
75
78
 
76
79
  @python_task(
77
- name='fastapp-module',
80
+ name="fastapp-module",
78
81
  group=project_add_group,
79
82
  upstreams=[copy_resource],
80
- runner=runner
83
+ runner=runner,
81
84
  )
82
85
  async def add_fastapp_module(*args: Any, **kwargs: Any):
83
- task: Task = kwargs.get('_task')
84
- project_dir = kwargs.get('project_dir', '.')
85
- app_name = kwargs.get('app_name')
86
- module_name = kwargs.get('module_name')
86
+ task: Task = kwargs.get("_task")
87
+ project_dir = kwargs.get("project_dir", ".")
88
+ app_name = kwargs.get("app_name")
89
+ module_name = kwargs.get("module_name")
87
90
  kebab_app_name = util.to_kebab_case(app_name)
88
91
  snake_app_name = util.to_snake_case(app_name)
89
92
  kebab_module_name = util.to_kebab_case(module_name)
90
93
  snake_module_name = util.to_snake_case(module_name)
91
94
  upper_snake_module_name = snake_module_name.upper()
92
95
  await asyncio.gather(
93
- asyncio.create_task(create_microservice_config(
94
- task, project_dir, kebab_app_name, snake_app_name,
95
- kebab_module_name, snake_module_name, upper_snake_module_name
96
- )),
97
- asyncio.create_task(register_module(
98
- task, project_dir, kebab_app_name, snake_module_name
99
- )),
100
- asyncio.create_task(register_migration(
101
- task, project_dir, kebab_app_name, snake_module_name
102
- )),
103
- asyncio.create_task(create_app_config(
104
- task, project_dir, kebab_app_name, snake_module_name,
105
- upper_snake_module_name
106
- )),
107
- asyncio.create_task(append_all_enabled_env(
108
- task, project_dir, kebab_app_name, upper_snake_module_name
109
- )),
110
- asyncio.create_task(append_all_disabled_env(
111
- task, project_dir, kebab_app_name, upper_snake_module_name
112
- )),
113
- asyncio.create_task(append_src_template_env(
114
- task, project_dir, kebab_app_name, upper_snake_module_name
115
- )),
116
- asyncio.create_task(append_deployment_template_env(
117
- task, project_dir, kebab_app_name, upper_snake_module_name
118
- )),
96
+ asyncio.create_task(
97
+ create_microservice_config(
98
+ task,
99
+ project_dir,
100
+ kebab_app_name,
101
+ snake_app_name,
102
+ kebab_module_name,
103
+ snake_module_name,
104
+ upper_snake_module_name,
105
+ )
106
+ ),
107
+ asyncio.create_task(
108
+ register_module(task, project_dir, kebab_app_name, snake_module_name)
109
+ ),
110
+ asyncio.create_task(
111
+ register_migration(task, project_dir, kebab_app_name, snake_module_name)
112
+ ),
113
+ asyncio.create_task(
114
+ create_app_config(
115
+ task,
116
+ project_dir,
117
+ kebab_app_name,
118
+ snake_module_name,
119
+ upper_snake_module_name,
120
+ )
121
+ ),
122
+ asyncio.create_task(
123
+ append_all_enabled_env(
124
+ task, project_dir, kebab_app_name, upper_snake_module_name
125
+ )
126
+ ),
127
+ asyncio.create_task(
128
+ append_all_disabled_env(
129
+ task, project_dir, kebab_app_name, upper_snake_module_name
130
+ )
131
+ ),
132
+ asyncio.create_task(
133
+ append_src_template_env(
134
+ task, project_dir, kebab_app_name, upper_snake_module_name
135
+ )
136
+ ),
137
+ asyncio.create_task(
138
+ append_deployment_template_env(
139
+ task, project_dir, kebab_app_name, upper_snake_module_name
140
+ )
141
+ ),
119
142
  )
120
- task.print_out('Success')
143
+ task.print_out("Success")