Command Line Interface

Flows SDK provides a CLI tool that simplifies packaging multiple flows.

Bundling Flows

The CLI tool allows bundling one or multiple flows into a single zip file, which simplifies the process of importing into a Hyperscience instance. It can also extract the functions of code blocks into separate python files during the bundling process. The tool is installed alongside Flows SDK when you install the Flows SDK wheel, and is accessible as hs-flows.

Syntax

hs-flows bundle INPUT [INPUT ...] [-o OUTPUT] [-e ENTRY_POINT] [-c CODE_POLICY] [-h]

where:

  • INPUT: Specifies the input of the bundle operation. Either a Python file (.py extension) that contains a flow definition, or a directory containing multiple .py flow definition files. Multiple input arguments are supported, allowing for an arbitrary number of flows to be bundled.

  • OUTPUT: Specifies the output of the bundle operation. Either a zip filename, or a directory inside which the tool will auto-generate a zip. Optional, defaults to current directory. CAUTION: this will overwrite the zip file if it already exists.

  • ENTRY_POINT: Specifies the name of the flow entry-point function inside the processed flow files. The entry-point function is the one that returns the final constructed Flow object. Optional, defaults to entry_point_flow.

  • CODE_POLICY: Policy for handling code blocks’ code, inline or files. Optional, defaults to inline.

    • inline: Leave code inline in the json.

    • files: Extract code into separate python files in the zip. This allows working with (downloading and uploading) those files directly from the UI for code blocks, without having to reimport the flow that uses them. This may help for quicker iterations during flows’ development. However, the recommended mode of work in production scenarios is to keep these inline in the json and to always treat your Python-based flow definition as the source of truth.

  • -h/--help: Display a detailed help message and exit.

Examples

Print help message and exit:

hs-flows bundle --help

Bundle some_flow.py into example.zip with code inline in the json:

hs-flows bundle some_flow.py -o example.zip -c inline

Bundle all flows found in directory/flows into a default zip (flows-<timestamp>.zip) with code extracted into files:

hs-flows bundle directory/flows -c files

Bundle hello_flow.py and fork_flow.py into two_flows.zip with code inline in the json:

hs-flows bundle hello_flow.py fork_flow.py -o two_flows.zip