Kedro Viz CLI reference¶
The Kedro Viz CLI provides commands to visualise Kedro pipelines, deploy them to cloud platforms, and export the visualisation data. Below is a detailed description of the available commands and options.
Commands¶
kedro viz¶
Launches a local Kedro Viz instance to visualise a Kedro pipeline.
Usage:
kedro viz [OPTIONS]
Description:
This command launches the Kedro Viz server to visualise a Kedro pipeline. It is functionally the same as kedro viz run. If no sub-command is provided, run is used by default.
Options:
This command accepts all the options that are available in the kedro viz, kedro viz run command. See the kedro viz run section for a complete list of options.
kedro viz run¶
Launches a local Kedro Viz instance to visualise a Kedro pipeline.
Usage:
kedro viz run [OPTIONS]
Options:
--host <host>Host that Kedro Viz will listen to. Defaults to
localhost.
--port <port>TCP port that Kedro Viz will listen to. Defaults to
4141.
--browser / --no-browserWhether to open the Kedro Viz interface in the default browser. The browser will open if the host is
localhost. Defaults toTrue.
--load-file <path>Path to load Kedro Viz data from a directory. If provided, Kedro Viz will load the visualisation data from this path instead of generating it from the pipeline
--save-file <path>Path to save Kedro Viz data to a directory. If provided, the visualisation data will be saved to this path for later use.
--pipeline, -p <pipeline>Name of the registered pipeline to visualise. If not set, the default pipeline is visualised.
--env, -e {environment>}Kedro configuration environment. If not specified, the catalog config in
localwill be used. You can also set this through theKEDRO_ENVenvironment variable.
--autoreload, -aEnable autoreload of the Kedro Viz server when a Python or YAML file changes in the Kedro project.
--include-hooksInclude all registered hooks in the Kedro project for visualisation.
--params <params>Specify extra parameters for the Kedro Viz run. This option supports the same format as the
paramsoption in the Kedro CLI.
--liteAn experimental flag to open Kedro-Viz without Kedro project dependencies.
Note
When running Kedro Viz locally with the --autoreload option, the server will automatically restart whenever there are changes to Python, YAML, or JSON files in the Kedro project. This is particularly useful during development.
kedro viz deploy¶
Deploy and host Kedro Viz on a specified cloud platform.
Note
The deploy command supports deployment to AWS, Azure and GCP. Ensure that your cloud credentials and configurations are correctly set up before deploying.
Usage:
kedro viz deploy [OPTIONS]
Options:
--platform <platform>The cloud platform to host Kedro Viz on. Supported platforms include
awsazureandgcp. This option is required.
--endpoint <endpoint>The static website hosted endpoint. This option is required.
--bucket-name <bucket-name>The name of the bucket where Kedro Viz will be hosted. This option is required.
--include-hooksInclude all registered hooks in the Kedro project in the deployed visualisation.
--include-previewsInclude previews for all datasets in the deployed visualisation.
kedro viz build¶
Create a build directory of a local Kedro Viz instance with Kedro project data.
Usage:
kedro viz build [OPTIONS]
Options:
--include-hooksInclude all registered hooks in the Kedro project in the built visualisation.
--include-previewsInclude previews for all datasets in the built visualisation.
Examples¶
Running Kedro Viz locally¶
To run Kedro Viz on your local machine, use:
kedro viz
To specify a particular pipeline and environment:
kedro viz -p my_pipeline -e dev
or
kedro viz run -p my_pipeline -e dev
Deploying Kedro Viz to AWS¶
To deploy Kedro Viz to an S3 bucket on AWS:
kedro viz deploy --platform aws --endpoint http://mybucket.s3-website-us-west-2.amazonaws.com --bucket-name mybucket
Building Kedro Viz to host on multiple platforms¶
To create a build directory with the visualisation data:
kedro viz build --include-previews
Kedro-viz directory structure when you save it as a file¶
When you use the --save-file option, Kedro Viz generates a directory structure to save the visualization data. This directory can later be used with the --load-file to reload the visualization.
The generated directory structure looks like this:
api/
├── main # Main file containing pipeline structure
├── nodes/
│ ├── node1 # JSON files for individual nodes
│ ├── node2
│ └── ...
├── pipelines/
│ ├── pipeline1 # JSON files for individual pipelines
│ ├── pipeline2
│ └── ...