INNER CODE UNIT · Python

sync_plugin_deps

fastapi-practices/fba-slim · backend/cli.py:418

async def sync_plugin_deps(plugin: str | None = None) -> None:
    """同步插件依赖"""
    console.note(f'正在安装插件 {plugin} 依赖...' if plugin else '正在安装所有插件依赖...')
    try:
        await install_requirements_async(plugin)
    except Exception as e:
        raise cappa.Exit(e.msg if isinstance(e, BaseExceptionError) else str(e), code=1)
    console.tip(f'插件 {plugin} 依赖安装完成' if plugin else '所有插件依赖安装完成')


async def sync_deps(plugin: str | None, *, no_project: bool = False, no_plugin: bool = False) -> None:
    """同步项目和插件依赖"""
    if no_project and no_plugin:
        raise cappa.Exit('--no-project 和 --no-plugin 不能同时使用', code=1)
    if plugin is not None and no_plugin:
        raise cappa.Exit('--plugin 和 --no-plugin 不能同时使用', code=1)

    should_sync_plugins = False if no_plugin else should_sync_plugin_deps(plugin, allow_empty=not no_project)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…