From 2c19f476b8d6a18f0eff1bea3a8cadcb94e69f2c Mon Sep 17 00:00:00 2001 From: Ravi Kumar Pilla Date: Wed, 17 Jul 2024 11:13:28 -0500 Subject: [PATCH 1/7] Adjust requirements file and dependabot versioning strategy (#1978) * relax deps test with upperbounds * relax deps test with upperbounds * rolling back to inc-if-nec as pip does not has support for widen * change version strat to auto * update release note --- .github/dependabot.yml | 2 +- RELEASE.md | 1 + package/requirements.txt | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1f29f45aa7..026ce8876e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,7 +9,7 @@ updates: directory: "/package" # Location of package manifests schedule: interval: "monthly" - versioning-strategy: increase-if-necessary + versioning-strategy: auto ignore: - dependency-name: "types-*" labels: diff --git a/RELEASE.md b/RELEASE.md index 6a0c444866..1466cd07f8 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -22,6 +22,7 @@ Please follow the established format: - Add "-p" flag to kedro-viz to match kedro run. (#1960) - Fix bug related to nested namespace pipelines. (#1897) - Migrate from `toposort` to `graphlib`. (#1942) +- Adjust requirements file and dependabot versioning strategy. (#1978) # Release 9.1.0 diff --git a/package/requirements.txt b/package/requirements.txt index aeede64313..2b1dad563f 100644 --- a/package/requirements.txt +++ b/package/requirements.txt @@ -5,7 +5,7 @@ fsspec>=2021.4 ipython>=7.0.0, <9.0 kedro>=0.18.0 networkx>=2.5 -orjson~=3.9 +orjson>=3.9, <4.0 packaging>=23.0 pandas>=1.3 plotly>=4.0 @@ -13,5 +13,5 @@ pydantic>=2.0.0 secure>=0.3.0 sqlalchemy>=1.4, <3 strawberry-graphql>=0.192.0, <1.0 -uvicorn[standard]~=0.30.0 -watchgod~=0.8.2 +uvicorn[standard]>=0.30.0, <1.0 +watchgod>=0.8.2, <1.0 From 242f1509cdc62be1d97e4313bb191412cc9084fb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:15:03 -0500 Subject: [PATCH 2/7] Update pytest-mock requirement from ~=3.11 to ~=3.14 in /package (#1986) Updates the requirements on [pytest-mock](https://github.com/pytest-dev/pytest-mock) to permit the latest version. - [Release notes](https://github.com/pytest-dev/pytest-mock/releases) - [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.11.0...v3.14.0) --- updated-dependencies: - dependency-name: pytest-mock dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package/test_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/test_requirements.txt b/package/test_requirements.txt index 1c9e3ec12a..81deb02d45 100644 --- a/package/test_requirements.txt +++ b/package/test_requirements.txt @@ -17,7 +17,7 @@ pylint~=3.0 pylint-pydantic>=0.3.0 pytest~=8.1 pytest-asyncio~=0.21 -pytest-mock~=3.11 +pytest-mock~=3.14 pytest-cov~=5.0 sqlalchemy-stubs~=0.4 strawberry-graphql[cli]>=0.99.0, <1.0 From cf8c4d5d8e2ea4aae6300bc735cd740273d85d55 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:27:56 -0500 Subject: [PATCH 3/7] Update boto3 requirement from ~=1.26 to ~=1.34 in /package (#1988) Updates the requirements on [boto3](https://github.com/boto/boto3) to permit the latest version. - [Release notes](https://github.com/boto/boto3/releases) - [Commits](https://github.com/boto/boto3/compare/1.26.0...1.34.144) --- updated-dependencies: - dependency-name: boto3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ravi Kumar Pilla --- package/test_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/test_requirements.txt b/package/test_requirements.txt index 81deb02d45..dc2e73171a 100644 --- a/package/test_requirements.txt +++ b/package/test_requirements.txt @@ -6,7 +6,7 @@ kedro-telemetry>=0.1.1 # for testing telemetry integration bandit~=1.7 behave~=1.2 black~=23.3 -boto3~=1.26 +boto3~=1.34 flake8~=7.0 isort~=5.11 matplotlib~=3.5 From af9c147de51fec6b985a5781a8f00a7fa3f434b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 18:38:06 -0500 Subject: [PATCH 4/7] Update mypy requirement from ~=1.0 to ~=1.10 in /package (#1990) Updates the requirements on [mypy](https://github.com/python/mypy) to permit the latest version. - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](https://github.com/python/mypy/compare/v1.0.0...v1.10.1) --- updated-dependencies: - dependency-name: mypy dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package/test_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/test_requirements.txt b/package/test_requirements.txt index dc2e73171a..25e7b40e96 100644 --- a/package/test_requirements.txt +++ b/package/test_requirements.txt @@ -10,7 +10,7 @@ boto3~=1.34 flake8~=7.0 isort~=5.11 matplotlib~=3.5 -mypy~=1.0 +mypy~=1.10 moto~=5.0.9 psutil==5.9.6 # same as Kedro for now pylint~=3.0 From dcfaede64c58c86d6fd27c6e608cc65d86f1c605 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:07:14 -0500 Subject: [PATCH 5/7] Update flake8 requirement from ~=7.0 to ~=7.1 in /package (#1989) Updates the requirements on [flake8](https://github.com/pycqa/flake8) to permit the latest version. - [Commits](https://github.com/pycqa/flake8/compare/7.0.0...7.1.0) --- updated-dependencies: - dependency-name: flake8 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ravi Kumar Pilla --- package/test_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/test_requirements.txt b/package/test_requirements.txt index 25e7b40e96..ada4a7bf96 100644 --- a/package/test_requirements.txt +++ b/package/test_requirements.txt @@ -7,7 +7,7 @@ bandit~=1.7 behave~=1.2 black~=23.3 boto3~=1.34 -flake8~=7.0 +flake8~=7.1 isort~=5.11 matplotlib~=3.5 mypy~=1.10 From 1dc7478679c0d17de56320f9781e5e9e7b995342 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 20:02:29 -0500 Subject: [PATCH 6/7] Update matplotlib requirement from ~=3.5 to ~=3.9 in /package (#1987) Updates the requirements on [matplotlib](https://github.com/matplotlib/matplotlib) to permit the latest version. - [Release notes](https://github.com/matplotlib/matplotlib/releases) - [Commits](https://github.com/matplotlib/matplotlib/compare/v3.5.0...v3.9.1) --- updated-dependencies: - dependency-name: matplotlib dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ravi Kumar Pilla --- package/test_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/test_requirements.txt b/package/test_requirements.txt index ada4a7bf96..0a7c5e4ed1 100644 --- a/package/test_requirements.txt +++ b/package/test_requirements.txt @@ -9,7 +9,7 @@ black~=23.3 boto3~=1.34 flake8~=7.1 isort~=5.11 -matplotlib~=3.5 +matplotlib~=3.9 mypy~=1.10 moto~=5.0.9 psutil==5.9.6 # same as Kedro for now From faceed96670c4d2a46ef3e80abbacd1cd0508a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Luis=20Cano=20Rodr=C3=ADguez?= Date: Thu, 18 Jul 2024 04:16:35 +0100 Subject: [PATCH 7/7] Fix packaging (#1766) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove direct invokations of setup.py Signed-off-by: Juan Luis Cano Rodríguez * Migrate to pyproject.toml Fix gh-1527 Co-authored-by: Mehdi Naderi Varandi Signed-off-by: Juan Luis Cano Rodríguez * Migrate to hatchling Signed-off-by: Juan Luis Cano Rodríguez * fix lint issue on main Signed-off-by: ravi-kumar-pilla * Move README to package/ directory Signed-off-by: Juan Luis Cano Rodríguez * adjust file permissions and circleci Signed-off-by: ravi-kumar-pilla * testing symlink Signed-off-by: ravi-kumar-pilla * adjust Readme file path Signed-off-by: ravi-kumar-pilla * fix docs Signed-off-by: ravi-kumar-pilla * update release note Signed-off-by: ravi-kumar-pilla * fix flaky e2e test --------- Signed-off-by: Juan Luis Cano Rodríguez Signed-off-by: ravi-kumar-pilla Co-authored-by: Mehdi Naderi Varandi Co-authored-by: ravi-kumar-pilla --- Makefile | 4 +- README.md | 294 +------------------------- RELEASE.md | 1 + cypress/tests/ui/flowchart/menu.cy.js | 2 +- package/README.md | 293 +++++++++++++++++++++++++ package/pyproject.toml | 74 +++++++ package/setup.cfg | 12 -- package/setup.py | 61 ------ 8 files changed, 372 insertions(+), 369 deletions(-) mode change 100644 => 120000 README.md create mode 100644 package/README.md create mode 100644 package/pyproject.toml delete mode 100644 package/setup.cfg delete mode 100644 package/setup.py diff --git a/Makefile b/Makefile index 270d5d9252..f8172e6be0 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,8 @@ package: find . -regex ".*/__pycache__" -exec rm -rf {} + find . -regex ".*\.egg-info" -exec rm -rf {} + test -f package/kedro_viz/html/index.html || (echo "Built npm package not found; packaging process cancelled."; exit 1) - cd package && python setup.py clean --all - cd package && python setup.py sdist bdist_wheel + cd package && rm -rf build/ dist/ + cd package && python -m build build: rm -rf build package/build package/dist package/kedro_viz/html pip-wheel-metadata package/kedro_viz.egg-info diff --git a/README.md b/README.md deleted file mode 100644 index 8b7158c12e..0000000000 --- a/README.md +++ /dev/null @@ -1,293 +0,0 @@ -# Kedro-Viz - -
-

- -![Kedro-Viz Pipeline Visualisation](https://raw.githubusercontent.com/kedro-org/kedro-viz/main/.github/img/banner.png) - -

- -

-✨ Data Science Pipelines. Beautifully Designed ✨ -
-Live Demo: https://demo.kedro.org/ -

- -
- -[![CircleCI](https://circleci.com/gh/kedro-org/kedro-viz/tree/main.svg?style=shield)](https://circleci.com/gh/kedro-org/kedro-viz/tree/main) -[![Documentation](https://readthedocs.org/projects/kedro/badge/?version=stable)](https://docs.kedro.org/en/stable/visualisation/) -[![Python Version](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11-orange.svg)](https://pypi.org/project/kedro-viz/) -[![PyPI version](https://img.shields.io/pypi/v/kedro-viz.svg?color=yellow)](https://pypi.org/project/kedro-viz/) -[![Downloads](https://static.pepy.tech/badge/kedro-viz/week)](https://pepy.tech/project/kedro-viz) -[![npm version](https://img.shields.io/npm/v/@quantumblack/kedro-viz.svg?color=cc3534)](https://badge.fury.io/js/%40quantumblack%2Fkedro-viz) -[![License](https://img.shields.io/badge/license-Apache%202.0-3da639.svg)](https://opensource.org/licenses/Apache-2.0) -[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) -[![Slack Organisation](https://img.shields.io/badge/slack-chat-blueviolet.svg?label=Kedro%20Slack&logo=slack)](https://slack.kedro.org) - -## Introduction - -Kedro-Viz is an interactive development tool for building data science pipelines with [Kedro](https://github.com/kedro-org/kedro). Kedro-Viz also allows users to view and compare different runs in the Kedro project. - -## Features - -- ✨ Complete visualisation of a Kedro project and its pipelines -- 🎨 Supports light & dark themes out of the box -- 🚀 Scales to big pipelines with hundreds of nodes -- 🔎 Highly interactive, filterable and searchable -- 🔬 Focus mode for modular pipeline visualisation -- 📊 Rich metadata side panel to display parameters, plots, etc. -- 📊 Supports all types of [Plotly charts](https://plotly.com/javascript/) -- ♻️ Autoreload on code change -- 🧪 Supports tracking and comparing runs in a Kedro project -- 🎩 Many more to come - -## Installation - -There are two ways you can use Kedro-Viz: - -- As a [Kedro plugin](https://docs.kedro.org/en/stable/extend_kedro/plugins.html) (the most common way). - - To install Kedro-Viz as a Kedro plugin: - - ```bash - pip install kedro-viz - ``` - -- As a standalone React component (for embedding Kedro-Viz in your web application). - - To install the standalone React component: - - ```bash - npm install @quantumblack/kedro-viz - ``` - -## Usage - -#### Compatibility with Kedro and Kedro-datasets - -Ensure your `Kedro`, `Kedro-Viz` and `Kedro-datasets` versions are supported by referencing the following table: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Python VersionLast Supported
KedroKedro-VizKedro-datasets
3.60.17.74.1.1-
3.70.18.146.7.01.8.0
3.8Latest7.1.01.8.0
>= 3.9LatestLatestLatest
​ - - -### CLI Usage - -To launch Kedro-Viz from the command line as a Kedro plugin, use the following command from the root folder of your Kedro project: - -```bash -kedro viz run -``` - -A browser tab opens automatically to serve the visualisation at `http://127.0.0.1:4141/`. - -Kedro-Viz also supports the following additional arguments on the command line: - -```bash -Usage: kedro viz run [OPTIONS] - - Visualise a Kedro pipeline using Kedro-Viz. - -Options: - --host TEXT Host that viz will listen to. Defaults to - localhost. - - --port INTEGER TCP port that viz will listen to. Defaults to - 4141. - - --browser / --no-browser Whether to open viz interface in the default - browser or not. Browser will only be opened if - host is localhost. Defaults to True. - - --load-file FILE Path to load Kedro-Viz data from a directory - --save-file FILE Path to save Kedro-Viz data to a directory - -p, --pipeline TEXT Name of the registered pipeline to visualise. If not - set, the default pipeline is visualised - - -e, --env TEXT Kedro configuration environment. If not specified, - catalog config in `local` will be used - - --autoreload Autoreload viz server when a Python or YAML file change in - the Kedro project - - --include-hooks A flag to include all registered hooks in your - Kedro Project - - --params TEXT Specify extra parameters that you want to pass to - the context initializer. Items must be separated - by comma, keys - by colon, example: - param1:value1,param2:value2. Each parameter is - split by the first comma, so parameter values are - allowed to contain colons, parameter keys are not. - To pass a nested dictionary as parameter, separate - keys by '.', example: param_group.param1:value1. - - -h, --help Show this message and exit. -``` - -To deploy Kedro-Viz from the command line as a Kedro plugin, use the following command from the root folder of your Kedro project: - -```bash -kedro viz deploy -``` - -```bash -Usage: kedro viz deploy [OPTIONS] - - Deploy and host Kedro Viz on AWS S3. - -Options: - --platform TEXT Supported Cloud Platforms like ('aws', 'azure', 'gcp') - to host Kedro Viz [required] - --endpoint TEXT Static Website hosted endpoint.(eg., For AWS - http://.s3-website..amazonaws.com/) - [required] - --bucket-name TEXT Bucket name where Kedro Viz will be hosted [required] - --include-hooks A flag to include all registered hooks in your Kedro - Project - --include-previews A flag to include preview for all the datasets - -h, --help Show this message and exit. -``` - -To create a build directory of your local Kedro-Viz instance with static data from the command line, use the following command from the root folder of your Kedro project: - -```bash -kedro viz build -``` - -```bash -Usage: kedro viz build [OPTIONS] - - Create build directory of local Kedro Viz instance with Kedro project data - -Options: - --include-hooks A flag to include all registered hooks in your Kedro - Project - --include-previews A flag to include preview for all the datasets - -h, --help Show this message and exit. -``` - -### Experiment Tracking usage - -To enable [experiment tracking](https://docs.kedro.org/en/stable/experiment_tracking/index.html) in Kedro-Viz, you need to add the Kedro-Viz `SQLiteStore` to your Kedro project. - -This can be done by adding the below code to `settings.py` in the `src` folder of your Kedro project. - -```python -from kedro_viz.integrations.kedro.sqlite_store import SQLiteStore -from pathlib import Path -SESSION_STORE_CLASS = SQLiteStore -SESSION_STORE_ARGS = {"path": str(Path(__file__).parents[2] / "data")} -``` - -Once the above set-up is complete, tracking datasets can be used to track relevant data for Kedro runs. More information on how to use tracking datasets can be found in the [experiment tracking documentation](https://docs.kedro.org/en/stable/experiment_tracking/index.html) - -**Notes:** - -- Experiment Tracking is only available for Kedro-Viz >= 4.0.2 and Kedro >= 0.17.5 -- Prior to Kedro 0.17.6, when using tracking datasets, you will have to explicitly mark the datasets as `versioned` for it to show up properly in Kedro-Viz experiment tracking tab. From Kedro >= 0.17.6, this is done automatically: - -```yaml -train_evaluation.r2_score_linear_regression: - type: tracking.MetricsDataset - filepath: ${base_location}/09_tracking/linear_score.json - versioned: true -``` - -### Standalone React component usage - -To use Kedro-Viz as a standalone React component, you can follow the example below. However, please note that Kedro-Viz does not support server-side rendering (SSR). If you're using Next.js or another SSR framework, you should be aware of this limitation. - -```javascript -import KedroViz from '@quantumblack/kedro-viz'; -import '@quantumblack/kedro-viz/lib/styles/styles.min.css'; - -const MyApp = () => ; -``` - -To use with NextJS: - -```javascript -import '@quantumblack/kedro-viz/lib/styles/styles.min.css'; -import dynamic from 'next/dynamic'; - -const NoSSRKedro = dynamic(() => import('@quantumblack/kedro-viz'), { - ssr: false, -}); - -const MyApp = () => ; -``` - -The JSON can be obtained by running: - -```bash -kedro viz run --save-file=filename -``` - -We also recommend wrapping the `Kedro-Viz` component with a parent HTML/JSX element that has a specified height (as seen in the above example) in order for Kedro-Viz to be styled properly. - -**_Our documentation contains [additional examples on how to visualise with Kedro-Viz.](https://docs.kedro.org/en/stable/visualisation/index.html)_** - -## Feature Flags - -Kedro-Viz uses features flags to roll out some experimental features. The following flags are currently in use: - -| Flag | Description | -| ------------------ | --------------------------------------------------------------------------------------- | -| sizewarning | From release v3.9.1. Show a warning before rendering very large graphs (default `true`) | -| expandAllPipelines | From release v4.3.2. Expand all modular pipelines on first load (default `false`) | - -To enable or disable a flag, click on the settings icon in the toolbar and toggle the flag on/off. - -Kedro-Viz also logs a message in your browser's [developer console](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools#The_JavaScript_console) to show the available flags and their values as currently set on your machine. - -## Maintainers - -Kedro-Viz is maintained by the [Kedro team](https://docs.kedro.org/en/stable/contribution/technical_steering_committee.html#kedro-maintainers) and a number of [contributors from across the world](https://github.com/kedro-org/Kedro-Viz/contributors). - -## Contribution - -If you want to contribute to Kedro-Viz, please check out our [contributing guide](./CONTRIBUTING.md). - -## License - -Kedro-Viz is licensed under the [Apache 2.0](https://github.com/kedro-org/kedro-viz/blob/main/LICENSE.md) License. - -## Citation - -If you're an academic, Kedro-Viz can also help you, for example, as a tool to visualise how your publication's pipeline is structured. Find our citation reference on [Zenodo](https://doi.org/10.5281/zenodo.4277218). diff --git a/README.md b/README.md new file mode 120000 index 0000000000..89d5ef5f22 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +package/README.md \ No newline at end of file diff --git a/RELEASE.md b/RELEASE.md index 1466cd07f8..5a9bdd072c 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -22,6 +22,7 @@ Please follow the established format: - Add "-p" flag to kedro-viz to match kedro run. (#1960) - Fix bug related to nested namespace pipelines. (#1897) - Migrate from `toposort` to `graphlib`. (#1942) +- Fix packaging. (#1766) - Adjust requirements file and dependabot versioning strategy. (#1978) # Release 9.1.0 diff --git a/cypress/tests/ui/flowchart/menu.cy.js b/cypress/tests/ui/flowchart/menu.cy.js index 276acd7ef3..dd7eb452c7 100644 --- a/cypress/tests/ui/flowchart/menu.cy.js +++ b/cypress/tests/ui/flowchart/menu.cy.js @@ -53,7 +53,7 @@ describe('Flowchart Menu', () => { it('verifies that users can search/filter for a flowchart component using the search box. #TC-17', () => { const searchInput = 'Ingestion'; - cy.get('.search-input__field').type(searchInput); + cy.get('.search-input__field').type(searchInput, { force: true }); // Pipeline Label in the Menu cy.get('.pipeline-nodelist__row__label') diff --git a/package/README.md b/package/README.md new file mode 100644 index 0000000000..8b7158c12e --- /dev/null +++ b/package/README.md @@ -0,0 +1,293 @@ +# Kedro-Viz + +
+

+ +![Kedro-Viz Pipeline Visualisation](https://raw.githubusercontent.com/kedro-org/kedro-viz/main/.github/img/banner.png) + +

+ +

+✨ Data Science Pipelines. Beautifully Designed ✨ +
+Live Demo: https://demo.kedro.org/ +

+ +
+ +[![CircleCI](https://circleci.com/gh/kedro-org/kedro-viz/tree/main.svg?style=shield)](https://circleci.com/gh/kedro-org/kedro-viz/tree/main) +[![Documentation](https://readthedocs.org/projects/kedro/badge/?version=stable)](https://docs.kedro.org/en/stable/visualisation/) +[![Python Version](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11-orange.svg)](https://pypi.org/project/kedro-viz/) +[![PyPI version](https://img.shields.io/pypi/v/kedro-viz.svg?color=yellow)](https://pypi.org/project/kedro-viz/) +[![Downloads](https://static.pepy.tech/badge/kedro-viz/week)](https://pepy.tech/project/kedro-viz) +[![npm version](https://img.shields.io/npm/v/@quantumblack/kedro-viz.svg?color=cc3534)](https://badge.fury.io/js/%40quantumblack%2Fkedro-viz) +[![License](https://img.shields.io/badge/license-Apache%202.0-3da639.svg)](https://opensource.org/licenses/Apache-2.0) +[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) +[![Slack Organisation](https://img.shields.io/badge/slack-chat-blueviolet.svg?label=Kedro%20Slack&logo=slack)](https://slack.kedro.org) + +## Introduction + +Kedro-Viz is an interactive development tool for building data science pipelines with [Kedro](https://github.com/kedro-org/kedro). Kedro-Viz also allows users to view and compare different runs in the Kedro project. + +## Features + +- ✨ Complete visualisation of a Kedro project and its pipelines +- 🎨 Supports light & dark themes out of the box +- 🚀 Scales to big pipelines with hundreds of nodes +- 🔎 Highly interactive, filterable and searchable +- 🔬 Focus mode for modular pipeline visualisation +- 📊 Rich metadata side panel to display parameters, plots, etc. +- 📊 Supports all types of [Plotly charts](https://plotly.com/javascript/) +- ♻️ Autoreload on code change +- 🧪 Supports tracking and comparing runs in a Kedro project +- 🎩 Many more to come + +## Installation + +There are two ways you can use Kedro-Viz: + +- As a [Kedro plugin](https://docs.kedro.org/en/stable/extend_kedro/plugins.html) (the most common way). + + To install Kedro-Viz as a Kedro plugin: + + ```bash + pip install kedro-viz + ``` + +- As a standalone React component (for embedding Kedro-Viz in your web application). + + To install the standalone React component: + + ```bash + npm install @quantumblack/kedro-viz + ``` + +## Usage + +#### Compatibility with Kedro and Kedro-datasets + +Ensure your `Kedro`, `Kedro-Viz` and `Kedro-datasets` versions are supported by referencing the following table: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Python VersionLast Supported
KedroKedro-VizKedro-datasets
3.60.17.74.1.1-
3.70.18.146.7.01.8.0
3.8Latest7.1.01.8.0
>= 3.9LatestLatestLatest
​ + + +### CLI Usage + +To launch Kedro-Viz from the command line as a Kedro plugin, use the following command from the root folder of your Kedro project: + +```bash +kedro viz run +``` + +A browser tab opens automatically to serve the visualisation at `http://127.0.0.1:4141/`. + +Kedro-Viz also supports the following additional arguments on the command line: + +```bash +Usage: kedro viz run [OPTIONS] + + Visualise a Kedro pipeline using Kedro-Viz. + +Options: + --host TEXT Host that viz will listen to. Defaults to + localhost. + + --port INTEGER TCP port that viz will listen to. Defaults to + 4141. + + --browser / --no-browser Whether to open viz interface in the default + browser or not. Browser will only be opened if + host is localhost. Defaults to True. + + --load-file FILE Path to load Kedro-Viz data from a directory + --save-file FILE Path to save Kedro-Viz data to a directory + -p, --pipeline TEXT Name of the registered pipeline to visualise. If not + set, the default pipeline is visualised + + -e, --env TEXT Kedro configuration environment. If not specified, + catalog config in `local` will be used + + --autoreload Autoreload viz server when a Python or YAML file change in + the Kedro project + + --include-hooks A flag to include all registered hooks in your + Kedro Project + + --params TEXT Specify extra parameters that you want to pass to + the context initializer. Items must be separated + by comma, keys - by colon, example: + param1:value1,param2:value2. Each parameter is + split by the first comma, so parameter values are + allowed to contain colons, parameter keys are not. + To pass a nested dictionary as parameter, separate + keys by '.', example: param_group.param1:value1. + + -h, --help Show this message and exit. +``` + +To deploy Kedro-Viz from the command line as a Kedro plugin, use the following command from the root folder of your Kedro project: + +```bash +kedro viz deploy +``` + +```bash +Usage: kedro viz deploy [OPTIONS] + + Deploy and host Kedro Viz on AWS S3. + +Options: + --platform TEXT Supported Cloud Platforms like ('aws', 'azure', 'gcp') + to host Kedro Viz [required] + --endpoint TEXT Static Website hosted endpoint.(eg., For AWS - http://.s3-website..amazonaws.com/) + [required] + --bucket-name TEXT Bucket name where Kedro Viz will be hosted [required] + --include-hooks A flag to include all registered hooks in your Kedro + Project + --include-previews A flag to include preview for all the datasets + -h, --help Show this message and exit. +``` + +To create a build directory of your local Kedro-Viz instance with static data from the command line, use the following command from the root folder of your Kedro project: + +```bash +kedro viz build +``` + +```bash +Usage: kedro viz build [OPTIONS] + + Create build directory of local Kedro Viz instance with Kedro project data + +Options: + --include-hooks A flag to include all registered hooks in your Kedro + Project + --include-previews A flag to include preview for all the datasets + -h, --help Show this message and exit. +``` + +### Experiment Tracking usage + +To enable [experiment tracking](https://docs.kedro.org/en/stable/experiment_tracking/index.html) in Kedro-Viz, you need to add the Kedro-Viz `SQLiteStore` to your Kedro project. + +This can be done by adding the below code to `settings.py` in the `src` folder of your Kedro project. + +```python +from kedro_viz.integrations.kedro.sqlite_store import SQLiteStore +from pathlib import Path +SESSION_STORE_CLASS = SQLiteStore +SESSION_STORE_ARGS = {"path": str(Path(__file__).parents[2] / "data")} +``` + +Once the above set-up is complete, tracking datasets can be used to track relevant data for Kedro runs. More information on how to use tracking datasets can be found in the [experiment tracking documentation](https://docs.kedro.org/en/stable/experiment_tracking/index.html) + +**Notes:** + +- Experiment Tracking is only available for Kedro-Viz >= 4.0.2 and Kedro >= 0.17.5 +- Prior to Kedro 0.17.6, when using tracking datasets, you will have to explicitly mark the datasets as `versioned` for it to show up properly in Kedro-Viz experiment tracking tab. From Kedro >= 0.17.6, this is done automatically: + +```yaml +train_evaluation.r2_score_linear_regression: + type: tracking.MetricsDataset + filepath: ${base_location}/09_tracking/linear_score.json + versioned: true +``` + +### Standalone React component usage + +To use Kedro-Viz as a standalone React component, you can follow the example below. However, please note that Kedro-Viz does not support server-side rendering (SSR). If you're using Next.js or another SSR framework, you should be aware of this limitation. + +```javascript +import KedroViz from '@quantumblack/kedro-viz'; +import '@quantumblack/kedro-viz/lib/styles/styles.min.css'; + +const MyApp = () => ; +``` + +To use with NextJS: + +```javascript +import '@quantumblack/kedro-viz/lib/styles/styles.min.css'; +import dynamic from 'next/dynamic'; + +const NoSSRKedro = dynamic(() => import('@quantumblack/kedro-viz'), { + ssr: false, +}); + +const MyApp = () => ; +``` + +The JSON can be obtained by running: + +```bash +kedro viz run --save-file=filename +``` + +We also recommend wrapping the `Kedro-Viz` component with a parent HTML/JSX element that has a specified height (as seen in the above example) in order for Kedro-Viz to be styled properly. + +**_Our documentation contains [additional examples on how to visualise with Kedro-Viz.](https://docs.kedro.org/en/stable/visualisation/index.html)_** + +## Feature Flags + +Kedro-Viz uses features flags to roll out some experimental features. The following flags are currently in use: + +| Flag | Description | +| ------------------ | --------------------------------------------------------------------------------------- | +| sizewarning | From release v3.9.1. Show a warning before rendering very large graphs (default `true`) | +| expandAllPipelines | From release v4.3.2. Expand all modular pipelines on first load (default `false`) | + +To enable or disable a flag, click on the settings icon in the toolbar and toggle the flag on/off. + +Kedro-Viz also logs a message in your browser's [developer console](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools#The_JavaScript_console) to show the available flags and their values as currently set on your machine. + +## Maintainers + +Kedro-Viz is maintained by the [Kedro team](https://docs.kedro.org/en/stable/contribution/technical_steering_committee.html#kedro-maintainers) and a number of [contributors from across the world](https://github.com/kedro-org/Kedro-Viz/contributors). + +## Contribution + +If you want to contribute to Kedro-Viz, please check out our [contributing guide](./CONTRIBUTING.md). + +## License + +Kedro-Viz is licensed under the [Apache 2.0](https://github.com/kedro-org/kedro-viz/blob/main/LICENSE.md) License. + +## Citation + +If you're an academic, Kedro-Viz can also help you, for example, as a tool to visualise how your publication's pipeline is structured. Find our citation reference on [Zenodo](https://doi.org/10.5281/zenodo.4277218). diff --git a/package/pyproject.toml b/package/pyproject.toml new file mode 100644 index 0000000000..1c4e4ca1f0 --- /dev/null +++ b/package/pyproject.toml @@ -0,0 +1,74 @@ +[build-system] +requires = ["hatchling", "hatch-requirements-txt"] +build-backend = "hatchling.build" + +[project] +name = "kedro-viz" +authors = [ + {name = "Kedro"} +] +description = "Kedro-Viz helps visualise Kedro data and analytics pipelines" +readme = {file = "README.md", content-type = "text/markdown"} +requires-python = ">=3.9" +keywords = [ + "pipelines", + "machine learning", + "data pipelines", + "data science", + "data engineering", + "visualisation", +] +license = {text = "Apache Software License (Apache 2.0)"} +dynamic = ["dependencies", "version"] + +[project.urls] +Homepage = "https://kedro.org" +Source = "https://github.com/kedro-org/kedro-viz" +Documentation = "https://docs.kedro.org/projects/kedro-viz" +Tracker = "https://github.com/kedro-org/kedro-viz/issues" + +[project.optional-dependencies] +docs = [ + "kedro-sphinx-theme==2024.4.0", +] +aws = ["s3fs>=2021.4"] +azure = ["adlfs>=2021.4"] +gcp = ["gcsfs>=2021.4"] + +[project.entry-points."kedro.global_commands"] +kedro-viz = "kedro_viz.launchers.cli:viz_cli" + +[project.entry-points."kedro.line_magic"] +line_magic = "kedro_viz.launchers.jupyter:run_viz" + +[project.entry-points."kedro.hooks"] +kedro-dataset-stats = "kedro_viz.integrations.kedro.hooks:dataset_stats_hook" + +[tool.hatch.version] +path = "kedro_viz/__init__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "requirements.txt", + "/kedro_viz", +] +exclude = [ + "/kedro_viz/docs", +] + +[tool.hatch.metadata.hooks.requirements_txt] +files = ["requirements.txt"] + +[tool.pytest.ini_options] +addopts =""" +--verbose -ra +--cov-report xml:coverage.xml +--cov-report term-missing +--cov kedro_viz +--ignore package/tests +--no-cov-on-fail +-ra +--asyncio-mode auto""" +testpaths = [ + "tests" +] diff --git a/package/setup.cfg b/package/setup.cfg deleted file mode 100644 index 41b22260f8..0000000000 --- a/package/setup.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[aliases] -test=pytest - -[tool:pytest] -addopts=--verbose -ra - --cov-report xml:coverage.xml - --cov-report term-missing - --cov kedro_viz - --ignore package/tests - --no-cov-on-fail - -ra - --asyncio-mode auto diff --git a/package/setup.py b/package/setup.py deleted file mode 100644 index e04cda700f..0000000000 --- a/package/setup.py +++ /dev/null @@ -1,61 +0,0 @@ -# type: ignore -import json -import os -from os import path - -from setuptools import find_packages, setup - -name = "kedro-viz" -here = path.abspath(path.dirname(__file__)) - - -jsbuild = [ - os.path.join(dirpath, f) - for dirpath, dirnames, files in os.walk("kedro_viz/html/") - for f in files -] - -files = map(lambda x: x.replace("kedro_viz/", "", 1), jsbuild) - -with open(path.join(here, path.pardir, "package.json")) as data: - obj = json.load(data) - version = obj["version"] - -with open("requirements.txt", "r", encoding="utf-8") as f: - requires = [x.strip() for x in f if x.strip()] - -with open(path.join(here, "../README.md"), encoding="utf-8") as f: - readme = f.read() - - -setup( - name=name, - version=version, - description="Kedro-Viz helps visualise Kedro data and analytics pipelines", - long_description=readme, - long_description_content_type="text/markdown", - license="Apache Software License (Apache 2.0)", - url="https://github.com/kedro-org/kedro-viz", - python_requires=">=3.9", - install_requires=requires, - keywords="pipelines, machine learning, data pipelines, data science, data engineering, visualisation", - author="Kedro", - packages=find_packages(exclude=["tests*", "features*"]), - package_data={"kedro_viz": list(files)}, - zip_safe=False, - entry_points={ - "kedro.global_commands": ["kedro-viz = kedro_viz.launchers.cli:viz_cli"], - "kedro.line_magic": ["line_magic = kedro_viz.launchers.jupyter:run_viz"], - "kedro.hooks": [ - "kedro-dataset-stats = kedro_viz.integrations.kedro.hooks:dataset_stats_hook" - ], - }, - extras_require={ - "docs": [ - "kedro-sphinx-theme==2024.4.0", - ], - "aws": ["s3fs>=2021.4"], - "azure": ["adlfs>=2021.4"], - "gcp": ["gcsfs>=2021.4"], - }, -)