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
@@ -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,
|
23
|
-
|
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
|
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(
|
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 =
|
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(
|
43
|
+
task.print_out("Add field to insert page")
|
37
44
|
field_regex = r"(.*)(<!-- DON'T DELETE: insert new field here-->)"
|
38
|
-
field_subst =
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
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,
|
65
|
-
|
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
|
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(
|
89
|
+
task.print_out("Add field to update page")
|
70
90
|
regex = r"(.*)(<!-- DON'T DELETE: insert new field here-->)"
|
71
|
-
subst =
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
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
|
-
|
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,
|
98
|
-
|
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
|
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(
|
135
|
+
task.print_out("Add field to delete page")
|
103
136
|
regex = r"(.*)(<!-- DON'T DELETE: insert new field here-->)"
|
104
|
-
subst =
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
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
|
-
|
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,
|
131
|
-
|
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
|
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(
|
181
|
+
task.print_out("Add field to detail page")
|
136
182
|
regex = r"(.*)(<!-- DON'T DELETE: insert new field here-->)"
|
137
|
-
subst =
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
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
|
-
|
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,
|
163
|
-
|
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
|
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(
|
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 =
|
171
|
-
f
|
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(
|
232
|
+
task.print_out("Add column to table")
|
179
233
|
column_regex = r"(.*)(<!-- DON'T DELETE: insert new column here-->)"
|
180
|
-
column_subst =
|
181
|
-
|
182
|
-
|
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,
|
203
|
-
|
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
|
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
|
-
|
212
|
-
|
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
|
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,
|
238
|
-
|
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
|
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
|
301
|
+
class_name=f"{pascal_entity_name}Data",
|
248
302
|
property_name=snake_column_name,
|
249
|
-
property_type=
|
303
|
+
property_type="str",
|
250
304
|
)
|
251
|
-
task.print_out(f
|
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,
|
268
|
-
|
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
|
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
|
336
|
+
class_name=f"DBEntity{pascal_entity_name}",
|
278
337
|
property_name=snake_column_name,
|
279
|
-
property_type=
|
280
|
-
property_value=
|
338
|
+
property_type="Column",
|
339
|
+
property_value="Column(String)",
|
281
340
|
)
|
282
|
-
task.print_out(f
|
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
|
-
|
2
|
-
|
3
|
-
|
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
|
-
|
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.
|
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.
|
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=
|
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(
|
41
|
+
project_dir = kwargs.get("project_dir")
|
35
42
|
validate_existing_project_dir(project_dir)
|
36
|
-
app_name = kwargs.get(
|
37
|
-
module_name = kwargs.get(
|
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,
|
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
|
-
|
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
|
51
|
-
module_path = os.path.join(app_dir,
|
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
|
56
|
+
raise Exception(f"Module directory already exists: {module_path}")
|
54
57
|
|
55
58
|
|
56
59
|
copy_resource = ResourceMaker(
|
57
|
-
name=
|
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
|
-
|
66
|
-
|
68
|
+
"zrbAppName": "{{input.app_name}}",
|
69
|
+
"zrbModuleName": "{{input.module_name}}",
|
67
70
|
},
|
68
|
-
template_path=os.path.join(CURRENT_DIR,
|
69
|
-
destination_path=
|
71
|
+
template_path=os.path.join(CURRENT_DIR, "template"),
|
72
|
+
destination_path="{{ input.project_dir }}",
|
70
73
|
excludes=[
|
71
|
-
|
72
|
-
]
|
74
|
+
"*/__pycache__",
|
75
|
+
],
|
73
76
|
)
|
74
77
|
|
75
78
|
|
76
79
|
@python_task(
|
77
|
-
name=
|
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(
|
84
|
-
project_dir = kwargs.get(
|
85
|
-
app_name = kwargs.get(
|
86
|
-
module_name = kwargs.get(
|
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(
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
)
|
107
|
-
asyncio.create_task(
|
108
|
-
task, project_dir, kebab_app_name,
|
109
|
-
)
|
110
|
-
asyncio.create_task(
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
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(
|
143
|
+
task.print_out("Success")
|