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

Setting up DevContainers to QA Kedro-Viz on Codespaces #2292

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ba250fb
First attempt at adding Dev Containers config
astrojuanlu Jan 30, 2025
f1aa0b1
Fix commands
astrojuanlu Jan 30, 2025
437a7a4
Fix whitespace
astrojuanlu Jan 30, 2025
edf5c17
WIP: Add NODE_VERSION (does not work)
astrojuanlu Jan 30, 2025
fae492b
Finish frontend
astrojuanlu Jan 30, 2025
26c2ec1
Fix Node version
astrojuanlu Feb 13, 2025
34170c2
Fix frontend command
astrojuanlu Feb 13, 2025
44e64f6
Improve disk performance
astrojuanlu Feb 13, 2025
f61b940
Do not start Babel
astrojuanlu Feb 13, 2025
d70cd25
Do not open browser twice
astrojuanlu Feb 13, 2025
58a18c5
Remove outdated comment
astrojuanlu Feb 13, 2025
abc263d
test-with-build
rashidakanchwala Mar 4, 2025
671df5f
Merge branch 'main' into dev-containers
rashidakanchwala Mar 4, 2025
39ccd4c
done
rashidakanchwala Mar 4, 2025
2c884a1
removed pyproject toml telemetry stuff
rashidakanchwala Mar 4, 2025
ddb9498
add make build earlier
rashidakanchwala Mar 4, 2025
b1013f8
add make build earlier
rashidakanchwala Mar 4, 2025
d185f01
test again
rashidakanchwala Mar 4, 2025
1175c3c
testing to see if changes get updated
rashidakanchwala Mar 4, 2025
ae05f6a
testing to see if changes get updated-2
rashidakanchwala Mar 4, 2025
33e4832
update label
rashidakanchwala Mar 4, 2025
60a5ce4
add contributing docs
rashidakanchwala Mar 7, 2025
851011a
update with screenshots
rashidakanchwala Mar 7, 2025
16c1097
Delete server.out
rashidakanchwala Mar 7, 2025
b723c93
Delete server.err
rashidakanchwala Mar 7, 2025
fb263c9
value shouldn't fail on error
rashidakanchwala Mar 7, 2025
95d3dd4
undo typo on primary toolbar
rashidakanchwala Mar 7, 2025
21f2e38
Merge branch 'main' into dev-containers
rashidakanchwala Mar 7, 2025
a2ccb9f
release notes
rashidakanchwala Mar 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "Kedro Viz Dev Container",
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",

"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "18",
"nodeGypDependencies": true
}
},

"forwardPorts": [8000],

"portsAttributes": {
"8000": {
"label": "Kedro Viz",
"onAutoForward": "openBrowser"
}
},

"containerEnv": {
"DISPLAY": "dummy",
"PYTHONUNBUFFERED": "True",
"UV_LINK_MODE": "copy",
"VIRTUAL_ENV": "/home/vscode/venv"
},

"mounts": [
{"source": "${localWorkspaceFolderBasename}-node_modules", "target": "${containerWorkspaceFolder}/node_modules", "type": "volume"},
{"source": "${localWorkspaceFolderBasename}-venv", "target": "${containerWorkspaceFolder}/.venv", "type": "volume"}
],

"onCreateCommand": "./.devcontainer/onCreateCommand.sh",

"postStartCommand": "nohup bash -c 'python -m http.server --directory demo-project/build 8000 &' > server.out 2> server.err < /dev/null",

"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
]
}
}
}
61 changes: 61 additions & 0 deletions .devcontainer/onCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#! /usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'

# Install system dependencies
sudo apt-get update && \
sudo apt-get install -y --no-install-recommends \
build-essential \
python3 \
make \
g++ \
libpixman-1-dev \
libcairo2-dev \
libjpeg-dev \
libgif-dev \
pkg-config \
libcairo2-dev \
libpango1.0-dev \
libpangocairo-1.0-0 && \
sudo apt-get clean && sudo rm -rf /var/lib/apt/lists/*

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Ensure the virtual environment path is set
export VIRTUAL_ENV="/home/vscode/venv" # Adjust this if needed
uv venv $VIRTUAL_ENV

# Activate virtual environment explicitly
source $VIRTUAL_ENV/bin/activate

# Install Python dependencies
uv pip install kedro
uv pip install -r package/test_requirements.txt -r demo-project/src/docker_requirements.txt

# Install Node.js dependencies
sudo chown vscode:vscode node_modules
npm install

# Build the frontend and pip install editable kedro-viz
make build
uv pip install -e package/

# Ensure Kedro is installed and available
if ! command -v kedro &> /dev/null
then
echo "Error: Kedro command not found. Exiting."
exit 1
fi

# Generate the Kedro-Viz static build inside demo-project
cd demo-project
source $VIRTUAL_ENV/bin/activate # Ensure virtual environment is active
kedro viz build

# Serve the generated files
cd build
python3 -m http.server 8000 &

echo "Setup complete! The website is available at http://localhost:8000"
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venv
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const FlowchartPrimaryToolbar = ({
className={'pipeline-menu-button--labels'}
dataTest={`sidebar-flowchart-labels-btn-${textLabels}`}
icon={LabelIcon}
labelText={`${textLabels ? 'Hide' : 'Show'} text labels`}
labelText={`${textLabels ? 'Hide' : 'Show'} text labelssss`}
Copy link
Contributor

Choose a reason for hiding this comment

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

Before we merge this, please revert to labels 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I have just kept it for ppl to review so we know there's a difference, shall remove before I merge

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Huongg , i will delete this after u approve.

onClick={() => onToggleTextLabels(!textLabels)}
visible={display.labelBtn}
/>
Expand Down