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.
- zrb/__init__.py +24 -20
- zrb/__main__.py +5 -5
- zrb/action/runner.py +22 -30
- zrb/advertisement.py +10 -9
- zrb/builtin/__init__.py +18 -16
- zrb/builtin/base64.py +13 -18
- zrb/builtin/devtool/__init__.py +14 -3
- zrb/builtin/devtool/devtool_install.py +207 -221
- zrb/builtin/env.py +9 -12
- zrb/builtin/eval.py +9 -9
- zrb/builtin/explain.py +73 -74
- zrb/builtin/generator/__init__.py +7 -11
- zrb/builtin/generator/app_generator/add.py +86 -87
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/add.py +78 -77
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/_checker.py +6 -6
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/_common.py +14 -15
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/container.py +32 -32
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/deployment.py +29 -30
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/image.py +1 -3
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/local.py +5 -4
- 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
- zrb/builtin/generator/app_generator/template/build-custom-image/_automate/generate_snake_zrb_meta_template_name/add.py +89 -87
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- zrb/builtin/generator/cmd_task/add.py +23 -25
- zrb/builtin/generator/cmd_task/template/_automate/snake_zrb_task_name.py +3 -5
- zrb/builtin/generator/common/helper.py +15 -20
- zrb/builtin/generator/common/task_factory.py +29 -26
- zrb/builtin/generator/common/task_input.py +97 -91
- zrb/builtin/generator/docker_compose_task/add.py +38 -39
- zrb/builtin/generator/docker_compose_task/template/_automate/snake_zrb_task_name.py +13 -19
- zrb/builtin/generator/docker_compose_task/template/src/kebab-zrb-task-name/image/main.py +18 -14
- zrb/builtin/generator/fastapp/add.py +94 -90
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_checker.py +28 -27
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_config.py +68 -39
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_env.py +24 -22
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_env_file.py +12 -12
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_get_start_microservices.py +43 -41
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_helper.py +23 -24
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_input.py +21 -20
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-load-test.sh +1 -1
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-start.sh +1 -1
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-test.sh +2 -2
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/container.py +46 -39
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/deployment.py +28 -20
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/frontend.py +21 -27
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/image.py +23 -18
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/load_test.py +35 -36
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/local.py +68 -58
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/test.py +24 -38
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/__main__.py +23 -21
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/_common.py +72 -75
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/app_helper.py +70 -75
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/helm_postgresql_helper.py +18 -21
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/helm_rabbitmq_helper.py +11 -19
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/helm_redpanda_helper.py +18 -15
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/helm_signoz_helper.py +17 -21
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/docker-compose.yml +12 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/loadtest/locustfile.py +10 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/Dockerfile +1 -0
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/app.py +35 -30
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/app_lifespan.py +21 -17
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/app_state.py +3 -2
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/db_connection.py +18 -20
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/frontend_index.py +5 -6
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/log.py +7 -15
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/messagebus.py +38 -34
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/rpc.py +19 -18
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/config.py +68 -103
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/error.py +11 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/__init__.py +2 -4
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/kafka/admin.py +38 -35
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/kafka/consumer.py +38 -45
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/kafka/publisher.py +26 -29
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/messagebus.py +8 -14
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/mock.py +12 -8
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/rabbitmq/admin.py +37 -44
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/rabbitmq/consumer.py +42 -67
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/rabbitmq/publisher.py +32 -55
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/model/repo_model.py +11 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/__init__.py +2 -2
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/db_entity_mixin.py +3 -6
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/db_repo.py +76 -83
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/repo.py +5 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/search_filter.py +1 -0
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/rpc/__init__.py +1 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/rpc/messagebus/caller.py +17 -19
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/rpc/messagebus/server.py +14 -18
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/rpc/rpc.py +15 -28
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/schema/__init__.py +1 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/schema/base_schema.py +6 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/serializer/__init__.py +1 -3
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/serializer/serializer.py +3 -4
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/helper/async_task.py +3 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/helper/conversion.py +10 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/helper/migration.py +6 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/migrate.py +3 -2
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/api.py +7 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/__init__.py +4 -6
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/access_token_scheme.py +9 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/access_token_util.py +6 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/authorizer.py +4 -4
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/bearer_token_scheme.py +1 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/model/user_model.py +8 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/password_hasher.py +1 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/refresh_token_util.py +7 -6
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/repo/group_repo.py +3 -8
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/repo/permission_repo.py +3 -7
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/repo/user_repo.py +3 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/user.py +12 -7
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/__init__.py +7 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/access_token/scheme.py +7 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/access_token/util.py +20 -30
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/authorizer/authorizer.py +1 -3
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/authorizer/rpc_authorizer.py +5 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/password_hasher/bcrypt_password_hasher.py +3 -8
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/password_hasher/password_hasher.py +0 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/refresh_token/util.py +15 -21
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/group/api.py +42 -49
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/group/model.py +3 -7
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/group/repo.py +18 -16
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/group/rpc.py +26 -41
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/api.py +46 -51
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/model.py +5 -7
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/repo.py +11 -8
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/rpc.py +28 -45
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/table.py +10 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/user/api.py +60 -72
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/user/model.py +32 -61
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/user/repo.py +33 -36
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/user/rpc.py +42 -61
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/event.py +2 -4
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/migrate.py +3 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/register_module.py +11 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/register_permission.py +19 -26
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/rpc.py +5 -13
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/group.py +6 -4
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/permission.py +3 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/request.py +1 -0
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/token.py +2 -2
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/user.py +4 -3
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/api.py +4 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/component/model/activity_model.py +3 -9
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/component/repo/activity_repo.py +3 -7
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/core/historical_repo_model.py +13 -13
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/api.py +22 -23
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/event.py +5 -7
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/model.py +2 -6
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/repo.py +8 -8
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/rpc.py +28 -45
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/table.py +3 -3
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/event.py +4 -8
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/migrate.py +2 -4
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/register_module.py +10 -11
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/rpc.py +3 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/schema/activity.py +3 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/requirements.txt +12 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/auth/test_group_crud.py +76 -106
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/auth/test_permission_crud.py +73 -103
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/auth/test_user_crud.py +92 -122
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/auth/test_user_login.py +107 -134
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/conftest.py +2 -2
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/test_liveness_and_readiness.py +8 -15
- zrb/builtin/generator/fastapp_crud/add.py +74 -79
- zrb/builtin/generator/fastapp_crud/helper.py +51 -48
- zrb/builtin/generator/fastapp_crud/task_factory.py +17 -14
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/test/snake_zrb_module_name/test_snake_zrb_entity_name.py +68 -98
- zrb/builtin/generator/fastapp_field/add.py +143 -85
- zrb/builtin/generator/fastapp_field/helper.py +184 -125
- zrb/builtin/generator/fastapp_module/add.py +90 -67
- zrb/builtin/generator/fastapp_module/helper.py +141 -155
- zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/api.py +3 -2
- zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/table.py +3 -3
- zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/event.py +3 -5
- zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/migrate.py +2 -4
- zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/register_module.py +10 -11
- zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/rpc.py +3 -5
- zrb/builtin/generator/pip_package/add.py +39 -40
- zrb/builtin/generator/pip_package/template/_automate/snake_zrb_package_name/local.py +30 -30
- zrb/builtin/generator/pip_package/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/__init__.py +1 -0
- zrb/builtin/generator/pip_package/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/__main__.py +1 -0
- zrb/builtin/generator/pip_package/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/util.py +2 -2
- zrb/builtin/generator/plugin/create.py +39 -36
- zrb/builtin/generator/plugin/template/src/snake_zrb_package_name/__init__.py +1 -1
- zrb/builtin/generator/plugin/template/src/snake_zrb_package_name/__main__.py +1 -0
- zrb/builtin/generator/plugin/template/src/snake_zrb_package_name/task/example_task.py +6 -4
- zrb/builtin/generator/plugin/template/zrb_init.py +27 -27
- zrb/builtin/generator/project/create.py +38 -46
- zrb/builtin/generator/project/template/.flake8 +3 -0
- zrb/builtin/generator/project/template/project.sh +19 -10
- zrb/builtin/generator/project_task/task_factory.py +60 -61
- zrb/builtin/generator/project_task/template/_automate/_project/__init__.py +2 -2
- zrb/builtin/generator/project_task/template/_automate/_project/build_project_images.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/deploy_project.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/destroy_project.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/push_project_images.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/remove_project_containers.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/start_project.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/start_project_containers.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/stop_project_containers.py +4 -4
- zrb/builtin/generator/python_task/add.py +25 -33
- zrb/builtin/generator/python_task/template/_automate/snake_zrb_task_name.py +8 -7
- zrb/builtin/generator/simple_python_app/add.py +81 -75
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/_common.py +14 -15
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/container.py +46 -61
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/deployment.py +34 -32
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/image.py +19 -22
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/local.py +23 -25
- zrb/builtin/generator/simple_python_app/template/src/kebab-zrb-app-name/deployment/__main__.py +24 -32
- zrb/builtin/generator/simple_python_app/template/src/kebab-zrb-app-name/src/main.py +18 -14
- zrb/builtin/git.py +46 -46
- zrb/builtin/group.py +13 -34
- zrb/builtin/helper/reccuring_action.py +26 -29
- zrb/builtin/md5.py +17 -30
- zrb/builtin/process.py +19 -19
- zrb/builtin/project.py +13 -15
- zrb/builtin/say.py +69 -88
- zrb/builtin/schedule.py +15 -19
- zrb/builtin/ubuntu.py +44 -35
- zrb/builtin/update.py +5 -5
- zrb/builtin/version.py +3 -7
- zrb/builtin/watch_changes.py +24 -25
- zrb/config/config.py +19 -18
- zrb/helper/accessories/color.py +18 -6
- zrb/helper/accessories/icon.py +24 -3
- zrb/helper/accessories/name.py +120 -28
- zrb/helper/advertisement.py +9 -13
- zrb/helper/callable.py +2 -4
- zrb/helper/cli.py +27 -31
- zrb/helper/codemod/add_argument_to_function.py +3 -4
- zrb/helper/codemod/add_argument_to_function_call.py +4 -7
- zrb/helper/codemod/add_assert_resource.py +7 -7
- zrb/helper/codemod/add_function_call.py +3 -5
- zrb/helper/codemod/add_import_module.py +15 -26
- zrb/helper/codemod/add_key_value_to_dict.py +7 -10
- zrb/helper/codemod/add_property_to_class.py +10 -8
- zrb/helper/codemod/add_upstream_to_task.py +21 -33
- zrb/helper/codemod/append_code_to_function.py +6 -13
- zrb/helper/codemod/format_code.py +2 -1
- zrb/helper/default_env.py +25 -25
- zrb/helper/docker_compose/fetch_external_env.py +18 -18
- zrb/helper/docker_compose/file.py +5 -4
- zrb/helper/docstring.py +44 -47
- zrb/helper/env_map/fetch.py +7 -12
- zrb/helper/file/copy_tree.py +12 -17
- zrb/helper/file/match.py +6 -7
- zrb/helper/file/text.py +8 -6
- zrb/helper/git/detect_changes.py +9 -8
- zrb/helper/loader/load_module.py +14 -13
- zrb/helper/log.py +4 -3
- zrb/helper/map/conversion.py +4 -5
- zrb/helper/python_task.py +2 -4
- zrb/helper/render_data.py +25 -18
- zrb/helper/string/constant.py +2 -2
- zrb/helper/string/conversion.py +17 -16
- zrb/helper/string/jinja.py +2 -2
- zrb/helper/typecheck.py +6 -4
- zrb/helper/typing.py +10 -2
- zrb/helper/util.py +44 -40
- zrb/task/any_task.py +251 -251
- zrb/task/base_remote_cmd_task.py +76 -59
- zrb/task/base_task/base_task.py +95 -108
- zrb/task/base_task/component/base_task_model.py +73 -71
- zrb/task/base_task/component/common_task_model.py +42 -29
- zrb/task/base_task/component/pid_model.py +3 -5
- zrb/task/base_task/component/renderer.py +26 -36
- zrb/task/base_task/component/trackers.py +6 -9
- zrb/task/checker.py +14 -9
- zrb/task/cmd_task.py +102 -100
- zrb/task/decorator.py +19 -13
- zrb/task/docker_compose_task.py +127 -98
- zrb/task/flow_task.py +16 -19
- zrb/task/http_checker.py +40 -36
- zrb/task/notifier.py +50 -38
- zrb/task/parallel.py +3 -3
- zrb/task/path_checker.py +34 -27
- zrb/task/path_watcher.py +49 -40
- zrb/task/port_checker.py +33 -26
- zrb/task/recurring_task.py +36 -42
- zrb/task/remote_cmd_task.py +31 -28
- zrb/task/resource_maker.py +66 -52
- zrb/task/rsync_task.py +24 -21
- zrb/task/task.py +4 -3
- zrb/task/time_watcher.py +36 -31
- zrb/task_env/constant.py +1 -1
- zrb/task_env/env.py +33 -31
- zrb/task_env/env_file.py +24 -23
- zrb/task_group/group.py +27 -30
- zrb/task_input/any_input.py +18 -16
- zrb/task_input/base_input.py +26 -26
- zrb/task_input/bool_input.py +6 -6
- zrb/task_input/choice_input.py +11 -9
- zrb/task_input/constant.py +1 -1
- zrb/task_input/float_input.py +6 -5
- zrb/task_input/int_input.py +8 -8
- zrb/task_input/password_input.py +9 -9
- zrb/task_input/str_input.py +8 -8
- zrb/task_input/task_input.py +4 -2
- {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/METADATA +3 -1
- {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/RECORD +316 -315
- {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/LICENSE +0 -0
- {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/WHEEL +0 -0
- {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=
|
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[
|
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(
|
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=
|
29
|
-
colored_value = colored(value, attrs=[
|
30
|
-
env_lines.append(f
|
31
|
-
line_separator =
|
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=
|
12
|
+
name="eval",
|
13
13
|
inputs=[
|
14
14
|
StrInput(
|
15
|
-
name=
|
16
|
-
shortcut=
|
17
|
-
default=
|
18
|
-
description=
|
15
|
+
name="expression",
|
16
|
+
shortcut="e",
|
17
|
+
default="",
|
18
|
+
description="Python expression",
|
19
19
|
)
|
20
20
|
],
|
21
|
-
description=
|
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(
|
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.
|
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=
|
13
|
+
name="solid-principle",
|
15
14
|
group=explain_group,
|
16
|
-
description=
|
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[
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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=
|
34
|
+
name="yagni-principle",
|
36
35
|
group=explain_group,
|
37
|
-
description=
|
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[
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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.',
|
50
|
-
|
51
|
-
|
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=
|
55
|
+
name="dry-principle",
|
57
56
|
group=explain_group,
|
58
|
-
description=
|
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[
|
64
|
-
|
65
|
-
|
66
|
-
|
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.',
|
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.',
|
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=
|
74
|
+
name="kiss-principle",
|
76
75
|
group=explain_group,
|
77
|
-
description=
|
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[
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
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.'
|
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=
|
92
|
+
name="zen-of-python",
|
94
93
|
group=explain_group,
|
95
|
-
description=
|
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[
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
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.
|
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.
|
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
|
-
|
2
|
-
|
1
|
+
import os
|
2
|
+
|
3
3
|
from zrb.builtin.generator.common.helper import (
|
4
|
-
validate_existing_project_dir,
|
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.
|
9
|
-
from zrb.
|
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=
|
28
|
-
shortcut=
|
29
|
-
description=
|
30
|
-
prompt=
|
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=
|
36
|
-
shortcut=
|
37
|
-
description=
|
38
|
-
prompt=
|
39
|
-
default=
|
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=
|
44
|
-
shortcut=
|
45
|
-
description=
|
46
|
-
prompt=
|
47
|
-
default=
|
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=
|
52
|
-
description=
|
53
|
-
prompt=
|
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=
|
59
|
-
description=
|
60
|
-
prompt=
|
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=
|
66
|
-
description=
|
67
|
-
prompt=
|
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=
|
73
|
-
description=
|
74
|
-
prompt=
|
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
|
-
|
95
|
-
|
96
|
-
|
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(
|
107
|
+
project_dir = kwargs.get("project_dir")
|
111
108
|
validate_existing_project_dir(project_dir)
|
112
|
-
template_name = kwargs.get(
|
109
|
+
template_name = kwargs.get("template_name")
|
113
110
|
validate_inexisting_automation(project_dir, template_name)
|
114
|
-
is_container_only_input: bool = kwargs.get(
|
115
|
-
build_custom_image_input: bool = kwargs.get(
|
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
|
-
|
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=
|
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,
|
128
|
-
destination_path=
|
129
|
-
excludes=[
|
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=
|
130
|
+
name="copy-http-port-resource",
|
134
131
|
inputs=inputs,
|
135
|
-
should_execute=
|
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,
|
139
|
-
destination_path=
|
140
|
-
excludes=[
|
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=
|
141
|
+
name="copy-custom-image-resource",
|
145
142
|
inputs=inputs,
|
146
|
-
should_execute=
|
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,
|
150
|
-
destination_path=
|
151
|
-
excludes=[
|
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=
|
152
|
+
name="copy-http-port-custom-image-resource",
|
156
153
|
inputs=inputs,
|
157
|
-
should_execute=
|
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(
|
161
|
-
|
162
|
-
|
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=
|
165
|
+
name="copy-helm-resource",
|
167
166
|
inputs=inputs,
|
168
|
-
should_execute=
|
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,
|
172
|
-
destination_path=
|
173
|
-
excludes=[
|
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=
|
176
|
+
name="copy-resource",
|
178
177
|
upstreams=[
|
179
178
|
copy_helm_resource,
|
180
179
|
],
|
181
|
-
cmd=
|
180
|
+
cmd="echo Resource copied",
|
182
181
|
)
|
183
182
|
|
184
183
|
register_module = create_register_module(
|
185
|
-
module_path=
|
186
|
-
alias=
|
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=
|
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(
|
201
|
-
task.print_out(
|
199
|
+
task: Task = kwargs.get("_task")
|
200
|
+
task.print_out("Success")
|