INNER CODE UNIT · Python
should_sync_plugin_deps
fastapi-practices/fba-slim · backend/cli.py:393
def should_sync_plugin_deps(plugin: str | None, *, allow_empty: bool) -> bool:
"""检查是否需要同步插件依赖"""
plugins = get_plugins()
if plugin is not None and plugin not in plugins:
raise cappa.Exit(f'插件 {plugin} 不存在', code=1)
if not plugins:
if allow_empty:
console.warning('当前没有已安装的插件,跳过插件依赖同步')
return False
raise cappa.Exit('当前没有已安装的插件', code=1)
return True
async def sync_project_deps() -> None:
"""同步项目依赖"""
console.note('正在同步项目依赖...')
try:
await run_in_threadpool(subprocess.run, ['uv', 'sync'], cwd=BASE_PATH.parent, check=True)