Skip to content

CLI

The Chorey CLI provides a simple interface to execute any defined pipeline directly from the command line, enabling quick testing and operational use. The CLI uses typer for command definition and is executed via the chorey command.

chorey run

Executes a specified pipeline with a provided input value.

Syntax

chorey run <pipeline_path> --input <input_value>

Arguments and Options

Component Type Description
<pipeline_path> str The Python import path to the pipeline object (e.g., my_module.submodule:pipeline).
--input, -i str The input value to feed to the pipeline's first step. This value is automatically converted to the expected input type.

Execution and Type Conversion

  1. Import: The Python object specified by <pipeline_path> is imported and verified as a valid Step.
  2. Type Inspection: The framework inspects the pipeline to determine the required input type for its very first step (FirstInputType).
  3. Input Parsing: The value provided via --input (which is always a string) is passed to the internal parse_cli_input utility. This utility attempts to convert the string into the required FirstInputType.
  4. Primitives: Simple types like str, int, or bool are handled directly.
  5. Complex Types: For dataclass, Pydantic models, or complex nested types, the input string is treated as a JSON payload. (Note: If you need custom parsing logic, consider using Pydantic models for your first step's input.)
  6. Execution: The pipeline is executed asynchronously using asyncio.run().
  7. Output: The final result of the pipeline is printed to standard output.

Input Examples

First Step Input Type CLI Input Notes
int 42 Direct integer input.
str "Hello, World!" Direct string input.
bool 0 or 1 Boolean input (0 for False, 1 for True).
dict '{"key": "value", "number": 123}' Must be valid JSON string.
Pydantic model '{"name": "Alice", "age": 30}' JSON string matching the model schema.

Limitations

chorey mermaid

Generates and prints the Mermaid diagram representation of a specified pipeline.

Syntax

chorey visualize <pipeline_path>

Arguments

Component Type Description
<pipeline_path> str The Python import path to the pipeline object (e.g., my_module.submodule:pipeline).

Execution

  1. Import: The Python object specified by <pipeline_path> is imported and verified as a valid Step.
  2. Diagram Generation: The framework generates the Mermaid diagram representation of the pipeline using the mermaid() method.
  3. Output: The Mermaid diagram is printed to standard output.