Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve kedro viz build usage documentation #2126

Merged
merged 5 commits into from
Oct 10, 2024
Merged

Improve kedro viz build usage documentation #2126

merged 5 commits into from
Oct 10, 2024

Conversation

jitu5
Copy link
Contributor

@jitu5 jitu5 commented Oct 7, 2024

Description

Resolves #1918

This PR adds additional documentation to clarify why kedro-viz cannot be run directly from a local filesystem (file:// protocol) without encountering specific issues. The intention is to provide more context to users who may try to use the file protocol and run into these issues.

Context

Currently, attempting to run kedro-viz by simply opening index.html through the file:// protocol causes CORS issues. Most modern browsers enforce strict CORS policies for local files to prevent security vulnerabilities.

The file protocol (file://) is treated differently compared to other network requests. Requests to resources from a local file context (e.g., scripts, APIs) are treated as cross-origin requests by the browser, which results in CORS errors when trying to access JavaScript assets or other dynamic resources required by kedro-viz.

Therefore, the recommendation for a proper user experience is to run kedro-viz using a local web server, which avoids CORS policy issues and guarantees that all resources are correctly served and accessed. Examples of lightweight static servers include Python's http.server or Node.js http-server, which can easily serve the generated HTML.

This PR proposes updated documentation to explain why users need to run Kedro-Viz through a server, helping prevent confusion.

Checklist

  • Read the contributing guidelines
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added new entries to the RELEASE.md file
  • Added tests to cover my changes

Signed-off-by: Jitendra Gundaniya <[email protected]>
Signed-off-by: Jitendra Gundaniya <[email protected]>
@rashidakanchwala
Copy link
Contributor

Quick question here - can we enable kedro-viz to run on a simple python using kedro viz cli locally ... maybe we could kedro viz

@jitu5
Copy link
Contributor Author

jitu5 commented Oct 7, 2024

Quick question here - can we enable kedro-viz to run on a simple python using kedro viz cli locally ... maybe we could kedro viz

@rashidakanchwala If I understood correctly, then It will become kedro viz run ?

@jitu5 jitu5 marked this pull request as ready for review October 8, 2024 09:39
@rashidakanchwala
Copy link
Contributor

Sorry, I didn't read your PR properly. I meat running python m http.server under the hood, and some CLI command that executes it but I think this is good for now :)

Copy link
Contributor

@rashidakanchwala rashidakanchwala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for this!

jitu5 and others added 2 commits October 10, 2024 09:59
Co-authored-by: rashidakanchwala <[email protected]>
Signed-off-by: Jitendra Gundaniya <[email protected]>
Copy link
Member

@astrojuanlu astrojuanlu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @jitu5 ! Maybe I'd remove the "using a local server" sub-heading and rearrange the information like

"""
When you generate the build folder using the command kedro viz build, it creates a build directory with an index.html file, which serves as the entry point for visualizing your pipeline.

To view your pipeline visualization, you need to serve index.html using an HTTP server. Here are a few simple ways to do this:

(explain two different ways)

::: warning
simply opening index.html using the file:// protocol is not supported due to Cross-Origin Resource Sharing (CORS) policies in modern browsers.
:::
"""

Signed-off-by: Jitendra Gundaniya <[email protected]>
Copy link
Member

@astrojuanlu astrojuanlu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jitu5 jitu5 merged commit 69caab4 into main Oct 10, 2024
10 checks passed
@jitu5 jitu5 deleted the doc/build-folder branch October 10, 2024 10:48
@jitu5 jitu5 mentioned this pull request Nov 20, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to open Kedro viz build folder locally?
3 participants