Skip to content

Commit 2530b15

Browse files
author
sd109
committed
Split venv and web app steps for efficiency
1 parent f4935be commit 2530b15

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Tiltfile

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,25 @@ k8s_resource("chart-api", port_forwards="8081:8000")
2727
if run_ui_locally:
2828
venv_name = "tilt-dev-venv"
2929
requirements = "images/ui-base/requirements.txt"
30-
# Run gradio app locally with hot-reloading
30+
31+
# Ensure venv exists and matches requirements.txt
3132
local_resource(
32-
name="gradio-app",
33-
deps=requirements,
34-
serve_cmd="".join([
33+
name="gradio-app-venv",
34+
deps=[requirements],
35+
cmd="".join([
3536
"([[ -d {} ]] || python3 -m venv {})".format(venv_name, venv_name),
3637
"&& source {}/bin/activate".format(venv_name),
3738
"&& pip install -r {}".format(requirements),
38-
"&& cd chart/web-app",
39-
"&& gradio app.py --demo-name app"
39+
])
40+
)
41+
42+
# Run web app locally
43+
local_resource(
44+
name="gradio-app",
45+
deps=["chart/web-app/"],
46+
resource_deps=["gradio-app-venv"],
47+
serve_cmd="".join([
48+
"cd chart/web-app",
49+
"&& python app.py",
4050
])
4151
)

0 commit comments

Comments
 (0)