zrb 0.23.4__py3-none-any.whl → 0.24.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 +2 -0
- zrb/action/runner.py +6 -5
- zrb/advertisement.py +1 -2
- zrb/builtin/base64/decode.py +1 -1
- zrb/builtin/base64/encode.py +1 -1
- zrb/builtin/devtool/install/_helper.py +2 -1
- zrb/builtin/devtool/install/_input.py +2 -2
- zrb/builtin/env/get.py +3 -2
- zrb/builtin/eval.py +2 -1
- zrb/builtin/git/get_file_changes.py +2 -1
- zrb/builtin/md5/hash.py +1 -1
- zrb/builtin/md5/sum.py +1 -1
- zrb/builtin/project/_helper.py +3 -3
- zrb/builtin/project/add/app/generator/generator.py +1 -1
- zrb/builtin/project/add/app/generator/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/snake_zrb_generator_name/snake_zrb_generator_name.py +1 -1
- zrb/builtin/project/add/app/generator/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/snake_zrb_generator_name/template/_automate/snake_zrb_app_name/container/remove.py +1 -1
- zrb/builtin/project/add/app/generator/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/snake_zrb_generator_name/template/_automate/snake_zrb_app_name/container/start.py +6 -7
- zrb/builtin/project/add/app/generator/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/snake_zrb_generator_name/template/_automate/snake_zrb_app_name/container/stop.py +1 -1
- zrb/builtin/project/add/app/generator/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/snake_zrb_generator_name/template/src/kebab-zrb-app-name/docker-compose.yml +0 -2
- zrb/builtin/project/add/app/python/python.py +1 -1
- zrb/builtin/project/add/app/python/template/_automate/snake_zrb_app_name/container/remove.py +1 -1
- zrb/builtin/project/add/app/python/template/_automate/snake_zrb_app_name/container/start.py +6 -7
- zrb/builtin/project/add/app/python/template/_automate/snake_zrb_app_name/container/stop.py +1 -1
- zrb/builtin/project/add/app/python/template/src/kebab-zrb-app-name/docker-compose.yml +0 -2
- zrb/builtin/project/add/fastapp/app/app.py +3 -1
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/_helper.py +2 -53
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/_service_config.py +1 -1
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/microservices/_helper.py +2 -2
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/microservices/start.py +5 -6
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/monolith/_helper.py +2 -2
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/monolith/start.py +5 -6
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/support/_helper.py +5 -3
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/support/start.py +4 -6
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/frontend/build-once.sh +1 -1
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/frontend/build.sh +1 -1
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/microservices/_helper.py +3 -5
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/microservices/start.py +3 -3
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/microservices/{start_microservices.py → start_services.py} +2 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/.generator-version +1 -0
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/deployment/_common.py +5 -5
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/deployment/app_helper.py +5 -5
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/docker-compose.yml +2 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/loadtest/locustfile.py +1 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/loadtest/template.env +1 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/error.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/messagebus/kafka/admin.py +4 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/messagebus/kafka/consumer.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/messagebus/messagebus.py +4 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/messagebus/mock.py +4 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/messagebus/rabbitmq/admin.py +4 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/messagebus/rabbitmq/consumer.py +3 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/model/repo_model.py +3 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/repo/db_repo.py +7 -6
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/repo/repo.py +2 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/repo/search_filter.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/rpc/messagebus/caller.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/rpc/messagebus/server.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/rpc/rpc.py +3 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/serializer/serializer.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/config.py +59 -62
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/helper/async_task.py +1 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/integration/app/app.py +28 -28
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/integration/app/app_lifespan.py +15 -15
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/integration/app/app_state.py +2 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/integration/db_connection.py +14 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/integration/frontend_index.py +2 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/integration/log.py +6 -6
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/integration/messagebus.py +33 -33
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/integration/rpc.py +9 -9
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/component/access_token/scheme.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/component/access_token/util.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/group/repo.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/group/rpc.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/rpc.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/user/api.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/user/model.py +3 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/user/repo.py +3 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/user/rpc.py +3 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/integration/access_token_scheme.py +2 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/integration/access_token_util.py +7 -7
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/integration/model/user_model.py +6 -6
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/integration/refresh_token_util.py +7 -7
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/integration/user.py +18 -18
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/migrate.py +2 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/register_module.py +8 -8
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/register_permission.py +2 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/schema/group.py +3 -5
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/schema/permission.py +1 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/schema/request.py +1 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/schema/user.py +5 -7
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/log/entity/activity/event.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/log/entity/activity/rpc.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/log/migrate.py +2 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/log/register_module.py +8 -8
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/log/schema/activity.py +1 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/template.env +5 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/test/auth/test_group_crud.py +8 -8
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/test/auth/test_permission_crud.py +8 -8
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/test/auth/test_user_crud.py +8 -8
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/test/auth/test_user_login.py +15 -15
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/test/test_liveness_and_readiness.py +4 -4
- zrb/builtin/project/add/fastapp/crud/_helper/__init__.py +7 -0
- zrb/builtin/project/add/fastapp/crud/_helper/_common.py +8 -0
- zrb/builtin/project/add/fastapp/crud/_helper/register_api.py +45 -0
- zrb/builtin/project/add/fastapp/crud/_helper/register_permission.py +40 -0
- zrb/builtin/project/add/fastapp/crud/_helper/register_rpc.py +45 -0
- zrb/builtin/project/add/fastapp/crud/_task_factory.py +1 -2
- zrb/builtin/project/add/fastapp/crud/crud.py +4 -25
- zrb/builtin/project/add/fastapp/crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/snake_zrb_entity_name/repo.py +12 -1
- zrb/builtin/project/add/fastapp/crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/snake_zrb_entity_name/rpc.py +2 -1
- zrb/builtin/project/add/fastapp/crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/schema/snake_zrb_entity_name.py +3 -2
- zrb/builtin/project/add/fastapp/crud/template/src/kebab-zrb-app-name/test/snake_zrb_module_name/test_snake_zrb_entity_name.py +9 -8
- zrb/builtin/project/add/fastapp/field/_helper/__init__.py +17 -0
- zrb/builtin/project/add/fastapp/field/_helper/_common.py +102 -0
- zrb/builtin/project/add/fastapp/field/_helper/inject_delete_page.py +49 -0
- zrb/builtin/project/add/fastapp/field/_helper/inject_detail_page.py +49 -0
- zrb/builtin/project/add/fastapp/field/_helper/inject_insert_page.py +62 -0
- zrb/builtin/project/add/fastapp/field/_helper/inject_list_page.py +47 -0
- zrb/builtin/project/add/fastapp/field/_helper/inject_repo.py +47 -0
- zrb/builtin/project/add/fastapp/field/_helper/inject_schema.py +45 -0
- zrb/builtin/project/add/fastapp/field/_helper/inject_test.py +49 -0
- zrb/builtin/project/add/fastapp/field/_helper/inject_update_page.py +50 -0
- zrb/builtin/project/add/fastapp/field/_input.py +14 -2
- zrb/builtin/project/add/fastapp/field/field.py +52 -70
- zrb/builtin/project/add/fastapp/module/_helper/__init__.py +17 -0
- zrb/builtin/project/add/fastapp/module/_helper/append_all_disabled_env.py +22 -0
- zrb/builtin/project/add/fastapp/module/_helper/append_all_enabled_env.py +22 -0
- zrb/builtin/project/add/fastapp/module/_helper/append_deployment_template_env.py +25 -0
- zrb/builtin/project/add/fastapp/module/_helper/append_src_template_env.py +25 -0
- zrb/builtin/project/add/fastapp/module/_helper/create_app_config.py +29 -0
- zrb/builtin/project/add/fastapp/module/_helper/create_microservice_config.py +157 -0
- zrb/builtin/project/add/fastapp/module/_helper/register_migration.py +35 -0
- zrb/builtin/project/add/fastapp/module/_helper/register_module.py +33 -0
- zrb/builtin/project/add/fastapp/module/module.py +9 -38
- zrb/builtin/project/add/fastapp/module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/migrate.py +2 -2
- zrb/builtin/project/add/fastapp/module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/register_module.py +8 -8
- zrb/builtin/project/add/plugin/plugin.py +3 -3
- zrb/builtin/project/add/project_task/add.py +1 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/build.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/container/remove.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/container/start.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/container/stop.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/deploy.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/destroy.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/get_env.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/image/build.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/image/push.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/publish.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/start.py +2 -1
- zrb/builtin/project/add/task/cmd/add.py +1 -1
- zrb/builtin/project/add/task/docker_compose/add.py +1 -1
- zrb/builtin/project/add/task/docker_compose/template/src/kebab-zrb-task-name/docker-compose.yml +0 -2
- zrb/builtin/project/add/task/python/add.py +1 -1
- zrb/builtin/project/add/task/python/template/_automate/snake_zrb_task_name.py +1 -1
- zrb/builtin/project/create/_helper.py +1 -1
- zrb/builtin/project/create/create.py +3 -3
- zrb/builtin/say.py +3 -3
- zrb/builtin/version.py +5 -4
- zrb/config/config.py +14 -14
- zrb/helper/accessories/color.py +2 -1
- zrb/helper/advertisement.py +2 -1
- zrb/helper/callable.py +4 -1
- zrb/helper/cli.py +4 -4
- zrb/helper/codemod/add_import_module.py +3 -2
- zrb/helper/codemod/add_property_to_class.py +2 -1
- zrb/helper/default_env.py +2 -1
- zrb/helper/docker_compose/fetch_external_env.py +4 -2
- zrb/helper/docker_compose/file.py +3 -1
- zrb/helper/env_map/fetch.py +3 -2
- zrb/helper/file/copy_tree.py +2 -1
- zrb/helper/file/match.py +2 -2
- zrb/helper/git/detect_changes.py +1 -1
- zrb/helper/log.py +3 -3
- zrb/helper/map/conversion.py +3 -1
- zrb/helper/string/jinja.py +2 -1
- zrb/helper/string/parse_replacement.py +1 -1
- zrb/helper/typecheck.py +2 -2
- zrb/helper/typing.py +5 -27
- zrb/helper/util.py +13 -1
- zrb/runner.py +2 -2
- zrb/task/any_task.py +9 -17
- zrb/task/any_task_event_handler.py +3 -1
- zrb/task/base_remote_cmd_task.py +3 -10
- zrb/task/base_task/base_task.py +12 -11
- zrb/task/base_task/component/base_task_model.py +15 -22
- zrb/task/base_task/component/common_task_model.py +15 -22
- zrb/task/base_task/component/renderer.py +3 -1
- zrb/task/base_task/component/trackers.py +1 -1
- zrb/task/checker.py +2 -1
- zrb/task/cmd_task.py +8 -15
- zrb/task/decorator.py +3 -1
- zrb/task/docker_compose_start_task.py +146 -0
- zrb/task/docker_compose_task.py +43 -34
- zrb/task/flow_task.py +19 -17
- zrb/task/http_checker.py +3 -9
- zrb/task/looper.py +4 -2
- zrb/task/notifier.py +3 -1
- zrb/task/parallel.py +4 -4
- zrb/task/path_checker.py +6 -12
- zrb/task/path_watcher.py +5 -13
- zrb/task/port_checker.py +3 -9
- zrb/task/recurring_task.py +5 -4
- zrb/task/remote_cmd_task.py +2 -1
- zrb/task/resource_maker.py +6 -13
- zrb/task/rsync_task.py +3 -1
- zrb/task/server.py +13 -12
- zrb/task/time_watcher.py +3 -10
- zrb/task/watcher.py +2 -1
- zrb/task/wiki_task.py +4 -3
- zrb/task_env/env.py +2 -1
- zrb/task_env/env_file.py +7 -6
- zrb/task_group/group.py +8 -7
- zrb/task_input/any_input.py +4 -3
- zrb/task_input/base_input.py +7 -5
- zrb/task_input/bool_input.py +2 -1
- zrb/task_input/choice_input.py +3 -1
- zrb/task_input/float_input.py +2 -1
- zrb/task_input/int_input.py +2 -1
- zrb/task_input/multiline_input.py +5 -3
- zrb/task_input/password_input.py +2 -1
- zrb/task_input/str_input.py +2 -1
- {zrb-0.23.4.dist-info → zrb-0.24.1.dist-info}/METADATA +2 -2
- {zrb-0.23.4.dist-info → zrb-0.24.1.dist-info}/RECORD +226 -208
- zrb/builtin/project/add/app/generator/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/snake_zrb_generator_name/template/_automate/snake_zrb_app_name/container/init.py +0 -34
- zrb/builtin/project/add/app/python/template/_automate/snake_zrb_app_name/container/init.py +0 -34
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/microservices/init.py +0 -36
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/monolith/init.py +0 -36
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/support/init.py +0 -26
- zrb/builtin/project/add/fastapp/crud/_helper.py +0 -118
- zrb/builtin/project/add/fastapp/field/_helper.py +0 -328
- zrb/builtin/project/add/fastapp/module/_helper.py +0 -313
- {zrb-0.23.4.dist-info → zrb-0.24.1.dist-info}/LICENSE +0 -0
- {zrb-0.23.4.dist-info → zrb-0.24.1.dist-info}/WHEEL +0 -0
- {zrb-0.23.4.dist-info → zrb-0.24.1.dist-info}/entry_points.txt +0 -0
@@ -1,9 +1,11 @@
|
|
1
|
+
from collections.abc import Mapping
|
2
|
+
from typing import Any
|
3
|
+
|
1
4
|
from ruamel.yaml import YAML, CommentedMap
|
2
5
|
|
3
6
|
from zrb.helper.accessories.color import colored
|
4
7
|
from zrb.helper.log import logger
|
5
8
|
from zrb.helper.typecheck import typechecked
|
6
|
-
from zrb.helper.typing import Any, Mapping
|
7
9
|
|
8
10
|
logger.debug(colored("Loading zrb.helper.docker_compose.file", attrs=["dark"]))
|
9
11
|
|
zrb/helper/env_map/fetch.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
from collections.abc import Mapping
|
2
|
+
|
1
3
|
from zrb.helper.accessories.color import colored
|
2
4
|
from zrb.helper.log import logger
|
3
5
|
from zrb.helper.string.jinja import is_probably_jinja
|
4
6
|
from zrb.helper.typecheck import typechecked
|
5
|
-
from zrb.helper.typing import List, Mapping
|
6
7
|
from zrb.task.any_task import AnyTask
|
7
8
|
from zrb.task_env.env import Env
|
8
9
|
from zrb.task_group.group import Group
|
@@ -39,7 +40,7 @@ def fetch_env_map_from_task(env_map: Mapping[str, str], task: AnyTask):
|
|
39
40
|
|
40
41
|
@typechecked
|
41
42
|
def _add_envs_to_env_map(
|
42
|
-
env_map: Mapping[str, str], envs:
|
43
|
+
env_map: Mapping[str, str], envs: list[Env]
|
43
44
|
) -> Mapping[str, str]:
|
44
45
|
for env in envs:
|
45
46
|
if env.get_os_name() == "":
|
zrb/helper/file/copy_tree.py
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
import fnmatch
|
2
2
|
import os
|
3
3
|
import shutil
|
4
|
+
from collections.abc import Iterable, Mapping
|
5
|
+
from typing import Optional
|
4
6
|
|
5
7
|
from zrb.helper.accessories.color import colored
|
6
8
|
from zrb.helper.file.text import read_text_file_async, write_text_file_async
|
7
9
|
from zrb.helper.log import logger
|
8
10
|
from zrb.helper.string.parse_replacement import parse_replacement
|
9
11
|
from zrb.helper.typecheck import typechecked
|
10
|
-
from zrb.helper.typing import Iterable, Mapping, Optional
|
11
12
|
|
12
13
|
logger.debug(colored("Loading zrb.helper.file.copy_tree", attrs=["dark"]))
|
13
14
|
|
zrb/helper/file/match.py
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
import fnmatch
|
2
2
|
import glob
|
3
|
+
from collections.abc import Iterable
|
3
4
|
|
4
5
|
from zrb.helper.accessories.color import colored
|
5
6
|
from zrb.helper.log import logger
|
6
7
|
from zrb.helper.typecheck import typechecked
|
7
|
-
from zrb.helper.typing import Iterable, List
|
8
8
|
|
9
9
|
logger.debug(colored("Loading zrb.helper.file.match", attrs=["dark"]))
|
10
10
|
|
11
11
|
|
12
12
|
@typechecked
|
13
|
-
def get_file_names(glob_path: str, glob_ignored_paths: Iterable[str]) ->
|
13
|
+
def get_file_names(glob_path: str, glob_ignored_paths: Iterable[str]) -> list[str]:
|
14
14
|
matches = []
|
15
15
|
for file in glob.glob(glob_path, recursive=True):
|
16
16
|
should_ignore = any(
|
zrb/helper/git/detect_changes.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import subprocess
|
2
|
+
from collections.abc import Mapping
|
2
3
|
|
3
4
|
from zrb.helper.accessories.color import colored
|
4
5
|
from zrb.helper.log import logger
|
5
6
|
from zrb.helper.typecheck import typechecked
|
6
|
-
from zrb.helper.typing import Mapping
|
7
7
|
|
8
8
|
logger.debug(colored("Loading zrb.helper.git.detect_changes", attrs=["dark"]))
|
9
9
|
|
zrb/helper/log.py
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
import logging
|
2
2
|
|
3
|
-
from zrb.config.config import
|
3
|
+
from zrb.config.config import LOGGING_LEVEL
|
4
4
|
from zrb.helper.accessories.untyped_color import untyped_colored as colored
|
5
5
|
|
6
6
|
# create logger
|
7
7
|
logger = logging.getLogger("zrb")
|
8
|
-
logger.setLevel(
|
8
|
+
logger.setLevel(LOGGING_LEVEL)
|
9
9
|
|
10
10
|
# create console handler and set level to debug
|
11
11
|
ch = logging.StreamHandler()
|
12
|
-
ch.setLevel(
|
12
|
+
ch.setLevel(LOGGING_LEVEL)
|
13
13
|
|
14
14
|
# create formatter
|
15
15
|
formatter = logging.Formatter(
|
zrb/helper/map/conversion.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
from collections.abc import Mapping
|
2
|
+
from typing import Any
|
3
|
+
|
1
4
|
from zrb.helper.accessories.color import colored
|
2
5
|
from zrb.helper.log import logger
|
3
6
|
from zrb.helper.typecheck import typechecked
|
4
|
-
from zrb.helper.typing import Any, Mapping
|
5
7
|
|
6
8
|
logger.debug(colored("Loading zrb.helper.map.conversion", attrs=["dark"]))
|
7
9
|
|
zrb/helper/string/jinja.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
from typing import Any
|
2
|
+
|
1
3
|
from zrb.helper.accessories.color import colored
|
2
4
|
from zrb.helper.log import logger
|
3
5
|
from zrb.helper.typecheck import typechecked
|
4
|
-
from zrb.helper.typing import Any
|
5
6
|
|
6
7
|
logger.debug(colored("Loading zrb.helper.string.jinja", attrs=["dark"]))
|
7
8
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import re
|
2
|
+
from collections.abc import Mapping
|
2
3
|
|
3
4
|
from zrb.helper.accessories.color import colored
|
4
5
|
from zrb.helper.log import logger
|
5
6
|
from zrb.helper.typecheck import typechecked
|
6
|
-
from zrb.helper.typing import Mapping
|
7
7
|
|
8
8
|
logger.debug(colored("Loading zrb.helper.string.parse_replacment", attrs=["dark"]))
|
9
9
|
|
zrb/helper/typecheck.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import TypeVar
|
2
2
|
|
3
|
-
from zrb.config.config import
|
3
|
+
from zrb.config.config import ENABLE_TYPE_CHECKING
|
4
4
|
from zrb.helper.accessories.untyped_color import untyped_colored as colored
|
5
5
|
from zrb.helper.log import logger
|
6
6
|
|
@@ -9,7 +9,7 @@ T = TypeVar("T")
|
|
9
9
|
|
10
10
|
|
11
11
|
def typechecked(anything: T) -> T:
|
12
|
-
if
|
12
|
+
if ENABLE_TYPE_CHECKING:
|
13
13
|
from beartype import beartype
|
14
14
|
|
15
15
|
return beartype(anything)
|
zrb/helper/typing.py
CHANGED
@@ -1,35 +1,13 @@
|
|
1
|
-
from
|
1
|
+
from collections.abc import Callable, Iterable, Mapping
|
2
|
+
from typing import Any, Optional, Type, TypeVar, Union
|
3
|
+
|
2
4
|
from zrb.helper.accessories.untyped_color import untyped_colored as colored
|
3
5
|
from zrb.helper.log import logger
|
4
6
|
|
5
7
|
logger.debug(colored("Loading zrb.helper.typing", attrs=["dark"]))
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
Any,
|
10
|
-
Callable,
|
11
|
-
Iterable,
|
12
|
-
List,
|
13
|
-
Mapping,
|
14
|
-
Optional,
|
15
|
-
Tuple,
|
16
|
-
Type,
|
17
|
-
TypeVar,
|
18
|
-
Union,
|
19
|
-
)
|
20
|
-
else:
|
21
|
-
from typing import (
|
22
|
-
Any,
|
23
|
-
Callable,
|
24
|
-
Iterable,
|
25
|
-
List,
|
26
|
-
Mapping,
|
27
|
-
Optional,
|
28
|
-
Tuple,
|
29
|
-
Type,
|
30
|
-
TypeVar,
|
31
|
-
Union,
|
32
|
-
)
|
9
|
+
Tuple = tuple
|
10
|
+
List = list
|
33
11
|
|
34
12
|
JinjaTemplate = str
|
35
13
|
|
zrb/helper/util.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
import re
|
2
|
+
from functools import lru_cache
|
3
|
+
from typing import Any, Optional
|
2
4
|
|
3
5
|
import jinja2
|
4
6
|
|
@@ -6,7 +8,6 @@ from zrb.helper.accessories.color import colored
|
|
6
8
|
from zrb.helper.log import logger
|
7
9
|
from zrb.helper.string.conversion import to_boolean as conversion_to_boolean
|
8
10
|
from zrb.helper.typecheck import typechecked
|
9
|
-
from zrb.helper.typing import Any, Optional
|
10
11
|
|
11
12
|
logger.debug(colored("Loading zrb.helper.util", attrs=["dark"]))
|
12
13
|
|
@@ -18,6 +19,7 @@ def _is_undefined(value: Any) -> bool:
|
|
18
19
|
return value is None or isinstance(value, jinja2.Undefined)
|
19
20
|
|
20
21
|
|
22
|
+
@lru_cache
|
21
23
|
@typechecked
|
22
24
|
def coalesce(value: Any, *alternatives: Any) -> Any:
|
23
25
|
if not _is_undefined(value):
|
@@ -28,6 +30,7 @@ def coalesce(value: Any, *alternatives: Any) -> Any:
|
|
28
30
|
return None
|
29
31
|
|
30
32
|
|
33
|
+
@lru_cache
|
31
34
|
@typechecked
|
32
35
|
def coalesce_str(value: Any, *alternatives: Any) -> Any:
|
33
36
|
if not _is_undefined(value) and value != "":
|
@@ -38,6 +41,7 @@ def coalesce_str(value: Any, *alternatives: Any) -> Any:
|
|
38
41
|
return ""
|
39
42
|
|
40
43
|
|
44
|
+
@lru_cache
|
41
45
|
@typechecked
|
42
46
|
def to_camel_case(text: Optional[str]) -> str:
|
43
47
|
text = str(text) if not _is_undefined(text) else ""
|
@@ -47,6 +51,7 @@ def to_camel_case(text: Optional[str]) -> str:
|
|
47
51
|
return pascal[0].lower() + pascal[1:]
|
48
52
|
|
49
53
|
|
54
|
+
@lru_cache
|
50
55
|
@typechecked
|
51
56
|
def to_pascal_case(text: Optional[str]) -> str:
|
52
57
|
text = str(text) if not _is_undefined(text) else ""
|
@@ -56,6 +61,7 @@ def to_pascal_case(text: Optional[str]) -> str:
|
|
56
61
|
)
|
57
62
|
|
58
63
|
|
64
|
+
@lru_cache
|
59
65
|
@typechecked
|
60
66
|
def to_kebab_case(text: Optional[str]) -> str:
|
61
67
|
text = str(text) if not _is_undefined(text) else ""
|
@@ -63,6 +69,7 @@ def to_kebab_case(text: Optional[str]) -> str:
|
|
63
69
|
return "-".join([x.lower() for x in _to_space_separated(text).split(" ")])
|
64
70
|
|
65
71
|
|
72
|
+
@lru_cache
|
66
73
|
@typechecked
|
67
74
|
def to_snake_case(text: Optional[str]) -> str:
|
68
75
|
text = str(text) if not _is_undefined(text) else ""
|
@@ -70,12 +77,14 @@ def to_snake_case(text: Optional[str]) -> str:
|
|
70
77
|
return "_".join([x.lower() for x in _to_space_separated(text).split(" ")])
|
71
78
|
|
72
79
|
|
80
|
+
@lru_cache
|
73
81
|
@typechecked
|
74
82
|
def _to_alphanum(text: Optional[str]) -> str:
|
75
83
|
text = str(text) if not _is_undefined(text) else ""
|
76
84
|
return NON_ALPHA_NUM.sub(" ", text)
|
77
85
|
|
78
86
|
|
87
|
+
@lru_cache
|
79
88
|
@typechecked
|
80
89
|
def to_human_readable(text: Optional[str]) -> str:
|
81
90
|
text = str(text) if not _is_undefined(text) else ""
|
@@ -87,11 +96,13 @@ def to_human_readable(text: Optional[str]) -> str:
|
|
87
96
|
)
|
88
97
|
|
89
98
|
|
99
|
+
@lru_cache
|
90
100
|
@typechecked
|
91
101
|
def to_capitalized_human_readable(text: Optional[str]) -> str:
|
92
102
|
return to_human_readable(text).capitalize()
|
93
103
|
|
94
104
|
|
105
|
+
@lru_cache
|
95
106
|
@typechecked
|
96
107
|
def _to_space_separated(text: Optional[str]) -> str:
|
97
108
|
text = str(text) if not _is_undefined(text) else ""
|
@@ -122,6 +133,7 @@ def _to_space_separated(text: Optional[str]) -> str:
|
|
122
133
|
return " ".join(new_parts).strip(" ")
|
123
134
|
|
124
135
|
|
136
|
+
@lru_cache
|
125
137
|
@typechecked
|
126
138
|
def to_boolean(text: str) -> bool:
|
127
139
|
return conversion_to_boolean(text)
|
zrb/runner.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
from zrb.action.runner import Runner
|
2
|
-
from zrb.config.config import
|
2
|
+
from zrb.config.config import ENV_PREFIX
|
3
3
|
from zrb.helper.accessories.color import colored
|
4
4
|
from zrb.helper.log import logger
|
5
5
|
|
6
6
|
logger.debug(colored("Loading zrb.runner", attrs=["dark"]))
|
7
|
-
runner = Runner(env_prefix=
|
7
|
+
runner = Runner(env_prefix=ENV_PREFIX)
|
zrb/task/any_task.py
CHANGED
@@ -1,18 +1,10 @@
|
|
1
1
|
from abc import ABC, abstractmethod
|
2
|
+
from collections.abc import Callable, Iterable, Mapping
|
3
|
+
from typing import Any, Optional, TypeVar, Union
|
2
4
|
|
3
5
|
from zrb.helper.accessories.color import colored
|
4
6
|
from zrb.helper.log import logger
|
5
|
-
from zrb.helper.typing import
|
6
|
-
Any,
|
7
|
-
Callable,
|
8
|
-
Iterable,
|
9
|
-
JinjaTemplate,
|
10
|
-
List,
|
11
|
-
Mapping,
|
12
|
-
Optional,
|
13
|
-
TypeVar,
|
14
|
-
Union,
|
15
|
-
)
|
7
|
+
from zrb.helper.typing import JinjaTemplate
|
16
8
|
from zrb.task_env.env import Env
|
17
9
|
from zrb.task_env.env_file import EnvFile
|
18
10
|
from zrb.task_input.any_input import AnyInput
|
@@ -824,7 +816,7 @@ class AnyTask(ABC):
|
|
824
816
|
pass
|
825
817
|
|
826
818
|
@abstractmethod
|
827
|
-
def _get_env_files(self) ->
|
819
|
+
def _get_env_files(self) -> list[EnvFile]:
|
828
820
|
"""
|
829
821
|
Retrieves the list of environment variable files associated with the task.
|
830
822
|
|
@@ -832,7 +824,7 @@ class AnyTask(ABC):
|
|
832
824
|
uses to load environment variables, primarily for setup and configuration purposes.
|
833
825
|
|
834
826
|
Returns:
|
835
|
-
|
827
|
+
list[EnvFile]: A list of `EnvFile` instances associated with the task.
|
836
828
|
"""
|
837
829
|
pass
|
838
830
|
|
@@ -850,7 +842,7 @@ class AnyTask(ABC):
|
|
850
842
|
pass
|
851
843
|
|
852
844
|
@abstractmethod
|
853
|
-
def _get_envs(self) ->
|
845
|
+
def _get_envs(self) -> list[Env]:
|
854
846
|
"""
|
855
847
|
Retrieves the list of environment variables set for the task.
|
856
848
|
|
@@ -858,7 +850,7 @@ class AnyTask(ABC):
|
|
858
850
|
configured for the task, essential for understanding and debugging the task's environment setup.
|
859
851
|
|
860
852
|
Returns:
|
861
|
-
|
853
|
+
list[Env]: A list of `Env` instances representing the environment variables of the task.
|
862
854
|
"""
|
863
855
|
pass
|
864
856
|
|
@@ -880,7 +872,7 @@ class AnyTask(ABC):
|
|
880
872
|
pass
|
881
873
|
|
882
874
|
@abstractmethod
|
883
|
-
def _get_inputs(self) ->
|
875
|
+
def _get_inputs(self) -> list[AnyInput]:
|
884
876
|
"""
|
885
877
|
Retrieves the list of inputs associated with the task.
|
886
878
|
|
@@ -889,7 +881,7 @@ class AnyTask(ABC):
|
|
889
881
|
for introspection and debugging purposes.
|
890
882
|
|
891
883
|
Returns:
|
892
|
-
|
884
|
+
list[AnyInput]: A list of `AnyInput` instances representing the inputs for the task.
|
893
885
|
"""
|
894
886
|
pass
|
895
887
|
|
@@ -1,6 +1,8 @@
|
|
1
|
+
from collections.abc import Callable
|
2
|
+
from typing import Any
|
3
|
+
|
1
4
|
from zrb.helper.accessories.color import colored
|
2
5
|
from zrb.helper.log import logger
|
3
|
-
from zrb.helper.typing import Any, Callable
|
4
6
|
from zrb.task.any_task import AnyTask
|
5
7
|
|
6
8
|
logger.debug(colored("Loading zrb.task.any_task_event_handler", attrs=["dark"]))
|
zrb/task/base_remote_cmd_task.py
CHANGED
@@ -1,19 +1,12 @@
|
|
1
1
|
import os
|
2
2
|
import pathlib
|
3
|
+
from collections.abc import Callable, Iterable, Mapping
|
4
|
+
from typing import Any, Optional, TypeVar, Union
|
3
5
|
|
4
6
|
from zrb.helper.accessories.color import colored
|
5
7
|
from zrb.helper.log import logger
|
6
8
|
from zrb.helper.typecheck import typechecked
|
7
|
-
from zrb.helper.typing import
|
8
|
-
Any,
|
9
|
-
Callable,
|
10
|
-
Iterable,
|
11
|
-
JinjaTemplate,
|
12
|
-
Mapping,
|
13
|
-
Optional,
|
14
|
-
TypeVar,
|
15
|
-
Union,
|
16
|
-
)
|
9
|
+
from zrb.helper.typing import JinjaTemplate
|
17
10
|
from zrb.helper.util import to_snake_case
|
18
11
|
from zrb.task.any_task import AnyTask
|
19
12
|
from zrb.task.any_task_event_handler import (
|
zrb/task/base_task/base_task.py
CHANGED
@@ -2,9 +2,11 @@ import asyncio
|
|
2
2
|
import copy
|
3
3
|
import os
|
4
4
|
import shutil
|
5
|
+
from collections.abc import Callable, Iterable, Mapping
|
6
|
+
from typing import Any, Optional, Union
|
5
7
|
|
6
8
|
from zrb.advertisement import advertisements
|
7
|
-
from zrb.config.config import
|
9
|
+
from zrb.config.config import SHOW_ADVERTISEMENT, TMP_DIR
|
8
10
|
from zrb.helper.accessories.name import get_random_name
|
9
11
|
from zrb.helper.advertisement import get_advertisement
|
10
12
|
from zrb.helper.callable import run_async
|
@@ -12,7 +14,6 @@ from zrb.helper.map.conversion import to_str as map_to_str
|
|
12
14
|
from zrb.helper.string.conversion import to_variable_name
|
13
15
|
from zrb.helper.string.modification import double_quote
|
14
16
|
from zrb.helper.typecheck import typechecked
|
15
|
-
from zrb.helper.typing import Any, Callable, Iterable, List, Mapping, Optional, Union
|
16
17
|
from zrb.task.any_task import AnyTask
|
17
18
|
from zrb.task.any_task_event_handler import (
|
18
19
|
OnFailed,
|
@@ -41,14 +42,14 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
41
42
|
Every Task definition should be extended from this class.
|
42
43
|
"""
|
43
44
|
|
44
|
-
__running_tasks:
|
45
|
+
__running_tasks: list[AnyTask] = []
|
45
46
|
|
46
47
|
def __init__(
|
47
48
|
self,
|
48
49
|
name: str,
|
49
50
|
group: Optional[Group] = None,
|
50
51
|
description: str = "",
|
51
|
-
inputs:
|
52
|
+
inputs: list[AnyInput] = [],
|
52
53
|
envs: Iterable[Env] = [],
|
53
54
|
env_files: Iterable[EnvFile] = [],
|
54
55
|
icon: Optional[str] = None,
|
@@ -119,7 +120,7 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
119
120
|
operand.add_upstream(self)
|
120
121
|
return operand
|
121
122
|
if isinstance(operand, AnyParallel):
|
122
|
-
other_tasks:
|
123
|
+
other_tasks: list[AnyTask] = operand.get_tasks()
|
123
124
|
for other_task in other_tasks:
|
124
125
|
other_task.add_upstream(self)
|
125
126
|
return operand
|
@@ -127,7 +128,7 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
127
128
|
def __get_xcom_dir(self, execution_id: Optional[str] = None) -> str:
|
128
129
|
if execution_id is None:
|
129
130
|
execution_id = self.get_execution_id()
|
130
|
-
return os.path.join(
|
131
|
+
return os.path.join(TMP_DIR, f"xcom.{execution_id}")
|
131
132
|
|
132
133
|
def __ensure_xcom_dir_exists(self, execution_id: Optional[str] = None):
|
133
134
|
xcom_dir = self.__get_xcom_dir(execution_id=execution_id)
|
@@ -303,7 +304,7 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
303
304
|
await asyncio.sleep(self._checking_interval)
|
304
305
|
self._end_timer()
|
305
306
|
if show_done_info:
|
306
|
-
if
|
307
|
+
if SHOW_ADVERTISEMENT:
|
307
308
|
selected_advertisement = get_advertisement(advertisements)
|
308
309
|
selected_advertisement.show()
|
309
310
|
self._show_done_info()
|
@@ -415,7 +416,7 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
415
416
|
# wait all upstream checkers to complete
|
416
417
|
await asyncio.gather(*coroutines)
|
417
418
|
|
418
|
-
async def __trigger_failure(self, tasks:
|
419
|
+
async def __trigger_failure(self, tasks: list[AnyTask]):
|
419
420
|
coroutines = [
|
420
421
|
task.on_failed(is_last_attempt=True, exception=Exception("canceled"))
|
421
422
|
for task in tasks
|
@@ -423,7 +424,7 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
423
424
|
await asyncio.gather(*coroutines)
|
424
425
|
|
425
426
|
async def __trigger_fallbacks(
|
426
|
-
self, tasks:
|
427
|
+
self, tasks: list[AnyTask], kwargs: Mapping[str, Any]
|
427
428
|
):
|
428
429
|
coroutines: Iterable[asyncio.Task] = []
|
429
430
|
for fallback in self.__get_all_fallbacks(tasks):
|
@@ -431,8 +432,8 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
431
432
|
coroutines.append(asyncio.create_task(fallback._run_all(**kwargs)))
|
432
433
|
await asyncio.gather(*coroutines)
|
433
434
|
|
434
|
-
def __get_all_fallbacks(self, tasks:
|
435
|
-
all_fallbacks:
|
435
|
+
def __get_all_fallbacks(self, tasks: list[AnyTask]) -> list[AnyTask]:
|
436
|
+
all_fallbacks: list[AnyTask] = []
|
436
437
|
for task in tasks:
|
437
438
|
task._lock_fallbacks()
|
438
439
|
for fallback in task._get_fallbacks():
|
@@ -2,24 +2,17 @@ import datetime
|
|
2
2
|
import logging
|
3
3
|
import os
|
4
4
|
import sys
|
5
|
+
from collections.abc import Callable, Iterable, Mapping
|
5
6
|
from functools import lru_cache
|
7
|
+
from typing import Any, Optional, Union
|
6
8
|
|
7
|
-
from zrb.config.config import
|
9
|
+
from zrb.config.config import ENV_PREFIX, LOGGING_LEVEL, SHOW_TIME
|
8
10
|
from zrb.helper.accessories.color import colored
|
9
11
|
from zrb.helper.log import logger
|
10
12
|
from zrb.helper.string.conversion import to_variable_name
|
11
13
|
from zrb.helper.string.modification import double_quote
|
12
14
|
from zrb.helper.typecheck import typechecked
|
13
|
-
from zrb.helper.typing import
|
14
|
-
Any,
|
15
|
-
Callable,
|
16
|
-
Iterable,
|
17
|
-
JinjaTemplate,
|
18
|
-
List,
|
19
|
-
Mapping,
|
20
|
-
Optional,
|
21
|
-
Union,
|
22
|
-
)
|
15
|
+
from zrb.helper.typing import JinjaTemplate
|
23
16
|
from zrb.task.any_task import AnyTask
|
24
17
|
from zrb.task.any_task_event_handler import (
|
25
18
|
OnFailed,
|
@@ -48,7 +41,7 @@ class BaseTaskModel(CommonTaskModel, PidModel, TimeTracker):
|
|
48
41
|
name: str,
|
49
42
|
group: Optional[Group] = None,
|
50
43
|
description: str = "",
|
51
|
-
inputs:
|
44
|
+
inputs: list[AnyInput] = [],
|
52
45
|
envs: Iterable[Env] = [],
|
53
46
|
env_files: Iterable[EnvFile] = [],
|
54
47
|
icon: Optional[str] = None,
|
@@ -102,7 +95,7 @@ class BaseTaskModel(CommonTaskModel, PidModel, TimeTracker):
|
|
102
95
|
)
|
103
96
|
PidModel.__init__(self)
|
104
97
|
TimeTracker.__init__(self)
|
105
|
-
self.__args:
|
98
|
+
self.__args: list[Any] = []
|
106
99
|
self.__kwargs: Mapping[str, Any] = {}
|
107
100
|
|
108
101
|
def _set_args(self, args: Iterable[Any]):
|
@@ -118,35 +111,35 @@ class BaseTaskModel(CommonTaskModel, PidModel, TimeTracker):
|
|
118
111
|
self.__kwargs = kwargs
|
119
112
|
|
120
113
|
def log_debug(self, message: Any):
|
121
|
-
if
|
114
|
+
if LOGGING_LEVEL > logging.DEBUG:
|
122
115
|
return
|
123
116
|
prefix = self.__get_log_prefix()
|
124
117
|
colored_message = colored(f"{prefix} • {message}", attrs=["dark"])
|
125
118
|
logger.debug(colored_message)
|
126
119
|
|
127
120
|
def log_warn(self, message: Any):
|
128
|
-
if
|
121
|
+
if LOGGING_LEVEL > logging.WARNING:
|
129
122
|
return
|
130
123
|
prefix = self.__get_log_prefix()
|
131
124
|
colored_message = colored(f"{prefix} • {message}", attrs=["dark"])
|
132
125
|
logger.warning(colored_message)
|
133
126
|
|
134
127
|
def log_info(self, message: Any):
|
135
|
-
if
|
128
|
+
if LOGGING_LEVEL > logging.INFO:
|
136
129
|
return
|
137
130
|
prefix = self.__get_log_prefix()
|
138
131
|
colored_message = colored(f"{prefix} • {message}", attrs=["dark"])
|
139
132
|
logger.info(colored_message)
|
140
133
|
|
141
134
|
def log_error(self, message: Any):
|
142
|
-
if
|
135
|
+
if LOGGING_LEVEL > logging.ERROR:
|
143
136
|
return
|
144
137
|
prefix = self.__get_log_prefix()
|
145
138
|
colored_message = colored(f"{prefix} • {message}", color="red", attrs=["bold"])
|
146
139
|
logger.error(colored_message, exc_info=True)
|
147
140
|
|
148
141
|
def log_critical(self, message: Any):
|
149
|
-
if
|
142
|
+
if LOGGING_LEVEL > logging.CRITICAL:
|
150
143
|
return
|
151
144
|
prefix = self.__get_log_prefix()
|
152
145
|
colored_message = colored(f"{prefix} • {message}", color="red", attrs=["bold"])
|
@@ -192,16 +185,16 @@ class BaseTaskModel(CommonTaskModel, PidModel, TimeTracker):
|
|
192
185
|
self._play_bell()
|
193
186
|
|
194
187
|
def _show_env_prefix(self):
|
195
|
-
if
|
188
|
+
if ENV_PREFIX == "":
|
196
189
|
return
|
197
|
-
colored_env_prefix = colored(
|
190
|
+
colored_env_prefix = colored(ENV_PREFIX, color="yellow")
|
198
191
|
colored_label = colored("Your current environment: ", attrs=["dark"])
|
199
192
|
print(colored(f"{colored_label}{colored_env_prefix}"), file=sys.stderr)
|
200
193
|
|
201
194
|
def _show_run_command(self):
|
202
195
|
if not self.__has_cli_interface:
|
203
196
|
return
|
204
|
-
params:
|
197
|
+
params: list[str] = [double_quote(arg) for arg in self.__args]
|
205
198
|
for task_input in self._get_combined_inputs():
|
206
199
|
if task_input.is_hidden():
|
207
200
|
continue
|
@@ -225,7 +218,7 @@ class BaseTaskModel(CommonTaskModel, PidModel, TimeTracker):
|
|
225
218
|
return colored(text, color=self.get_color())
|
226
219
|
|
227
220
|
def __get_print_prefix(self) -> str:
|
228
|
-
common_prefix = self.__get_common_prefix(show_time=
|
221
|
+
common_prefix = self.__get_common_prefix(show_time=SHOW_TIME)
|
229
222
|
icon = self.get_icon()
|
230
223
|
length = LOG_NAME_LENGTH - len(icon)
|
231
224
|
rjust_cli_name = self.__get_rjust_full_cli_name(length)
|