zrb 1.0.0a12__tar.gz → 1.0.0a15__tar.gz
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-1.0.0a12 → zrb-1.0.0a15}/PKG-INFO +1 -1
- {zrb-1.0.0a12 → zrb-1.0.0a15}/pyproject.toml +1 -1
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/git.py +22 -20
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/git_subtree.py +12 -9
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp.py +32 -17
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/column/create_column_task.py +11 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/_zrb/config.py +4 -4
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/entity/create_entity_task.py +196 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/entity/module_template/service/my_entity/my_entity_usecase.py +66 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/entity/module_template/service/my_entity/repository/factory.py +13 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/entity/module_template/service/my_entity/repository/my_entity_db_repository.py +33 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/entity/module_template/service/my_entity/repository/my_entity_repository.py +39 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/entity/schema.template.py +29 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/group.py +20 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/_zrb/helper.py +25 -11
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/input.py +43 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/_zrb/main.py +30 -21
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/create_module_task.py +136 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/module_template/client/api_client.py +6 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/module_template/client/direct_client.py +6 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/module_template/client/factory.py +9 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/module_template/migration/env.py +108 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/module_template/route.py +19 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/run_module.template.py +26 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/_zrb/venv_task.py +2 -5
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/common/app.py +3 -1
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/config.py +7 -7
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/auth/client/any_client.py +27 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/module/auth/client/api_client.py +2 -2
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/auth/client/direct_client.py +6 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/module/auth/client/factory.py +1 -1
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/auth/migration/versions/3093c7336477_add_user_table.py +37 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/module/auth/route.py +1 -1
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/module/auth/service/user/repository/factory.py +2 -2
- zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/auth/service/user/repository/db_repository.py → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/auth/service/user/repository/user_db_repository.py +2 -2
- zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/auth/service/user/usecase.py → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/auth/service/user/user_usecase.py +15 -8
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/gateway/alembic.ini +117 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/gateway/migration/README +1 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/gateway/migration/script.py.mako +26 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/gateway/migration_metadata.py +3 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/requirements.txt +5 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/schema/permission.py +31 -0
- zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/template.env +2 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/create/create.py +2 -2
- zrb-1.0.0a15/src/zrb/builtin/project/create/project-template/zrb_init.py +3 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/todo.py +19 -2
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/config.py +1 -2
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/content_transformer/content_transformer.py +14 -2
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/context/context.py +13 -10
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/input/base_input.py +2 -1
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/cli.py +16 -5
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_app.py +3 -3
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/task_ui/controller.py +8 -6
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/session/session.py +4 -1
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/task/cmd_task.py +17 -50
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/task/scaffolder.py +7 -9
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/cli/style.py +7 -0
- zrb-1.0.0a15/src/zrb/util/cmd/command.py +93 -0
- zrb-1.0.0a15/src/zrb/util/codemod/add_code_to_module.py +12 -0
- zrb-1.0.0a15/src/zrb/util/git.py +156 -0
- zrb-1.0.0a15/src/zrb/util/git_subtree.py +113 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/load.py +8 -9
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/string/conversion.py +52 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/todo.py +2 -2
- zrb-1.0.0a15/src/zrb/xcom/__init__.py +0 -0
- zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/_zrb/group.py +0 -16
- zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/auth/client/direct_client.py +0 -6
- zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/requirements.txt +0 -6
- zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/template.env +0 -2
- zrb-1.0.0a12/src/zrb/builtin/project/create/project-template/zrb_init.py +0 -7
- zrb-1.0.0a12/src/zrb/util/cmd/command.py +0 -33
- zrb-1.0.0a12/src/zrb/util/git.py +0 -174
- zrb-1.0.0a12/src/zrb/util/git_subtree.py +0 -95
- {zrb-1.0.0a12 → zrb-1.0.0a15}/README.md +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/__main__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/attr/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/attr/type.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/base64.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/group.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/llm/llm_chat.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/llm/tool/cli.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/llm/tool/rag.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/llm/tool/web.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/md5.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/.gitignore +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/README.md +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/__init__.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/auth → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/module_template}/alembic.ini +0 -0
- /zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/auth/client/base_client.py → /zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/module_template/client/any_client.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/auth → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/module_template}/migration/README +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/auth → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/module_template}/migration/script.py.mako +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/auth → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/module_template}/migration/versions/3093c7336477_add_user_table.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/gateway → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/module_template}/migration_metadata.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/common → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/_zrb/module/module_template/service}/__init__.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/common}/__init__.py +0 -0
- /zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/common/db_repository.py → /zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/common/base_db_repository.py +0 -0
- /zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/common/usecase.py → /zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/common/base_usecase.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/common/db_engine.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/common/error.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/common/schema.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/main.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/migrate.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/auth/service → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module}/__init__.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/gateway → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/auth}/alembic.ini +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/gateway → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/auth}/migration/README +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/module/auth/migration/env.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/gateway → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/auth}/migration/script.py.mako +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/module/auth/migration_metadata.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/auth/service/user → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/auth/service}/__init__.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/auth/service/user/repository → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/auth/service/user}/__init__.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/schema → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/auth/service/user/repository}/__init__.py +0 -0
- /zrb-1.0.0a12/src/zrb/builtin/project/add/fastapp_template/module/auth/service/user/repository/repository.py → /zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/module/auth/service/user/repository/user_repository.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/module/gateway/migration/env.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/module/gateway/migration/versions/.gitkeep +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/module/gateway/route.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/project/create → zrb-1.0.0a15/src/zrb/builtin/project/add/fastapp_template/schema}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/schema/role.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/add/fastapp_template/schema/user.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/shell → zrb-1.0.0a15/src/zrb/builtin/project/create}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/project/create/project-template/README.md +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/python.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/setup/asdf/asdf.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/setup/asdf/asdf_helper.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/setup/common_input.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/setup/latex/ubuntu.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/setup/tmux/tmux.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/setup/tmux/tmux_config.sh +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/setup/tmux/tmux_helper.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/setup/ubuntu.py +0 -0
- {zrb-1.0.0a12/src/zrb/builtin/shell/autocomplete → zrb-1.0.0a15/src/zrb/builtin/shell}/__init__.py +0 -0
- {zrb-1.0.0a12/src/zrb/callback → zrb-1.0.0a15/src/zrb/builtin/shell/autocomplete}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/shell/autocomplete/bash.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/shell/autocomplete/subcmd.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/builtin/shell/autocomplete/zsh.py +0 -0
- {zrb-1.0.0a12/src/zrb/cmd → zrb-1.0.0a15/src/zrb/callback}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/callback/any_callback.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/callback/callback.py +0 -0
- {zrb-1.0.0a12/src/zrb/content_transformer → zrb-1.0.0a15/src/zrb/cmd}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/cmd/cmd_result.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/cmd/cmd_val.py +0 -0
- {zrb-1.0.0a12/src/zrb/context → zrb-1.0.0a15/src/zrb/content_transformer}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/content_transformer/any_content_transformer.py +0 -0
- {zrb-1.0.0a12/src/zrb/dot_dict → zrb-1.0.0a15/src/zrb/context}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/context/any_context.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/context/any_shared_context.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/context/shared_context.py +0 -0
- {zrb-1.0.0a12/src/zrb/env → zrb-1.0.0a15/src/zrb/dot_dict}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/dot_dict/dot_dict.py +0 -0
- {zrb-1.0.0a12/src/zrb/group → zrb-1.0.0a15/src/zrb/env}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/env/any_env.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/env/env.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/env/env_file.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/env/env_map.py +0 -0
- {zrb-1.0.0a12/src/zrb/input → zrb-1.0.0a15/src/zrb/group}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/group/any_group.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/group/group.py +0 -0
- {zrb-1.0.0a12/src/zrb/runner → zrb-1.0.0a15/src/zrb/input}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/input/any_input.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/input/bool_input.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/input/float_input.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/input/int_input.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/input/option_input.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/input/password_input.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/input/str_input.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/input/text_input.py +0 -0
- {zrb-1.0.0a12/src/zrb/runner/web_controller → zrb-1.0.0a15/src/zrb/runner}/__init__.py +0 -0
- {zrb-1.0.0a12/src/zrb/runner/web_controller/group_info_ui → zrb-1.0.0a15/src/zrb/runner/web_controller}/__init__.py +0 -0
- {zrb-1.0.0a12/src/zrb/runner/web_controller/home_page → zrb-1.0.0a15/src/zrb/runner/web_controller/group_info_ui}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/group_info_ui/controller.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/group_info_ui/partial/group_info.html +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/group_info_ui/partial/group_li.html +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/group_info_ui/partial/task_info.html +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/group_info_ui/partial/task_li.html +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/group_info_ui/view.html +0 -0
- {zrb-1.0.0a12/src/zrb/runner/web_controller/task_ui → zrb-1.0.0a15/src/zrb/runner/web_controller/home_page}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/home_page/controller.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/home_page/partial/group_info.html +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/home_page/partial/group_li.html +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/home_page/partial/task_info.html +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/home_page/partial/task_li.html +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/home_page/view.html +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/static/favicon-32x32.png +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/static/pico.min.css +0 -0
- {zrb-1.0.0a12/src/zrb/session → zrb-1.0.0a15/src/zrb/runner/web_controller/task_ui}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/task_ui/partial/common-util.js +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/task_ui/partial/input.html +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/task_ui/partial/main.js +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/task_ui/partial/show-existing-session.js +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/task_ui/partial/visualize-history.js +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_controller/task_ui/view.html +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/runner/web_util.py +0 -0
- {zrb-1.0.0a12/src/zrb/session_state_log → zrb-1.0.0a15/src/zrb/session}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/session/any_session.py +0 -0
- {zrb-1.0.0a12/src/zrb/session_state_logger → zrb-1.0.0a15/src/zrb/session_state_log}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/session_state_log/session_state_log.py +0 -0
- {zrb-1.0.0a12/src/zrb/task → zrb-1.0.0a15/src/zrb/session_state_logger}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/session_state_logger/any_session_state_logger.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/session_state_logger/default_session_state_logger.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/session_state_logger/file_session_state_logger.py +0 -0
- {zrb-1.0.0a12/src/zrb/task_status → zrb-1.0.0a15/src/zrb/task}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/task/any_task.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/task/base_task.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/task/base_trigger.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/task/http_check.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/task/llm_task.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/task/make_task.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/task/rsync_task.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/task/scheduler.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/task/task.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/task/tcp_check.py +0 -0
- {zrb-1.0.0a12/src/zrb/util → zrb-1.0.0a15/src/zrb/task_status}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/task_status/task_status.py +0 -0
- {zrb-1.0.0a12/src/zrb/util/cli → zrb-1.0.0a15/src/zrb/util}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/attr.py +0 -0
- {zrb-1.0.0a12/src/zrb/util/cmd → zrb-1.0.0a15/src/zrb/util/cli}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/cli/subcommand.py +0 -0
- {zrb-1.0.0a12/src/zrb/util/codemod → zrb-1.0.0a15/src/zrb/util/cmd}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/cmd/remote.py +0 -0
- {zrb-1.0.0a12/src/zrb/util/string → zrb-1.0.0a15/src/zrb/util/codemod}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/codemod/add_code_to_class.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/codemod/add_code_to_function.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/codemod/add_code_to_method.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/codemod/add_key_to_dict.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/codemod/add_param_to_function_call.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/codemod/add_parent_to_class.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/codemod/add_property_to_class.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/cron.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/group.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/llm/tool.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/run.py +0 -0
- {zrb-1.0.0a12/src/zrb/xcom → zrb-1.0.0a15/src/zrb/util/string}/__init__.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/string/format.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/util/string/name.py +0 -0
- {zrb-1.0.0a12 → zrb-1.0.0a15}/src/zrb/xcom/xcom.py +0 -0
@@ -55,9 +55,11 @@ from zrb.util.git import (
|
|
55
55
|
group=git_group,
|
56
56
|
alias="diff",
|
57
57
|
)
|
58
|
-
def get_git_diff(ctx: AnyContext):
|
59
|
-
repo_dir = get_repo_dir()
|
60
|
-
diff = get_diff(
|
58
|
+
async def get_git_diff(ctx: AnyContext):
|
59
|
+
repo_dir = await get_repo_dir(log_method=ctx.print)
|
60
|
+
diff = await get_diff(
|
61
|
+
repo_dir, ctx.input.source, ctx.input.current, log_method=ctx.print
|
62
|
+
)
|
61
63
|
result = []
|
62
64
|
decorated = []
|
63
65
|
if ctx.input.created and diff.created:
|
@@ -83,16 +85,16 @@ def get_git_diff(ctx: AnyContext):
|
|
83
85
|
group=git_branch_group,
|
84
86
|
alias="prune",
|
85
87
|
)
|
86
|
-
def prune_local_branches(ctx: AnyContext):
|
87
|
-
repo_dir = get_repo_dir()
|
88
|
-
branches = get_branches(repo_dir)
|
89
|
-
current_branch = get_current_branch(repo_dir)
|
88
|
+
async def prune_local_branches(ctx: AnyContext):
|
89
|
+
repo_dir = await get_repo_dir(log_method=ctx.print)
|
90
|
+
branches = await get_branches(repo_dir, log_method=ctx.print)
|
91
|
+
current_branch = await get_current_branch(repo_dir, log_method=ctx.print)
|
90
92
|
for branch in branches:
|
91
93
|
if branch == current_branch or branch == "main" or branch == "master":
|
92
94
|
continue
|
93
95
|
ctx.print(stylize_yellow(f"Removing local branch: {branch}"))
|
94
96
|
try:
|
95
|
-
delete_branch(repo_dir, branch)
|
97
|
+
await delete_branch(repo_dir, branch, log_method=ctx.print)
|
96
98
|
except Exception as e:
|
97
99
|
ctx.log_error(e)
|
98
100
|
|
@@ -109,12 +111,12 @@ def prune_local_branches(ctx: AnyContext):
|
|
109
111
|
group=git_group,
|
110
112
|
alias="commit",
|
111
113
|
)
|
112
|
-
def git_commit(ctx: AnyContext):
|
113
|
-
repo_dir = get_repo_dir()
|
114
|
+
async def git_commit(ctx: AnyContext):
|
115
|
+
repo_dir = await get_repo_dir(log_method=ctx.print)
|
114
116
|
ctx.print("Add changes to staging")
|
115
|
-
add(repo_dir)
|
117
|
+
await add(repo_dir, log_method=ctx.print)
|
116
118
|
ctx.print("Commit changes")
|
117
|
-
commit(repo_dir, ctx.input.message)
|
119
|
+
await commit(repo_dir, ctx.input.message, log_method=ctx.print)
|
118
120
|
|
119
121
|
|
120
122
|
@make_task(
|
@@ -130,12 +132,12 @@ def git_commit(ctx: AnyContext):
|
|
130
132
|
group=git_group,
|
131
133
|
alias="pull",
|
132
134
|
)
|
133
|
-
def git_pull(ctx: AnyContext):
|
134
|
-
repo_dir = get_repo_dir()
|
135
|
+
async def git_pull(ctx: AnyContext):
|
136
|
+
repo_dir = await get_repo_dir(log_method=ctx.print)
|
135
137
|
remote = ctx.input.remote
|
136
|
-
current_branch = get_current_branch(repo_dir)
|
138
|
+
current_branch = await get_current_branch(repo_dir, log_method=ctx.print)
|
137
139
|
ctx.print(f"Pulling from {remote}/{current_branch}")
|
138
|
-
pull(repo_dir, remote, current_branch)
|
140
|
+
await pull(repo_dir, remote, current_branch, log_method=ctx.print)
|
139
141
|
|
140
142
|
|
141
143
|
@make_task(
|
@@ -151,9 +153,9 @@ def git_pull(ctx: AnyContext):
|
|
151
153
|
group=git_group,
|
152
154
|
alias="push",
|
153
155
|
)
|
154
|
-
def git_push(ctx: AnyContext):
|
155
|
-
repo_dir = get_repo_dir()
|
156
|
+
async def git_push(ctx: AnyContext):
|
157
|
+
repo_dir = await get_repo_dir(log_method=ctx.print)
|
156
158
|
remote = ctx.input.remote
|
157
|
-
current_branch = get_current_branch(repo_dir)
|
159
|
+
current_branch = await get_current_branch(repo_dir, log_method=ctx.print)
|
158
160
|
ctx.print(f"Pushing to {remote}/{current_branch}")
|
159
|
-
push(repo_dir, remote, current_branch)
|
161
|
+
await push(repo_dir, remote, current_branch, log_method=ctx.print)
|
@@ -32,14 +32,15 @@ from zrb.util.git_subtree import add_subtree, load_config, pull_subtree, push_su
|
|
32
32
|
group=git_subtree_group,
|
33
33
|
alias="add",
|
34
34
|
)
|
35
|
-
def git_add_subtree(ctx: AnyContext):
|
36
|
-
repo_dir = get_repo_dir()
|
37
|
-
add_subtree(
|
35
|
+
async def git_add_subtree(ctx: AnyContext):
|
36
|
+
repo_dir = await get_repo_dir(log_method=ctx.print)
|
37
|
+
await add_subtree(
|
38
38
|
repo_dir=repo_dir,
|
39
39
|
name=ctx.input.name,
|
40
40
|
repo_url=ctx.input["repo-url"],
|
41
41
|
branch=ctx.input["repo-branch"],
|
42
42
|
prefix=ctx.input["repo-prefix"],
|
43
|
+
log_method=ctx.print,
|
43
44
|
)
|
44
45
|
|
45
46
|
|
@@ -50,8 +51,8 @@ def git_add_subtree(ctx: AnyContext):
|
|
50
51
|
group=git_subtree_group,
|
51
52
|
alias="pull",
|
52
53
|
)
|
53
|
-
def git_pull_subtree(ctx: AnyContext):
|
54
|
-
repo_dir = get_repo_dir()
|
54
|
+
async def git_pull_subtree(ctx: AnyContext):
|
55
|
+
repo_dir = await get_repo_dir(log_method=ctx.print)
|
55
56
|
config = load_config(repo_dir)
|
56
57
|
if not config.data:
|
57
58
|
raise ValueError("No subtree config found")
|
@@ -59,11 +60,12 @@ def git_pull_subtree(ctx: AnyContext):
|
|
59
60
|
for name, detail in config.data.items():
|
60
61
|
try:
|
61
62
|
ctx.print(f"Pull from subtree {name}")
|
62
|
-
pull_subtree(
|
63
|
+
await pull_subtree(
|
63
64
|
repo_dir=repo_dir,
|
64
65
|
prefix=detail.prefix,
|
65
66
|
repo_url=detail.repo_url,
|
66
67
|
branch=detail.branch,
|
68
|
+
log_method=ctx.print,
|
67
69
|
)
|
68
70
|
except Exception as e:
|
69
71
|
if first_err is None:
|
@@ -80,8 +82,8 @@ def git_pull_subtree(ctx: AnyContext):
|
|
80
82
|
group=git_subtree_group,
|
81
83
|
alias="push",
|
82
84
|
)
|
83
|
-
def git_push_subtree(ctx: AnyContext):
|
84
|
-
repo_dir = get_repo_dir()
|
85
|
+
async def git_push_subtree(ctx: AnyContext):
|
86
|
+
repo_dir = await get_repo_dir(log_method=ctx.print)
|
85
87
|
config = load_config(repo_dir)
|
86
88
|
if not config.data:
|
87
89
|
raise ValueError("No subtree config found")
|
@@ -89,11 +91,12 @@ def git_push_subtree(ctx: AnyContext):
|
|
89
91
|
for name, detail in config.data.items():
|
90
92
|
try:
|
91
93
|
ctx.print(f"Push to subtree {name}")
|
92
|
-
push_subtree(
|
94
|
+
await push_subtree(
|
93
95
|
repo_dir=repo_dir,
|
94
96
|
prefix=detail.prefix,
|
95
97
|
repo_url=detail.repo_url,
|
96
98
|
branch=detail.branch,
|
99
|
+
log_method=ctx.print,
|
97
100
|
)
|
98
101
|
except Exception as e:
|
99
102
|
if first_err is None:
|
@@ -6,7 +6,7 @@ from zrb.input.str_input import StrInput
|
|
6
6
|
from zrb.task.make_task import make_task
|
7
7
|
from zrb.task.scaffolder import Scaffolder
|
8
8
|
from zrb.task.task import Task
|
9
|
-
from zrb.util.string.conversion import double_quote
|
9
|
+
from zrb.util.string.conversion import double_quote, to_snake_case
|
10
10
|
from zrb.util.string.name import get_random_name
|
11
11
|
|
12
12
|
_DIR = os.path.dirname(__file__)
|
@@ -22,25 +22,21 @@ scaffold_fastapp = Scaffolder(
|
|
22
22
|
default_str=lambda _: os.getcwd(),
|
23
23
|
),
|
24
24
|
StrInput(
|
25
|
-
name="app
|
25
|
+
name="app",
|
26
26
|
description="App name",
|
27
27
|
prompt="App name",
|
28
|
-
default_str=lambda _: get_random_name(separator="_"),
|
29
28
|
),
|
30
29
|
],
|
31
30
|
source_path=os.path.join(_DIR, "fastapp_template"),
|
32
31
|
render_source_path=False,
|
33
|
-
destination_path=lambda ctx: os.path.join(
|
34
|
-
ctx.input["project-dir"], ctx.input["app-name"]
|
35
|
-
),
|
32
|
+
destination_path=lambda ctx: os.path.join(ctx.input["project-dir"], ctx.input.app),
|
36
33
|
transform_content={
|
37
|
-
"fastapp_template": "{to_snake_case(ctx.input
|
38
|
-
"App Name": "{ctx.input
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"
|
43
|
-
"secure-password": lambda _: get_random_name(),
|
34
|
+
"fastapp_template": "{to_snake_case(ctx.input.app)}",
|
35
|
+
"My App Name": "{ctx.input.app.title()}",
|
36
|
+
"my-app-name": "{to_kebab_case(ctx.input.app)}",
|
37
|
+
"my_app_name": "{to_snake_case(ctx.input.app)}",
|
38
|
+
"MY_APP_NAME": "{to_snake_case(ctx.input.app).upper()}",
|
39
|
+
"my-secure-password": lambda _: get_random_name(),
|
44
40
|
},
|
45
41
|
retries=0,
|
46
42
|
)
|
@@ -48,16 +44,34 @@ scaffold_fastapp = Scaffolder(
|
|
48
44
|
|
49
45
|
@make_task(
|
50
46
|
name="register-fastapp-automation",
|
47
|
+
retries=0,
|
51
48
|
)
|
52
49
|
def register_fastapp_automation(ctx: AnyContext):
|
53
50
|
project_dir_path = ctx.input["project-dir"]
|
54
51
|
zrb_init_path = os.path.join(project_dir_path, "zrb_init.py")
|
55
|
-
app_dir_path = ctx.input
|
56
|
-
|
52
|
+
app_dir_path = ctx.input.app
|
53
|
+
app_name = to_snake_case(ctx.input.app)
|
54
|
+
with open(zrb_init_path, "r") as f:
|
55
|
+
file_content = f.read().strip()
|
56
|
+
# Assemble new content
|
57
|
+
new_content_list = [file_content]
|
58
|
+
# Check if import load_file is exists, if not exists, add
|
59
|
+
import_load_file_script = "from zrb import load_file"
|
60
|
+
if import_load_file_script not in file_content:
|
61
|
+
new_content_list = [import_load_file_script] + new_content_list
|
62
|
+
# Add fastapp-automation script
|
63
|
+
automation_file_part = ", ".join(
|
57
64
|
[double_quote(part) for part in [app_dir_path, "_zrb", "main.py"]]
|
58
65
|
)
|
59
|
-
|
60
|
-
f
|
66
|
+
new_content_list = new_content_list + [
|
67
|
+
f"{app_name} = load_file(os.path.join(_DIR, {automation_file_part}))",
|
68
|
+
f"assert {app_name}",
|
69
|
+
"",
|
70
|
+
]
|
71
|
+
new_content = "\n".join(new_content_list)
|
72
|
+
# Write new content
|
73
|
+
with open(zrb_init_path, "w") as f:
|
74
|
+
f.write(new_content)
|
61
75
|
|
62
76
|
|
63
77
|
scaffold_fastapp >> register_fastapp_automation
|
@@ -66,6 +80,7 @@ add_fastapp_to_project = add_to_project_group.add_task(
|
|
66
80
|
Task(
|
67
81
|
name="add-fastapp",
|
68
82
|
description="🚀 Add FastApp to project",
|
83
|
+
retries=0,
|
69
84
|
),
|
70
85
|
alias="fastapp",
|
71
86
|
)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
from fastapp_template._zrb.group import app_create_group
|
2
|
+
|
3
|
+
from zrb import Task
|
4
|
+
|
5
|
+
create_my_app_name_column = app_create_group.add_task(
|
6
|
+
Task(
|
7
|
+
name="create-my-app-name-column",
|
8
|
+
description="📊 Create new column on an entity",
|
9
|
+
),
|
10
|
+
alias="column",
|
11
|
+
)
|
@@ -6,12 +6,12 @@ APP_DIR = os.path.dirname(DIR)
|
|
6
6
|
APP_MODULE_NAME = os.path.basename(APP_DIR)
|
7
7
|
|
8
8
|
MICROSERVICES_ENV_VARS = {
|
9
|
-
"
|
10
|
-
"
|
9
|
+
"MY_APP_NAME_MODE": "microservices",
|
10
|
+
"MY_APP_NAME_AUTH_BASE_URL": "http://localhost:3002",
|
11
11
|
}
|
12
|
-
MONOLITH_ENV_VARS = {"
|
12
|
+
MONOLITH_ENV_VARS = {"MY_APP_NAME_MODE": "monolith"}
|
13
13
|
|
14
14
|
if platform.system() == "Windows":
|
15
|
-
ACTIVATE_VENV_SCRIPT = "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser; . .venv
|
15
|
+
ACTIVATE_VENV_SCRIPT = "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser; . .venv\\Scripts\\Activate" # noqa
|
16
16
|
else:
|
17
17
|
ACTIVATE_VENV_SCRIPT = "source .venv/bin/activate"
|
@@ -0,0 +1,196 @@
|
|
1
|
+
import os
|
2
|
+
|
3
|
+
from fastapp_template._zrb.config import APP_DIR
|
4
|
+
from fastapp_template._zrb.group import app_create_group
|
5
|
+
from fastapp_template._zrb.helper import (
|
6
|
+
get_existing_module_names,
|
7
|
+
get_existing_schema_names,
|
8
|
+
)
|
9
|
+
from fastapp_template._zrb.input import (
|
10
|
+
existing_module_input,
|
11
|
+
new_entity_column_input,
|
12
|
+
new_entity_input,
|
13
|
+
plural_entity_input,
|
14
|
+
)
|
15
|
+
|
16
|
+
from zrb import AnyContext, Scaffolder, Task, make_task
|
17
|
+
from zrb.util.codemod.add_code_to_module import add_code_to_module
|
18
|
+
from zrb.util.codemod.add_parent_to_class import add_parent_to_class
|
19
|
+
from zrb.util.string.conversion import to_pascal_case, to_snake_case
|
20
|
+
|
21
|
+
|
22
|
+
@make_task(
|
23
|
+
name="validate-create-my-app-name-entity",
|
24
|
+
input=[
|
25
|
+
existing_module_input,
|
26
|
+
new_entity_input,
|
27
|
+
plural_entity_input,
|
28
|
+
new_entity_column_input,
|
29
|
+
],
|
30
|
+
retries=0,
|
31
|
+
)
|
32
|
+
async def validate_create_my_app_name_entity(ctx: AnyContext):
|
33
|
+
module_name = to_snake_case(ctx.input.module)
|
34
|
+
if module_name not in get_existing_module_names():
|
35
|
+
raise ValueError(f"Module not exist: {module_name}")
|
36
|
+
schema_name = to_snake_case(ctx.input.entity)
|
37
|
+
if schema_name in get_existing_schema_names():
|
38
|
+
raise ValueError(f"Schema already exists: {schema_name}")
|
39
|
+
|
40
|
+
|
41
|
+
scaffold_my_app_name_schema = Scaffolder(
|
42
|
+
name="scaffold-my-app-name-schema",
|
43
|
+
input=[
|
44
|
+
existing_module_input,
|
45
|
+
new_entity_input,
|
46
|
+
new_entity_column_input,
|
47
|
+
],
|
48
|
+
source_path=os.path.join(os.path.dirname(__file__), "schema.template.py"),
|
49
|
+
render_source_path=False,
|
50
|
+
destination_path=lambda ctx: os.path.join(
|
51
|
+
APP_DIR,
|
52
|
+
"schema",
|
53
|
+
f"{to_snake_case(ctx.input.entity)}.py",
|
54
|
+
),
|
55
|
+
transform_content={
|
56
|
+
"MyEntity": "{to_pascal_case(ctx.input.entity)}",
|
57
|
+
"my_column": "{to_snake_case(ctx.input.column)}",
|
58
|
+
},
|
59
|
+
retries=0,
|
60
|
+
upstream=validate_create_my_app_name_entity,
|
61
|
+
)
|
62
|
+
|
63
|
+
scaffold_my_app_name_module_entity = Scaffolder(
|
64
|
+
name="scaffold-my-app-name-schema",
|
65
|
+
input=[
|
66
|
+
existing_module_input,
|
67
|
+
new_entity_input,
|
68
|
+
plural_entity_input,
|
69
|
+
],
|
70
|
+
source_path=os.path.join(os.path.dirname(__file__), "module_template"),
|
71
|
+
render_source_path=False,
|
72
|
+
destination_path=lambda ctx: os.path.join(
|
73
|
+
APP_DIR,
|
74
|
+
"module",
|
75
|
+
f"{to_snake_case(ctx.input.module)}",
|
76
|
+
),
|
77
|
+
transform_content={
|
78
|
+
"my_module": "{to_snake_case(ctx.input.module)}",
|
79
|
+
"MyEntity": "{to_pascal_case(ctx.input.entity)}",
|
80
|
+
"my_entity": "{to_snake_case(ctx.input.entity)}",
|
81
|
+
"my_entities": "{to_snake_case(ctx.input.plural)}",
|
82
|
+
"my-entities": "{to_kebab_case(ctx.input.plural)}",
|
83
|
+
},
|
84
|
+
retries=0,
|
85
|
+
upstream=validate_create_my_app_name_entity,
|
86
|
+
)
|
87
|
+
|
88
|
+
|
89
|
+
@make_task(
|
90
|
+
name="register-my-app-name-migration",
|
91
|
+
input=[existing_module_input, new_entity_input],
|
92
|
+
retries=0,
|
93
|
+
upstream=validate_create_my_app_name_entity,
|
94
|
+
)
|
95
|
+
async def register_my_app_name_migration(ctx: AnyContext):
|
96
|
+
migration_metadata_file_path = os.path.join(
|
97
|
+
APP_DIR, "module", to_snake_case(ctx.input.module), "migration_metadata.py"
|
98
|
+
)
|
99
|
+
app_name = os.path.basename(APP_DIR)
|
100
|
+
with open(migration_metadata_file_path, "r") as f:
|
101
|
+
file_content = f.read()
|
102
|
+
entity_name = to_snake_case(ctx.input.entity)
|
103
|
+
entity_class = to_pascal_case(ctx.input.entity)
|
104
|
+
new_file_content_list = (
|
105
|
+
[f"from {app_name}.schema.{entity_name} import {entity_class}"]
|
106
|
+
+ file_content.strip()
|
107
|
+
+ [
|
108
|
+
f"{entity_class}.metadata = metadata",
|
109
|
+
f"{entity_class}.__table__.tometadata(metadata)",
|
110
|
+
"",
|
111
|
+
]
|
112
|
+
)
|
113
|
+
with open(migration_metadata_file_path, "w") as f:
|
114
|
+
f.write("\n".join(new_file_content_list))
|
115
|
+
|
116
|
+
|
117
|
+
@make_task(
|
118
|
+
name="register-my-app-name-api-client",
|
119
|
+
input=[existing_module_input, new_entity_input],
|
120
|
+
retries=0,
|
121
|
+
upstream=validate_create_my_app_name_entity,
|
122
|
+
)
|
123
|
+
async def register_my_app_name_api_client(ctx: AnyContext):
|
124
|
+
api_client_file_path = os.path.join(
|
125
|
+
APP_DIR, "module", to_snake_case(ctx.input.module), "client", "api_client.py"
|
126
|
+
)
|
127
|
+
with open(api_client_file_path, "r") as f:
|
128
|
+
file_content = f.read()
|
129
|
+
module_config_name = to_snake_case(ctx.input.module).upper()
|
130
|
+
new_code = add_code_to_module(
|
131
|
+
file_content,
|
132
|
+
f"user_api_client = user_usecase.as_api_client(base_url=APP_{module_config_name}_BASE_URL)", # noqa
|
133
|
+
)
|
134
|
+
new_code = add_parent_to_class(
|
135
|
+
original_code=new_code,
|
136
|
+
class_name="APIClient",
|
137
|
+
parent_class_name="user_api_client",
|
138
|
+
)
|
139
|
+
app_name = os.path.basename(APP_DIR)
|
140
|
+
entity_name = to_snake_case(ctx.input.entity)
|
141
|
+
module_name = to_snake_case(ctx.input.module)
|
142
|
+
new_file_content_list = [
|
143
|
+
f"from {app_name}.module.{module_name}.service.{entity_name} import {entity_name}_usecase", # noqa
|
144
|
+
new_code.strip(),
|
145
|
+
"",
|
146
|
+
]
|
147
|
+
with open(api_client_file_path, "w") as f:
|
148
|
+
f.write("\n".join(new_file_content_list))
|
149
|
+
|
150
|
+
|
151
|
+
@make_task(
|
152
|
+
name="register-my-app-name-direct-client",
|
153
|
+
input=[existing_module_input, new_entity_input],
|
154
|
+
retries=0,
|
155
|
+
upstream=validate_create_my_app_name_entity,
|
156
|
+
)
|
157
|
+
async def register_my_app_name_direct_client(ctx: AnyContext):
|
158
|
+
direct_client_file_path = os.path.join(
|
159
|
+
APP_DIR, "module", to_snake_case(ctx.input.module), "client", "direct_client.py"
|
160
|
+
)
|
161
|
+
with open(direct_client_file_path, "r") as f:
|
162
|
+
file_content = f.read()
|
163
|
+
new_code = add_code_to_module(
|
164
|
+
file_content, "user_direct_client = user_usecase.as_direct_client()"
|
165
|
+
)
|
166
|
+
new_code = add_parent_to_class(
|
167
|
+
original_code=new_code,
|
168
|
+
class_name="DirectClient",
|
169
|
+
parent_class_name="user_direct_client",
|
170
|
+
)
|
171
|
+
app_name = os.path.basename(APP_DIR)
|
172
|
+
entity_name = to_snake_case(ctx.input.entity)
|
173
|
+
module_name = to_snake_case(ctx.input.module)
|
174
|
+
new_file_content_list = [
|
175
|
+
f"from {app_name}.module.{module_name}.service.{entity_name} import {entity_name}_usecase", # noqa
|
176
|
+
new_code.strip(),
|
177
|
+
"",
|
178
|
+
]
|
179
|
+
with open(direct_client_file_path, "w") as f:
|
180
|
+
f.write("\n".join(new_file_content_list))
|
181
|
+
|
182
|
+
|
183
|
+
create_my_app_name_entity = app_create_group.add_task(
|
184
|
+
Task(
|
185
|
+
name="create-my-app-name-entity",
|
186
|
+
description="🏗️ Create new entity on a module",
|
187
|
+
successor="",
|
188
|
+
),
|
189
|
+
alias="entity",
|
190
|
+
)
|
191
|
+
create_my_app_name_entity << [
|
192
|
+
scaffold_my_app_name_schema,
|
193
|
+
scaffold_my_app_name_module_entity,
|
194
|
+
register_my_app_name_api_client,
|
195
|
+
register_my_app_name_direct_client,
|
196
|
+
]
|
@@ -0,0 +1,66 @@
|
|
1
|
+
from fastapp_template.common.base_usecase import BaseUsecase
|
2
|
+
from fastapp_template.module.my_module.service.my_entity.repository.factory import (
|
3
|
+
my_entity_repository,
|
4
|
+
)
|
5
|
+
from fastapp_template.module.my_module.service.my_entity.repository.repository import (
|
6
|
+
MyEntityRepository,
|
7
|
+
)
|
8
|
+
from fastapp_template.schema.my_entity import (
|
9
|
+
MyEntityCreate,
|
10
|
+
MyEntityResponse,
|
11
|
+
MyEntityUpdate,
|
12
|
+
)
|
13
|
+
|
14
|
+
|
15
|
+
class MyEntityUsecase(BaseUsecase):
|
16
|
+
|
17
|
+
def __init__(self, my_entity_repository: MyEntityRepository):
|
18
|
+
super().__init__()
|
19
|
+
self.my_entity_repository = my_entity_repository
|
20
|
+
|
21
|
+
@BaseUsecase.route(
|
22
|
+
"/api/v1/my-entities/{my_entity_id}",
|
23
|
+
methods=["get"],
|
24
|
+
response_model=MyEntityResponse,
|
25
|
+
)
|
26
|
+
async def get_my_entity_by_id(self, my_entity_id: str) -> MyEntityResponse:
|
27
|
+
return await self.my_entity_repository.get_by_id(my_entity_id)
|
28
|
+
|
29
|
+
@BaseUsecase.route(
|
30
|
+
"/api/v1/my-entities", methods=["get"], response_model=list[MyEntityResponse]
|
31
|
+
)
|
32
|
+
async def get_all_my_entities(self) -> list[MyEntityResponse]:
|
33
|
+
return await self.my_entity_repository.get_all()
|
34
|
+
|
35
|
+
@BaseUsecase.route(
|
36
|
+
"/api/v1/my-entities",
|
37
|
+
methods=["post"],
|
38
|
+
response_model=MyEntityResponse | list[MyEntityResponse],
|
39
|
+
)
|
40
|
+
async def create_my_entity(
|
41
|
+
self, data: MyEntityCreate | list[MyEntityCreate]
|
42
|
+
) -> MyEntityResponse | list[MyEntityResponse]:
|
43
|
+
if isinstance(data, MyEntityCreate):
|
44
|
+
return await self.my_entity_repository.create(data)
|
45
|
+
return await self.my_entity_repository.create_bulk(data)
|
46
|
+
|
47
|
+
@BaseUsecase.route(
|
48
|
+
"/api/v1/my-entities/{my_entity_id}",
|
49
|
+
methods=["put"],
|
50
|
+
response_model=MyEntityResponse,
|
51
|
+
)
|
52
|
+
async def update_my_entity(
|
53
|
+
self, my_entity_id: str, data: MyEntityUpdate
|
54
|
+
) -> MyEntityResponse:
|
55
|
+
return await self.my_entity_repository.update(my_entity_id, data)
|
56
|
+
|
57
|
+
@BaseUsecase.route(
|
58
|
+
"/api/v1/my-entities/{my_entity_id}",
|
59
|
+
methods=["delete"],
|
60
|
+
response_model=MyEntityResponse,
|
61
|
+
)
|
62
|
+
async def delete_my_entity(self, my_entity_id: str) -> MyEntityResponse:
|
63
|
+
return await self.my_entity_repository.delete(my_entity_id)
|
64
|
+
|
65
|
+
|
66
|
+
my_entity_usecase = MyEntityUsecase(my_entity_repository=my_entity_repository)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from fastapp_template.common.db_engine import engine
|
2
|
+
from fastapp_template.config import APP_REPOSITORY_TYPE
|
3
|
+
from fastapp_template.module.my_module.service.my_entity.repository.my_entity_db_repository import (
|
4
|
+
MyEntityDBRepository,
|
5
|
+
)
|
6
|
+
from fastapp_template.module.my_module.service.my_entity.repository.my_entity_repository import (
|
7
|
+
MyEntityRepository,
|
8
|
+
)
|
9
|
+
|
10
|
+
if APP_REPOSITORY_TYPE == "db":
|
11
|
+
my_entity_repository: MyEntityRepository = MyEntityDBRepository(engine)
|
12
|
+
else:
|
13
|
+
my_entity_repository: MyEntityRepository = None
|
@@ -0,0 +1,33 @@
|
|
1
|
+
from fastapp_template.common.base_db_repository import BaseDBRepository
|
2
|
+
from fastapp_template.common.error import NotFoundError
|
3
|
+
from fastapp_template.module.my_module.service.my_entity.repository.my_entity_repository import (
|
4
|
+
MyEntityRepository,
|
5
|
+
)
|
6
|
+
from fastapp_template.schema.my_entity import (
|
7
|
+
MyEntity,
|
8
|
+
MyEntityCreate,
|
9
|
+
MyEntityResponse,
|
10
|
+
MyEntityUpdate,
|
11
|
+
)
|
12
|
+
from passlib.context import CryptContext
|
13
|
+
from sqlalchemy.ext.asyncio import AsyncSession
|
14
|
+
from sqlmodel import Session, select
|
15
|
+
|
16
|
+
# Password hashing context
|
17
|
+
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
18
|
+
|
19
|
+
|
20
|
+
def hash_password(password: str) -> str:
|
21
|
+
return pwd_context.hash(password)
|
22
|
+
|
23
|
+
|
24
|
+
class MyEntityDBRepository(
|
25
|
+
BaseDBRepository[MyEntity, MyEntityResponse, MyEntityCreate, MyEntityUpdate],
|
26
|
+
MyEntityRepository,
|
27
|
+
):
|
28
|
+
db_model = MyEntity
|
29
|
+
response_model = MyEntityResponse
|
30
|
+
create_model = MyEntityCreate
|
31
|
+
update_model = MyEntityUpdate
|
32
|
+
entity_name = "my_entity"
|
33
|
+
column_preprocessors = {}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
|
3
|
+
from fastapp_template.schema.my_entity import (
|
4
|
+
MyEntity,
|
5
|
+
MyEntityCreate,
|
6
|
+
MyEntityResponse,
|
7
|
+
MyEntityUpdate,
|
8
|
+
)
|
9
|
+
|
10
|
+
|
11
|
+
class MyEntityRepository(ABC):
|
12
|
+
|
13
|
+
@abstractmethod
|
14
|
+
async def create(self, my_entity_data: MyEntityCreate) -> MyEntityResponse:
|
15
|
+
pass
|
16
|
+
|
17
|
+
@abstractmethod
|
18
|
+
async def get_by_id(self, my_entity_id: str) -> MyEntity:
|
19
|
+
pass
|
20
|
+
|
21
|
+
@abstractmethod
|
22
|
+
async def get_all(self) -> list[MyEntity]:
|
23
|
+
pass
|
24
|
+
|
25
|
+
@abstractmethod
|
26
|
+
async def update(
|
27
|
+
self, my_entity_id: str, my_entity_data: MyEntityUpdate
|
28
|
+
) -> MyEntity:
|
29
|
+
pass
|
30
|
+
|
31
|
+
@abstractmethod
|
32
|
+
async def delete(self, my_entity_id: str) -> MyEntity:
|
33
|
+
pass
|
34
|
+
|
35
|
+
@abstractmethod
|
36
|
+
async def create_bulk(
|
37
|
+
self, my_entity_data_list: list[MyEntityCreate]
|
38
|
+
) -> list[MyEntityResponse]:
|
39
|
+
pass
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import datetime
|
2
|
+
|
3
|
+
import ulid
|
4
|
+
from sqlmodel import Field, SQLModel
|
5
|
+
|
6
|
+
|
7
|
+
class MyEntityBase(SQLModel):
|
8
|
+
my_column: str
|
9
|
+
|
10
|
+
|
11
|
+
class MyEntityCreate(MyEntityBase):
|
12
|
+
pass
|
13
|
+
|
14
|
+
|
15
|
+
class MyEntityUpdate(SQLModel):
|
16
|
+
my_column: str | None = None
|
17
|
+
|
18
|
+
|
19
|
+
class MyEntityResponse(MyEntityBase):
|
20
|
+
id: str
|
21
|
+
|
22
|
+
|
23
|
+
class MyEntity(SQLModel, table=True):
|
24
|
+
id: str = Field(default_factory=lambda: ulid.new().str, primary_key=True)
|
25
|
+
created_at: datetime.datetime
|
26
|
+
created_by: str
|
27
|
+
updated_at: datetime.datetime
|
28
|
+
updated_by: str
|
29
|
+
my_column: str
|