From 15196672f4a04417292a41edfd49cf364ca858de Mon Sep 17 00:00:00 2001 From: Keming Date: Sat, 1 Feb 2025 23:52:26 +0800 Subject: [PATCH] feat: update examples to v1 syntax (#1965) Signed-off-by: Keming --- examples/conda/build.envd | 4 +++- examples/custom-image/build.envd | 2 +- examples/dgl/build.envd | 12 ++++++++---- examples/download_files/build.envd | 4 +++- examples/dpgen2/build.envd | 4 +++- examples/ianvs/build.envd | 4 +++- examples/include_pkg/build.envd | 4 +++- examples/julia-basic/build.envd | 3 ++- examples/llm-inference/build.envd | 2 -- examples/mnist/build.envd | 4 +++- examples/python-basic/build.envd | 4 +++- examples/pytorch-profiler/build.envd | 4 +++- examples/pytorch2/build.envd | 2 +- examples/r-basic/build.envd | 3 ++- examples/stable-diffusion/build.envd | 4 +++- examples/streamlit-hello/build.envd | 4 +++- examples/streamlit-mnist/build.envd | 7 +++++-- 17 files changed, 49 insertions(+), 22 deletions(-) diff --git a/examples/conda/build.envd b/examples/conda/build.envd index 7d04d49b2..39adebd10 100644 --- a/examples/conda/build.envd +++ b/examples/conda/build.envd @@ -27,6 +27,8 @@ custom_channels: ], channel=["pytorch"], ) - base(os="ubuntu22.04", language="python3.8") + base(dev=True) + install.conda() + install.python() install.python_packages(name=["flask"]) install.cuda(version="11.2.2", cudnn="8") diff --git a/examples/custom-image/build.envd b/examples/custom-image/build.envd index 100576bc6..b233d2e8c 100644 --- a/examples/custom-image/build.envd +++ b/examples/custom-image/build.envd @@ -1,5 +1,5 @@ def build(): - base(language="python", image="python:3.11-slim") + base(image="python:3.11-slim", dev=True) install.python_packages( name=[ "via", diff --git a/examples/dgl/build.envd b/examples/dgl/build.envd index 7fb078195..8e1f08e8a 100644 --- a/examples/dgl/build.envd +++ b/examples/dgl/build.envd @@ -1,6 +1,8 @@ def build(): - # Use ubuntu22.04 as base image and install python - base(os="ubuntu22.04", language="python3") + # Use ubuntu:22.04 as base image and install python + base(image="ubuntu:22.04", dev=True) + install.conda() + install.python() # Add the packages you are using here install.python_packages(["numpy", "dgl", "torch"]) @@ -13,8 +15,10 @@ def build(): def build_gpu(): - # Use ubuntu22.04 as base image and install python - base(os="ubuntu22.04", language="python3") + # Use ubuntu:22.04 as base image and install python + base(dev=True) + install.conda() + install.python() # install cuda install.cuda(version="11.2.2", cudnn="8") diff --git a/examples/download_files/build.envd b/examples/download_files/build.envd index 8152e9f7f..2777ed669 100644 --- a/examples/download_files/build.envd +++ b/examples/download_files/build.envd @@ -1,5 +1,7 @@ def build(): - base(os="ubuntu22.04", language="python") + base(dev=True) + install.conda() + install.python() io.http( url="https://github.com/tensorchord/envd/releases/download/v0.2.0-alpha.18/envd-ssh_0.2.0-alpha.18_Linux_x86_64", checksum="sha256:163fa5d9775a3666ec91e2422a794277cc8575147f15767d364cc40157888cfb", diff --git a/examples/dpgen2/build.envd b/examples/dpgen2/build.envd index 89229c777..f32f1683a 100644 --- a/examples/dpgen2/build.envd +++ b/examples/dpgen2/build.envd @@ -23,7 +23,9 @@ def install_kubectl_kind(env_name): def build(): - base(os="ubuntu22.04", language="python3.11") + base(dev=True) + install.conda() + install.python() install.python_packages( name=[ "pydflow", diff --git a/examples/ianvs/build.envd b/examples/ianvs/build.envd index 4da057f5b..22a291daf 100644 --- a/examples/ianvs/build.envd +++ b/examples/ianvs/build.envd @@ -1,5 +1,7 @@ def build(): - base(os="ubuntu22.04", language="python3.6") + base(dev=True) + install.conda() + install.python() shell("zsh") install.apt_packages(name=["git", "libgl1-mesa-glx", "zip"]) run( diff --git a/examples/include_pkg/build.envd b/examples/include_pkg/build.envd index 9ffbf34bb..f0e2e112a 100644 --- a/examples/include_pkg/build.envd +++ b/examples/include_pkg/build.envd @@ -2,5 +2,7 @@ envdlib = include("https://github.com/tensorchord/envdlib") def build(): - base(os="ubuntu22.04", language="python") + base(dev=True) + install.conda() + install.python() envdlib.tensorboard(8888) diff --git a/examples/julia-basic/build.envd b/examples/julia-basic/build.envd index a6cefa217..bd62d2afe 100644 --- a/examples/julia-basic/build.envd +++ b/examples/julia-basic/build.envd @@ -1,5 +1,6 @@ def build(): - base(os="ubuntu22.04", language="julia") + base(dev=True) + install.julia() # config.julia_pkg_server(url="https://mirrors.tuna.tsinghua.edu.cn/julia") install.julia_packages(["Example"]) shell("zsh") diff --git a/examples/llm-inference/build.envd b/examples/llm-inference/build.envd index 3a2c061b1..e4dfc342e 100644 --- a/examples/llm-inference/build.envd +++ b/examples/llm-inference/build.envd @@ -1,6 +1,4 @@ -# syntax=v1 def build(): - # base(os="ubuntu22.04", language="python3") base(dev=True) install.conda() install.python() diff --git a/examples/mnist/build.envd b/examples/mnist/build.envd index 2f1d57c7d..571e5d6ea 100644 --- a/examples/mnist/build.envd +++ b/examples/mnist/build.envd @@ -1,5 +1,7 @@ def base_env(): - base(os="ubuntu22.04", language="python3") + base(dev=True) + install.conda() + install.python() install.vscode_extensions( [ "ms-python.python", diff --git a/examples/python-basic/build.envd b/examples/python-basic/build.envd index 0ae4b8423..94705c65f 100644 --- a/examples/python-basic/build.envd +++ b/examples/python-basic/build.envd @@ -1,5 +1,7 @@ def build(): - base(os="ubuntu22.04", language="python") + base(dev=True) + install.conda() + install.python() # config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple") install.python_packages( [ diff --git a/examples/pytorch-profiler/build.envd b/examples/pytorch-profiler/build.envd index 88ecca157..5d55d3bbe 100644 --- a/examples/pytorch-profiler/build.envd +++ b/examples/pytorch-profiler/build.envd @@ -2,7 +2,9 @@ envdlib = include("https://github.com/tensorchord/envdlib") def build(): - base(os="ubuntu22.04", language="python3") + base(dev=True) + install.conda() + install.python() shell("zsh") install.cuda(version="11.2.2", cudnn="8") install.python_packages( diff --git a/examples/pytorch2/build.envd b/examples/pytorch2/build.envd index 0aeb0f570..7a4965a0e 100644 --- a/examples/pytorch2/build.envd +++ b/examples/pytorch2/build.envd @@ -2,7 +2,7 @@ envdlib = include("https://github.com/tensorchord/envdlib") def build(): - base(language="python3", image="ghcr.io/pytorch/pytorch-nightly:latest") + base(image="ghcr.io/pytorch/pytorch-nightly:latest", dev=True) shell("zsh") install.python_packages( diff --git a/examples/r-basic/build.envd b/examples/r-basic/build.envd index 522036819..3f84fb662 100644 --- a/examples/r-basic/build.envd +++ b/examples/r-basic/build.envd @@ -1,5 +1,6 @@ def build(): - base(os="ubuntu22.04", language="r") + base(dev=True) + install.r_lang() install.r_packages( [ "remotes", diff --git a/examples/stable-diffusion/build.envd b/examples/stable-diffusion/build.envd index a5313431b..dd9b7db8a 100644 --- a/examples/stable-diffusion/build.envd +++ b/examples/stable-diffusion/build.envd @@ -1,5 +1,7 @@ def build(): - base(os="ubuntu22.04", language="python") + base(dev=True) + install.conda() + install.python() # config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple") install.python_packages( [ diff --git a/examples/streamlit-hello/build.envd b/examples/streamlit-hello/build.envd index b473aecd9..62b077c5f 100644 --- a/examples/streamlit-hello/build.envd +++ b/examples/streamlit-hello/build.envd @@ -1,5 +1,7 @@ def build(): - base(os="ubuntu22.04", language="python") + base(dev=True) + install.conda() + install.python() configure_streamlit(8501) diff --git a/examples/streamlit-mnist/build.envd b/examples/streamlit-mnist/build.envd index e6624e344..2bcdc0cb7 100644 --- a/examples/streamlit-mnist/build.envd +++ b/examples/streamlit-mnist/build.envd @@ -1,5 +1,7 @@ def build(): - base(os="ubuntu22.04", language="python3") + base(dev=True) + install.conda() + install.python() install.vscode_extensions( [ "ms-python.python", @@ -14,7 +16,8 @@ def build(): def serve(): - base(os="ubuntu22.04", language="python3") + base(dev=False) + install.python() configure_streamlit(8501) configure_mnist()