The Wayback Machine - https://web.archive.org/web/20260612125229/https://github.com/kedro-org/kedro-viz/pull/688
Skip to content

Update make run to make starting Python server easier#688

Merged
antonymilne merged 10 commits into
mainfrom
feature/update-make-run
Jan 12, 2022
Merged

Update make run to make starting Python server easier#688
antonymilne merged 10 commits into
mainfrom
feature/update-make-run

Conversation

@antonymilne

Copy link
Copy Markdown
Contributor

Description

I was just thinking about the development process and thought it would be simplified slightly if instead of needing to copy and paste the awkward

PYTHONPATH=$(pwd)/package python3 package/kedro_viz/server.py <path-to-your-test-project>/new-kedro-project

we could just run a make command. In fact, make run is already defined to do something like this, just it's a bit out of date. I've updated it so now the process of developing on the backend goes something like

npm start
make build
export PROJECT_PATH=<path-to-your-test-project>/new-kedro-project
make run
<modify Python files>
<kill existing kedro-viz process>
make run

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
@antonymilne antonymilne requested a review from yetudada as a code owner January 7, 2022 16:47
@antonymilne antonymilne self-assigned this Jan 7, 2022
Comment thread CONTRIBUTING.md Outdated
Comment thread package.json
"start:app": "PORT=4141 react-scripts start",
"start:css": "npm run build:css && node-sass src/ -o src/ --watch --recursive",
"start:lib": "rm -rf lib && babel src --out-dir lib --copy-files --watch",
"start:api": "python package/kedro_viz/server.py \"$npm_config_project_path\"",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This looked like it was trying to do something similar to make run but is missing the right PYTHONPATH. I couldn't see $npm_config_project_path defined anywhere so I figured this was obsolete and nobody used it now. But please say if I'm missing something here!!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes it was an earlier attempt to start everything under npm run start but don't think anyone is using it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I might keep it, just in case someone wants to use it, and actually make it usable?

"PYTHONPATH=$(pwd)/package python3 package/kedro_viz/server.py \"$npm_config_project_path\""

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought about this a bit more and decided to leave it out. Overall I think it's slightly less confusing to have one way of doing things rather than duplicated command, and I kind of like the logical npm/Makefile split (from the zen of Python, "There should be one-- and preferably only one --obvious way to do it."). 🙂

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fine for me.

Comment thread CONTRIBUTING.md

@limdauto limdauto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thank you

Comment thread package.json
"start:app": "PORT=4141 react-scripts start",
"start:css": "npm run build:css && node-sass src/ -o src/ --watch --recursive",
"start:lib": "rm -rf lib && babel src --out-dir lib --copy-files --watch",
"start:api": "python package/kedro_viz/server.py \"$npm_config_project_path\"",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes it was an earlier attempt to start everything under npm run start but don't think anyone is using it.

@tynandebold tynandebold left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice one, thanks for this.

As we talked about last week, I might also keep the NPM script, but your call!

Comment thread package.json
"start:app": "PORT=4141 react-scripts start",
"start:css": "npm run build:css && node-sass src/ -o src/ --watch --recursive",
"start:lib": "rm -rf lib && babel src --out-dir lib --copy-files --watch",
"start:api": "python package/kedro_viz/server.py \"$npm_config_project_path\"",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I might keep it, just in case someone wants to use it, and actually make it usable?

"PYTHONPATH=$(pwd)/package python3 package/kedro_viz/server.py \"$npm_config_project_path\""
@antonymilne antonymilne merged commit 43b6e8a into main Jan 12, 2022
@antonymilne antonymilne deleted the feature/update-make-run branch January 12, 2022 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants