Plot the flow from declarative config or the Python UV entrypoint.
()
| 4 | |
| 5 | |
| 6 | def plot_flow() -> None: |
| 7 | """ |
| 8 | Plot the flow from declarative config or the Python UV entrypoint. |
| 9 | """ |
| 10 | from crewai_cli.run_declarative_flow import ( |
| 11 | configured_project_declarative_flow, |
| 12 | plot_declarative_flow_in_project_env, |
| 13 | ) |
| 14 | |
| 15 | if definition := configured_project_declarative_flow(): |
| 16 | plot_declarative_flow_in_project_env(definition) |
| 17 | else: |
| 18 | command = ["uv", "run", "plot"] |
| 19 | |
| 20 | try: |
| 21 | subprocess.run( # noqa: S603 |
| 22 | command, capture_output=False, text=True, check=True |
| 23 | ) |
| 24 | |
| 25 | except subprocess.CalledProcessError as e: |
| 26 | click.echo(f"An error occurred while plotting the flow: {e}", err=True) |
| 27 | raise SystemExit(1) from e |
| 28 | |
| 29 | except Exception as e: |
| 30 | click.echo(f"An unexpected error occurred: {e}", err=True) |
| 31 | raise SystemExit(1) from e |
no test coverage detected