From 6d95ddef4c05e3bfed0879afe6c81e6a357f6aca Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Sat, 14 Mar 2026 15:21:14 -0700 Subject: [PATCH] style: black format setup_wizard.py --- litellm/setup_wizard.py | 61 +++++++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/litellm/setup_wizard.py b/litellm/setup_wizard.py index 8f324dc8432..822dcb31cdc 100644 --- a/litellm/setup_wizard.py +++ b/litellm/setup_wizard.py @@ -333,7 +333,11 @@ class SetupWizard: """Number-based fallback when raw terminal input is unavailable.""" print() print(f" {bold('Add your first model')}") - print(grey(" Enter numbers separated by commas (e.g. 1,2). Press Enter to confirm.")) + print( + grey( + " Enter numbers separated by commas (e.g. 1,2). Press Enter to confirm." + ) + ) print() for i, p in enumerate(PROVIDERS, 1): print(f" {grey(str(i) + '.')} {bold(p['name'])} {grey(p['description'])}") @@ -345,7 +349,11 @@ class SetupWizard: print(grey(" Please select at least one provider.")) continue try: - nums = [int(x.strip()) for x in raw.replace(" ", ",").split(",") if x.strip()] + nums = [ + int(x.strip()) + for x in raw.replace(" ", ",").split(",") + if x.strip() + ] valid = sorted({n for n in nums if 1 <= n <= len(PROVIDERS)}) if not valid: print(grey(f" Enter numbers between 1 and {len(PROVIDERS)}.")) @@ -364,12 +372,18 @@ class SetupWizard: print() print(f" {bold('Enter your API keys')}") print(grey(" Keys are stored only in the generated config file.")) - print(grey(" Tip: add litellm_config.yaml to .gitignore to avoid committing secrets.")) + print( + grey( + " Tip: add litellm_config.yaml to .gitignore to avoid committing secrets." + ) + ) print() for p in providers: if p["env_key"] is None: - print(f" {green(p['name'])}: {grey('no key needed (uses local Ollama)')}") + print( + f" {green(p['name'])}: {grey('no key needed (uses local Ollama)')}" + ) continue key = SetupWizard._prompt_key(p) @@ -395,7 +409,9 @@ class SetupWizard: f" {blue('❯')} Azure deployment name {grey('(e.g. my-gpt4o)')}: " ) if deployment: - env_vars[f"_LITELLM_AZURE_DEPLOYMENT_{p['id'].upper()}"] = deployment + env_vars[f"_LITELLM_AZURE_DEPLOYMENT_{p['id'].upper()}"] = ( + deployment + ) SetupWizard._validate_and_report(p, key) @@ -406,7 +422,9 @@ class SetupWizard: """Prompt for a provider's API key, with skip option. Returns the key or ''.""" hint = grey(provider.get("key_hint", "")) while True: - key = _styled_input(f" {blue('❯')} {bold(provider['name'])} API key {hint}: ") + key = _styled_input( + f" {blue('❯')} {bold(provider['name'])} API key {hint}: " + ) if key: return key print(grey(" Key is required. Leave blank to skip this provider.")) @@ -424,14 +442,22 @@ class SetupWizard: return # Azure / Bedrock / Ollama — skip while True: - print(f" {grey('Testing connection to ' + provider['name'] + '...')}", flush=True) + print( + f" {grey('Testing connection to ' + provider['name'] + '...')}", + flush=True, + ) valid = check_valid_key(model=test_model, api_key=api_key) if valid: - print(f" {green(_CHECK)} {bold(provider['name'])} connected successfully") + print( + f" {green(_CHECK)} {bold(provider['name'])} connected successfully" + ) return print(f" {_CROSS} {bold(provider['name'])} {grey('— invalid API key')}") - if _styled_input(f" {blue('❯')} Re-enter key? {grey('(y/N)')}: ").lower() != "y": + if ( + _styled_input(f" {blue('❯')} Re-enter key? {grey('(y/N)')}: ").lower() + != "y" + ): return hint = grey(provider.get("key_hint", "")) @@ -548,9 +574,13 @@ class SetupWizard: ).lower() if start not in ("", "y", "yes"): print() - print(f" Run {bold(f'litellm --config {config_path}')} whenever you're ready.") + print( + f" Run {bold(f'litellm --config {config_path}')} whenever you're ready." + ) print() - print(grey(f" Quick test once running: curl http://localhost:{port}/health")) + print( + grey(f" Quick test once running: curl http://localhost:{port}/health") + ) print() return @@ -580,7 +610,14 @@ class SetupWizard: scripts_dir = sysconfig.get_path("scripts") litellm_bin = os.path.join(scripts_dir or "", "litellm") try: - os.execlp(litellm_bin, litellm_bin, "--config", str(config_path), "--port", str(port)) # noqa: S606 + os.execlp( + litellm_bin, + litellm_bin, + "--config", + str(config_path), + "--port", + str(port), + ) # noqa: S606 except OSError as exc: print(f"\n {bold(_CROSS + ' Could not start proxy:')} {exc}") print(f" Run manually: litellm --config {config_path} --port {port}\n")