mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-20 14:42:28 +02:00
### Summary ``` % langgraph deploy revisions list f5bb6e58-e2ab-40b9-9855-d6dd6d1051b6 No LangSmith API key found. Create one at Settings > API Keys in LangSmith. Enter LangSmith API key: Revision ID Status Created At ------------------------------------ -------- --------------------------- fe05f163-58cf-4783-a918-0c78a8fab0c7 BUILDING 2026-03-12T20:47:14.626436Z 03c32fcf-544f-4517-a016-c7a7243b898d DEPLOYED 2026-03-12T20:30:09.199275Z 29605810-29cc-4110-ac05-d43e564827d0 DEPLOYED 2026-03-12T19:56:36.232427Z ```
92 lines
3.1 KiB
Python
92 lines
3.1 KiB
Python
from collections.abc import Sequence
|
|
|
|
import click
|
|
|
|
|
|
def clean_empty_lines(input_str: str):
|
|
return "\n".join(filter(None, input_str.splitlines()))
|
|
|
|
|
|
def warn_non_wolfi_distro(config_json: dict) -> None:
|
|
"""Show warning if image_distro is not set to 'wolfi'."""
|
|
image_distro = config_json.get("image_distro", "debian") # Default is debian
|
|
if image_distro != "wolfi":
|
|
click.secho(
|
|
"⚠️ Security Recommendation: Consider switching to Wolfi Linux for enhanced security.",
|
|
fg="yellow",
|
|
bold=True,
|
|
)
|
|
click.secho(
|
|
" Wolfi is a security-oriented, minimal Linux distribution designed for containers.",
|
|
fg="yellow",
|
|
)
|
|
click.secho(
|
|
' To switch, add \'"image_distro": "wolfi"\' to your langgraph.json config file.',
|
|
fg="yellow",
|
|
)
|
|
click.secho("") # Empty line for better readability
|
|
|
|
|
|
def _extract_deployment_url(deployment: dict[str, object]) -> str:
|
|
source_config = deployment.get("source_config")
|
|
if isinstance(source_config, dict):
|
|
custom_url = source_config.get("custom_url")
|
|
if isinstance(custom_url, str) and custom_url:
|
|
return custom_url
|
|
return "-"
|
|
|
|
|
|
def format_deployments_table(deployments: Sequence[dict[str, object]]) -> str:
|
|
headers = ("Deployment ID", "Deployment Name", "Deployment URL")
|
|
rows = [
|
|
(
|
|
str(deployment.get("id", "-") or "-"),
|
|
str(deployment.get("name", "-") or "-"),
|
|
_extract_deployment_url(deployment),
|
|
)
|
|
for deployment in deployments
|
|
]
|
|
widths = [
|
|
max(len(headers[index]), *(len(row[index]) for row in rows))
|
|
for index in range(len(headers))
|
|
]
|
|
|
|
def format_row(row: Sequence[str]) -> str:
|
|
return " ".join(value.ljust(widths[index]) for index, value in enumerate(row))
|
|
|
|
lines = [format_row(headers), format_row(tuple("-" * width for width in widths))]
|
|
lines.extend(format_row(row) for row in rows)
|
|
return "\n".join(lines)
|
|
|
|
|
|
def format_revisions_table(revisions: Sequence[dict[str, object]]) -> str:
|
|
headers = ("Revision ID", "Status", "Created At")
|
|
latest_deployed_seen = False
|
|
rows = []
|
|
for revision in revisions:
|
|
status = str(revision.get("status", "-") or "-")
|
|
if status == "DEPLOYED":
|
|
if latest_deployed_seen:
|
|
status = "REPLACED"
|
|
else:
|
|
latest_deployed_seen = True
|
|
rows.append(
|
|
(
|
|
str(revision.get("id", "-") or "-"),
|
|
status,
|
|
str(revision.get("created_at", "-") or "-"),
|
|
)
|
|
)
|
|
|
|
widths = [
|
|
max(len(headers[index]), *(len(row[index]) for row in rows))
|
|
for index in range(len(headers))
|
|
]
|
|
|
|
def format_row(row: Sequence[str]) -> str:
|
|
return " ".join(value.ljust(widths[index]) for index, value in enumerate(row))
|
|
|
|
lines = [format_row(headers), format_row(tuple("-" * width for width in widths))]
|
|
lines.extend(format_row(row) for row in rows)
|
|
return "\n".join(lines)
|