diff --git a/docs-zh/blog/2022.md b/docs-zh/blog/2022.md index 40ebad2..f750032 100644 --- a/docs-zh/blog/2022.md +++ b/docs-zh/blog/2022.md @@ -35,7 +35,9 @@ introduction: 'Ce Gao 是 envd 的维护者之一。与此之外,他还是机 ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() # Configure the pip index if needed. # config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple") install.python_packages(name = [ diff --git a/docs-zh/blog/envd.md b/docs-zh/blog/envd.md index 5efb3a6..eedcef2 100644 --- a/docs-zh/blog/envd.md +++ b/docs-zh/blog/envd.md @@ -20,7 +20,9 @@ introduction: 'Ce Gao 是 envd 的维护者之一。与此之外,他还是机 ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() install.cuda(version="11.2.2", cudnn="8") install.python_packages(name=[ "tensorflow-gpu" @@ -76,7 +78,9 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.vscode_extensions([ "ms-python.python", ]) @@ -144,7 +148,9 @@ envd 不只是面向个人使用者设计的,它更是要解决算法团队在 envdlib = include("https://github.com/tensorchord/envdlib") def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() envdlib.tensorboard(8888) ``` diff --git a/docs-zh/blog/stable-diffusion-cpu.md b/docs-zh/blog/stable-diffusion-cpu.md index 174d212..a787fa2 100644 --- a/docs-zh/blog/stable-diffusion-cpu.md +++ b/docs-zh/blog/stable-diffusion-cpu.md @@ -43,7 +43,9 @@ touch build.envd ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() #config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple") install.python_packages([ "torch", diff --git a/docs-zh/envs/monitoring.md b/docs-zh/envs/monitoring.md index 1c71772..f9dc40d 100644 --- a/docs-zh/envs/monitoring.md +++ b/docs-zh/envs/monitoring.md @@ -16,7 +16,9 @@ def tensorboard(port): def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() install.python_packages(name=["tensorboard"]) tensorboard(8888) ``` diff --git a/docs-zh/envs/multitarget.md b/docs-zh/envs/multitarget.md index b2ef495..1fd5889 100644 --- a/docs-zh/envs/multitarget.md +++ b/docs-zh/envs/multitarget.md @@ -27,7 +27,9 @@ def serve(): ```py def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.vscode_extensions([ "ms-python.python", ]) @@ -39,7 +41,9 @@ def build(): shell("zsh") def serve(): - base(os="ubuntu20.04", language="python3") + base(dev=False) + install.conda() + install.python() configure_streamlit(8501) configure_mnist() diff --git a/docs-zh/faq/why.md b/docs-zh/faq/why.md index 9bd9c9e..9ab01f9 100644 --- a/docs-zh/faq/why.md +++ b/docs-zh/faq/why.md @@ -116,7 +116,9 @@ ENTRYPOINT ["tini", "--", "bash", "init.bash"] ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.vscode_extensions([ "ms-python.python", ]) diff --git a/docs-zh/guide/build-envd.md b/docs-zh/guide/build-envd.md index e1756c1..ffbef66 100644 --- a/docs-zh/guide/build-envd.md +++ b/docs-zh/guide/build-envd.md @@ -37,7 +37,9 @@ $ envd build --path examples/mnist ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "numpy", ]) @@ -57,7 +59,9 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() ``` @@ -76,7 +80,7 @@ $ envd up => => exporting manifest sha256:7ef2e8571485ce51d966b4cf5fe83232520f 0.0s => => exporting config sha256:abec960de30fce69dc19126577c7aaae3f9b62 0.0s => => sending tarball 0.4s -envd@588f26349c61 $ +⬢ [envd]❯ ``` @@ -84,9 +88,9 @@ envd@588f26349c61 $ 3. 重新进入您的环境,如果您退出了当前 `shell`,使用 `ssh .envd` 命令将重新进入环境。 ```bash -envd@588f26349c61 $ exit +⬢ [envd]❯ exit $ ssh demo.envd -envd@588f26349c61 $ # 欢迎回来! +⬢ [envd]❯ # 欢迎回来! ``` 4. 删除环境,如果您不再使用它,请不要忘记使用 `envd destroy` 命令来删除环境。使用 `-p` 参数指定要删除的环境的路径。 @@ -108,7 +112,9 @@ INFO[2022-06-10T19:09:49+08:00] is destroyed ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() ``` @@ -131,7 +137,9 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "numpy", ]) @@ -153,9 +161,8 @@ def build(): ``` $ envd up -envd@2c14bff847f8:$ python3 -Python 3.8.10 (default, Mar 15 2022, 12:22:08) -[GCC 9.4.0] on linux +⬢ [envd]❯ python3 +Python 3.11.11 (main, Dec 11 2024, 16:28:39) [GCC 11.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numpy as np >>> a = np.array([2, 3, 4]) @@ -171,7 +178,9 @@ array([2, 3, 4]) ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "numpy", ]) @@ -195,7 +204,9 @@ Jupyter Notebook 是使用 Python 进行数据分析的互动计算环境。`env ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "numpy", ]) @@ -225,7 +236,9 @@ envd-quick-start http://localhost:48484 envd-quick-start.envd /home/g ```python def build(): config.pip_index(url="https://pypi.tuna.tsinghua.edu.cn/simple") - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "numpy", ]) @@ -256,7 +269,9 @@ deb https://mirror.sjtu.edu.cn/ubuntu focal-security main restricted universe mu install.vscode_extensions([ "ms-python.python", ]) - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "numpy", ]) diff --git a/docs-zh/guide/concepts.md b/docs-zh/guide/concepts.md index 20adf00..5012986 100644 --- a/docs-zh/guide/concepts.md +++ b/docs-zh/guide/concepts.md @@ -39,6 +39,9 @@ def build(): # build.envd # 默认调用 `build` 函数。 def build(): + base(dev=True) + install.conda() + install.python() version = "2.9.1" dev_env(version, "zsh") diff --git a/docs-zh/guide/getting-started.md b/docs-zh/guide/getting-started.md index 8a0286d..b550103 100644 --- a/docs-zh/guide/getting-started.md +++ b/docs-zh/guide/getting-started.md @@ -26,7 +26,9 @@ envd(`ɪnˈvdɪ`)是一个命令行工具,可以帮助你为 AI/ML 创建 envdlib = include("https://github.com/tensorchord/envdlib") def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() envdlib.tensorboard(8888) ``` @@ -92,7 +94,12 @@ def tensorboard(envd_port=6006, envd_dir="/home/envd/logs", ```bash [pip] # envd 也可以用 pip 来安装。 -pip3 install --upgrade envd +pip install --upgrade envd +``` + +```bash [uv] +# if you are using `uv` +uv tool install envd ``` ```bash [Homebrew] @@ -135,7 +142,7 @@ envd bootstrap --dockerhub-mirror https://docker.mirrors.sjtug.sjtu.edu.cn 先克隆仓库[`envd-quick-start`](https://github.com/tensorchord/envd-quick-start): -``` +```bash git clone https://github.com/tensorchord/envd-quick-start.git ``` @@ -144,13 +151,15 @@ git clone https://github.com/tensorchord/envd-quick-start.git ```python title=build.envd def build(): config.repo(url="https://github.com/tensorchord/envd", description="envd quick start example") - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() # Configure pip index if needed. # config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple") install.python_packages(name = [ "numpy", ]) - shell("zsh") + shell("fish") ``` :::tip @@ -159,35 +168,40 @@ def build(): 然后可以运行下面的命令来建立一个新的环境: -``` +```bash cd envd-quick-start && envd up ``` -``` +```bash $ cd envd-quick-start && envd up -[+] ⌚ parse build.envd and download/cache dependencies 2.8s ✅ (finished) - => download oh-my-zsh 2.8s -[+] 🐋 build envd environment 18.3s (25/25) ✅ (finished) - => create apt source dir 0.0s - => local://cache-dir 0.1s - => => transferring cache-dir: 5.12MB 0.1s -... - => pip install numpy 13.0s - => copy /oh-my-zsh /home/envd/.oh-my-zsh 0.1s - => mkfile /home/envd/install.sh 0.0s - => install oh-my-zsh 0.1s - => mkfile /home/envd/.zshrc 0.0s - => install shell 0.0s - => install PyPI packages 0.0s - => merging all components into one 0.3s - => => merging 0.3s - => mkfile /home/envd/.gitconfig 0.0s - => exporting to oci image format 2.4s - => => exporting layers 2.0s - => => exporting manifest sha256:7dbe9494d2a7a39af16d514b997a5a8f08b637f 0.0s - => => exporting config sha256:1da06b907d53cf8a7312c138c3221e590dedc2717 0.0s - => => sending tarball 0.4s -envd-quick-start via Py v3.9.13 via 🅒 envd +[+] ⌚ parse build.envd and download/cache dependencies 6.2s ✅ (finished) +[+] build envd environment 19.0s (47/47) FINISHED + => CACHED [internal] setting pip cache mount permissions 0.0s + => docker-image://docker.io/tensorchord/envd-sshd-from-scratch:v0.4.3 2.3s + => => resolve docker.io/tensorchord/envd-sshd-from-scratch:v0.4.3 2.3s + => docker-image://docker.io/library/ubuntu:22.04 0.0s +...... + => [internal] pip install numpy 2.5s + => CACHED [internal] download fish shell 0.0s + => [internal] configure user permissions for /opt/conda 1.0s + => [internal] create dir for ssh key 0.5s + => [internal] install ssh keys 0.2s + => [internal] copy fish shell from the builder image 0.2s + => [internal] install fish shell 0.5s +...... + => [internal] create work dir: /home/envd/envd-quick-start 0.2s + => exporting to image 7.7s + => => exporting layers 7.7s + => => writing image sha256:464a0c12759d3d1732404f217d5c6e06d0ee4890cccd66391a608daf2bd314e4 0.0s + => => naming to docker.io/library/envd-quick-start:dev 0.0s +------ + > importing cache manifest from docker.io/tensorchord/python-cache:envd-v0.4.3: +------ +⣽ [5/5] attach the environment [2s] +Welcome to fish, the friendly interactive shell +Type help for instructions on how to use fish + +envd-quick-start on git master [!] via Py v3.11.11 via 🅒 envd as sudo ⬢ [envd]❯ # You are in the container-based environment! ``` @@ -198,7 +212,9 @@ envd-quick-start via Py v3.9.13 via 🅒 envd ```python title=build.envd def build(): config.repo(url="https://github.com/tensorchord/envd", description="envd quick start example") - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() # Configure pip index if needed. # config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple") install.python_packages(name = [ diff --git a/docs-zh/guide/modularize.md b/docs-zh/guide/modularize.md index fad57f5..0953e94 100644 --- a/docs-zh/guide/modularize.md +++ b/docs-zh/guide/modularize.md @@ -34,7 +34,9 @@ envdlib = include("https://github.com/tensorchord/envdlib") # use it in your build function def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() envdlib.tensorboard(host_port=8888) ``` diff --git a/docs-zh/guide/v1.md b/docs-zh/guide/v1.md index 50724bf..40a8e45 100644 --- a/docs-zh/guide/v1.md +++ b/docs-zh/guide/v1.md @@ -12,13 +12,19 @@ These improvements make envd v1 a powerful tool for streamlining development wor ## Syntax changes -To use the v1, all you need is to declare the version in the first line of the `build.envd` file. +::: tip + +Start from `envd v1.0`, `envd` will use v1 syntax by default, no need to declare the version in the `build.envd` file. + +::: + +To use the v1 for `envd @@ -23,7 +24,8 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="julia") + base(dev=True) + install.julia() install.julia_packages(name = [ "Example", ]) @@ -38,7 +40,8 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="julia") + base(dev=True) + install.julia() config.julia_pkg_server(url="https://mirrors.tuna.tsinghua.edu.cn/julia") install.julia_packages(name = [ "Example", @@ -55,7 +58,8 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="julia") + base(dev=True) + install.julia() shell("zsh") ``` @@ -70,7 +74,8 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="julia") + base(dev=True) + install.julia() install.vscode_extensions(["julialang.language-julia"]) ``` diff --git a/docs-zh/lang/python.md b/docs-zh/lang/python.md index 035ca36..1b5581f 100644 --- a/docs-zh/lang/python.md +++ b/docs-zh/lang/python.md @@ -13,18 +13,22 @@ ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() ``` -`envd` 中 Python 的默认版本是 3.9(最新的修订号可以参考[这里](https://anaconda.org/anaconda/python/files))。如果你需要使用特定版本,只需要用类似 `pythonX.Y.Z` 的字符串来填充 `language` 项: +`envd` 中 Python 的默认版本是 3.9(最新的修订号可以参考[这里](https://anaconda.org/anaconda/python/files))。如果你需要使用特定版本,只需要用类似 `X.Y.Z` 的字符串来填充 `version` 项: ```python def build(): - base(os="ubuntu20.04", language="python3.11") + base(dev=True) + install.conda() + install.python(version="3.12") ``` @@ -41,7 +45,9 @@ Python2 不被 `envd` 所支持。 ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() install.conda_packages(name = [ "numpy", "scipy", @@ -57,7 +63,9 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "scikit-learn", "matplotlib", @@ -74,7 +82,9 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() install.conda_packages(name = [ "numpy", "scipy", @@ -97,7 +107,9 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() shell("zsh") ``` @@ -110,7 +122,9 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() install.vscode_extensions(["ms-python.python"]) ``` @@ -125,7 +139,9 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() # Use `config.jupyter()` # if you do not need to set up password. config.jupyter(token="password") diff --git a/docs-zh/lang/r.md b/docs-zh/lang/r.md index df15a25..d74cf0f 100644 --- a/docs-zh/lang/r.md +++ b/docs-zh/lang/r.md @@ -10,7 +10,8 @@ ```python def build(): - base(os="ubuntu20.04", language="r") + base(dev=True) + install.r_lang() ``` @@ -23,7 +24,8 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="r") + base(dev=True) + install.r_lang() install.r_packages([ "remotes", "rlang", @@ -39,7 +41,8 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="r") + base(dev=True) + install.r_lang() config.cran_mirror(url="https://cloud.r-project.org/") install.r_packages([ "remotes", @@ -56,7 +59,8 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="r") + base(dev=True) + install.r_lang() shell("zsh") ``` @@ -70,7 +74,8 @@ def build(): ```python def build(): - base(os="ubuntu20.04", language="r") + base(dev=True) + install.r_lang() install.vscode_extensions(["REditorSupport.r-lsp"]) ``` diff --git a/docs-zh/tips/multitarget.md b/docs-zh/tips/multitarget.md index 8f8ee77..9ba6469 100644 --- a/docs-zh/tips/multitarget.md +++ b/docs-zh/tips/multitarget.md @@ -16,7 +16,9 @@ For example, you can declare multiple functions in one `envd` file, following py ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.vscode_extensions([ "ms-python.python", ]) diff --git a/docs/blog/2022.md b/docs/blog/2022.md index aa0ff27..f44514c 100644 --- a/docs/blog/2022.md +++ b/docs/blog/2022.md @@ -30,7 +30,9 @@ With `envd`, your development process can be more efficient. It enables you to c ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() # Configure the pip index if needed. # config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple") install.python_packages(name = [ diff --git a/docs/blog/envd-on-remote-serve.md b/docs/blog/envd-on-remote-serve.md index 29d8a45..dc74281 100644 --- a/docs/blog/envd-on-remote-serve.md +++ b/docs/blog/envd-on-remote-serve.md @@ -56,7 +56,9 @@ Verify the installation: Here is a example for you: ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "numpy", ]) diff --git a/docs/blog/ml-env.md b/docs/blog/ml-env.md index 1025a6a..1dcf903 100644 --- a/docs/blog/ml-env.md +++ b/docs/blog/ml-env.md @@ -49,7 +49,9 @@ The syntax looks like this: ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() install.cuda(version="11.2.2", cudnn="8") install.python_packages(name=[ "torch" diff --git a/docs/envs/monitoring.md b/docs/envs/monitoring.md index d4325a2..bc578e7 100644 --- a/docs/envs/monitoring.md +++ b/docs/envs/monitoring.md @@ -14,7 +14,9 @@ def tensorboard(port): def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() install.python_packages(name=["tensorboard"]) tensorboard(8888) ``` diff --git a/docs/envs/multitarget.md b/docs/envs/multitarget.md index 91388e6..612a238 100644 --- a/docs/envs/multitarget.md +++ b/docs/envs/multitarget.md @@ -26,7 +26,9 @@ def serve(): ```py def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.vscode_extensions([ "ms-python.python", ]) @@ -38,7 +40,9 @@ def build(): shell("zsh") def serve(): - base(os="ubuntu20.04", language="python3") + base(dev=False) + install.conda() + install.python() configure_streamlit(8501) configure_mnist() diff --git a/docs/faq/why.md b/docs/faq/why.md index 1a85571..490021e 100644 --- a/docs/faq/why.md +++ b/docs/faq/why.md @@ -115,7 +115,9 @@ The same logic in `envd` looks like this: ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.vscode_extensions([ "ms-python.python", ]) diff --git a/docs/guide/build-envd.md b/docs/guide/build-envd.md index be6f57b..9cdbe5d 100644 --- a/docs/guide/build-envd.md +++ b/docs/guide/build-envd.md @@ -34,11 +34,13 @@ Here is an example of `build.envd`: ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "numpy", ]) - shell("zsh") + shell("fish") config.jupyter() ``` @@ -55,7 +57,9 @@ You can create a file `build.envd` in your project directory with these lines: ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() ``` @@ -74,7 +78,7 @@ $ envd up => => exporting manifest sha256:7ef2e8571485ce51d966b4cf5fe83232520f 0.0s => => exporting config sha256:abec960de30fce69dc19126577c7aaae3f9b62 0.0s => => sending tarball 0.4s -envd@588f26349c61 $ +⬢ [envd]❯ ``` @@ -84,9 +88,9 @@ You can use `ssh .envd` to attach to the environment if ```bash -envd@588f26349c61 $ exit +⬢ [envd]❯ exit $ ssh demo.envd -envd@588f26349c61 $ # You are in the environment again! +⬢ [envd]❯ # You are in the environment again! ``` @@ -110,7 +114,9 @@ Let's have a look at `build.envd`. ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() ``` @@ -133,7 +139,9 @@ The [`envd` install API](../api/starlark/v0/install) function `install.python_pa ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "numpy", ]) @@ -155,9 +163,8 @@ Feel free to ask us in [Discord](https://discord.gg/KqswhpVgdU) if you get probl ``` $ envd up -envd@2c14bff847f8:$ python3 -Python 3.8.10 (default, Mar 15 2022, 12:22:08) -[GCC 9.4.0] on linux +⬢ [envd]❯ python3 +Python 3.11.11 (main, Dec 11 2024, 16:28:39) [GCC 11.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numpy as np >>> a = np.array([2, 3, 4]) @@ -173,7 +180,9 @@ The [`envd` API](../api/starlark/v0/global) function `shell` configures shell pr ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "numpy", ]) @@ -196,7 +205,9 @@ $ envd up ```python def build(): - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "numpy", ]) @@ -228,7 +239,9 @@ You can use the `envd` API function `config.pip_index` to set the PyPI index mir ```python def build(): config.pip_index(url="https://pypi.tuna.tsinghua.edu.cn/simple") - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "numpy", ]) @@ -259,7 +272,9 @@ deb https://mirror.sjtu.edu.cn/ubuntu focal-security main restricted universe mu install.vscode_extensions([ "ms-python.python", ]) - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "numpy", ]) diff --git a/docs/guide/concepts.md b/docs/guide/concepts.md index b4d6a18..0e59f65 100644 --- a/docs/guide/concepts.md +++ b/docs/guide/concepts.md @@ -36,6 +36,9 @@ Code below is for conceptual demonstration purposes only. Some features are not # build.envd # The function `build` will be evaluated by default. def build(): + base(dev=True) + install.conda() + install.python() version = "2.9.1" dev_env(version, "zsh") diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md index 1c4ed20..620fcad 100644 --- a/docs/guide/getting-started.md +++ b/docs/guide/getting-started.md @@ -26,7 +26,9 @@ Environments built with `envd` provide the following features out-of-the-box: envdlib = include("https://github.com/tensorchord/envdlib") def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() envdlib.tensorboard(8888) ``` @@ -89,7 +91,12 @@ For example, the PyPI cache is shared across builds and thus the package will be ```bash [Pip] # envd can be installed with pip. -pip3 install --upgrade envd +pip install --upgrade envd +``` + +```bash [uv] +# if you are using `uv` +uv tool install envd ``` ```bash [Homebrew] @@ -138,13 +145,15 @@ The build manifest `build.envd` looks like: ```python title=build.envd def build(): config.repo(url="https://github.com/tensorchord/envd", description="envd quick start example") - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() # Configure pip index if needed. # config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple") install.python_packages(name = [ "numpy", ]) - shell("zsh") + shell("fish") ``` *Note that we use Python here as an example but please check out examples for other languages such as R and Julia [here](https://github.com/tensorchord/envd/tree/main/examples).* @@ -157,29 +166,34 @@ cd envd-quick-start && envd up ```bash $ cd envd-quick-start && envd up -[+] ⌚ parse build.envd and download/cache dependencies 2.8s ✅ (finished) - => download oh-my-zsh 2.8s -[+] 🐋 build envd environment 18.3s (25/25) ✅ (finished) - => create apt source dir 0.0s - => local://cache-dir 0.1s - => => transferring cache-dir: 5.12MB 0.1s -... - => pip install numpy 13.0s - => copy /oh-my-zsh /home/envd/.oh-my-zsh 0.1s - => mkfile /home/envd/install.sh 0.0s - => install oh-my-zsh 0.1s - => mkfile /home/envd/.zshrc 0.0s - => install shell 0.0s - => install PyPI packages 0.0s - => merging all components into one 0.3s - => => merging 0.3s - => mkfile /home/envd/.gitconfig 0.0s - => exporting to oci image format 2.4s - => => exporting layers 2.0s - => => exporting manifest sha256:7dbe9494d2a7a39af16d514b997a5a8f08b637f 0.0s - => => exporting config sha256:1da06b907d53cf8a7312c138c3221e590dedc2717 0.0s - => => sending tarball 0.4s -envd-quick-start via Py v3.9.13 via 🅒 envd +[+] ⌚ parse build.envd and download/cache dependencies 6.2s ✅ (finished) +[+] build envd environment 19.0s (47/47) FINISHED + => CACHED [internal] setting pip cache mount permissions 0.0s + => docker-image://docker.io/tensorchord/envd-sshd-from-scratch:v0.4.3 2.3s + => => resolve docker.io/tensorchord/envd-sshd-from-scratch:v0.4.3 2.3s + => docker-image://docker.io/library/ubuntu:22.04 0.0s +...... + => [internal] pip install numpy 2.5s + => CACHED [internal] download fish shell 0.0s + => [internal] configure user permissions for /opt/conda 1.0s + => [internal] create dir for ssh key 0.5s + => [internal] install ssh keys 0.2s + => [internal] copy fish shell from the builder image 0.2s + => [internal] install fish shell 0.5s +...... + => [internal] create work dir: /home/envd/envd-quick-start 0.2s + => exporting to image 7.7s + => => exporting layers 7.7s + => => writing image sha256:464a0c12759d3d1732404f217d5c6e06d0ee4890cccd66391a608daf2bd314e4 0.0s + => => naming to docker.io/library/envd-quick-start:dev 0.0s +------ + > importing cache manifest from docker.io/tensorchord/python-cache:envd-v0.4.3: +------ +⣽ [5/5] attach the environment [2s] +Welcome to fish, the friendly interactive shell +Type help for instructions on how to use fish + +envd-quick-start on git master [!] via Py v3.11.11 via 🅒 envd as sudo ⬢ [envd]❯ # You are in the container-based environment! ``` @@ -190,7 +204,9 @@ Please edit the `build.envd` to enable jupyter notebook: ```python title=build.envd def build(): config.repo(url="https://github.com/tensorchord/envd", description="envd quick start example") - base(os="ubuntu20.04", language="python3") + base(dev=True) + install.conda() + install.python() # Configure pip index if needed. # config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple") install.python_packages(name = [ diff --git a/docs/guide/modularize.md b/docs/guide/modularize.md index 7fab240..4e2a9a0 100644 --- a/docs/guide/modularize.md +++ b/docs/guide/modularize.md @@ -33,7 +33,9 @@ envdlib = include("https://github.com/tensorchord/envdlib") # use it in your build function def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() envdlib.tensorboard(host_port=8888) ``` diff --git a/docs/guide/v1.md b/docs/guide/v1.md index 50724bf..40a8e45 100644 --- a/docs/guide/v1.md +++ b/docs/guide/v1.md @@ -12,13 +12,19 @@ These improvements make envd v1 a powerful tool for streamlining development wor ## Syntax changes -To use the v1, all you need is to declare the version in the first line of the `build.envd` file. +::: tip + +Start from `envd v1.0`, `envd` will use v1 syntax by default, no need to declare the version in the `build.envd` file. + +::: + +To use the v1 for `envd @@ -22,7 +23,8 @@ You can install Julia packages with `install.julia_packages` function. The follo ```python def build(): - base(os="ubuntu20.04", language="julia") + base(dev=True) + install.julia() install.julia_packages(name = [ "Example", ]) @@ -38,7 +40,8 @@ By default, the Julia package server `"pkg.julialang.org"` is used when download ```python def build(): - base(os="ubuntu20.04", language="julia") + base(dev=True) + install.julia() config.julia_pkg_server(url="https://mirrors.tuna.tsinghua.edu.cn/julia") install.julia_packages(name = [ "Example", @@ -54,7 +57,8 @@ You can specify shell program used in the environment with `shell` function. The ```python def build(): - base(os="ubuntu20.04", language="julia") + base(dev=True) + install.julia() shell("zsh") ``` @@ -68,7 +72,8 @@ You can specify VSCode extensions with `install.vscode_extensions` function. The ```python def build(): - base(os="ubuntu20.04", language="julia") + base(dev=True) + install.julia() install.vscode_extensions(["julialang.language-julia"]) ``` diff --git a/docs/lang/python.md b/docs/lang/python.md index 854dd09..c2212fb 100644 --- a/docs/lang/python.md +++ b/docs/lang/python.md @@ -12,24 +12,28 @@ The default language in `envd` is Python, thus there is no need to specify langu ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() ``` -The default version of python in `envd` is 3.9 (the latest patch version can be referred [here](https://anaconda.org/anaconda/python/files)). If you need to specify a particular version, just assign `language` to a string like `pythonX.Y.Z`: +The default version of python in `envd` is 3.11 (the latest patch version can be referred [here](https://anaconda.org/anaconda/python/files)). If you need to specify a particular version, just assign `version` to a string like `X.Y.Z`: ```python def build(): - base(os="ubuntu20.04", language="python3.11") + base(dev=True) + install.conda() + install.python(version="3.12") ``` :::warning -Python2 is not supported in `envd`. +Python2 environment is not supported in `envd`. ::: ## Conda packages @@ -40,7 +44,9 @@ You can install conda packages with `install.conda_packages` function. The follo ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() install.conda_packages(name = [ "numpy", "scipy", @@ -56,7 +62,9 @@ You can install Python packages from PyPI with `install.python_packages` functio ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() install.python_packages(name = [ "scikit-learn", "matplotlib", @@ -73,7 +81,9 @@ If conda is enabled, you can also install Python packages from PyPI with `instal ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() install.conda_packages(name = [ "numpy", "scipy", @@ -96,7 +106,9 @@ You can specify shell program used in the environment with `shell` function. The ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() shell("zsh") ``` @@ -109,7 +121,9 @@ You can specify VSCode extensions with `install.vscode_extensions` function. The ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() install.vscode_extensions(["ms-python.python"]) ``` @@ -124,7 +138,9 @@ You can set up the Jupyter notebook with `config.jupyter` function. The followin ```python def build(): - base(os="ubuntu20.04", language="python") + base(dev=True) + install.conda() + install.python() # Use `config.jupyter()` # if you do not need to set up password. config.jupyter(token="password") diff --git a/docs/lang/r.md b/docs/lang/r.md index d272d72..395fc0e 100644 --- a/docs/lang/r.md +++ b/docs/lang/r.md @@ -11,7 +11,8 @@ First, you can specify to use the R language in the `base` function. ```python def build(): - base(os="ubuntu20.04", language="r") + base(dev=True) + install.r_lang() ``` @@ -24,7 +25,8 @@ You can install R packages with `install.r_packages` function. The following exa ```python def build(): - base(os="ubuntu20.04", language="r") + base(dev=True) + install.r_lang() install.r_packages([ "remotes", "rlang", @@ -40,7 +42,8 @@ By default, the RStudio CRAN mirror `"https://cran.rstudio.com"` is used when do ```python def build(): - base(os="ubuntu20.04", language="r") + base(dev=True) + install.r_lang() config.cran_mirror(url="https://cloud.r-project.org/") install.r_packages([ "remotes", @@ -57,7 +60,8 @@ You can specify shell program used in the environment with `shell` function. The ```python def build(): - base(os="ubuntu20.04", language="r") + base(dev=True) + install.r_lang() shell("zsh") ``` @@ -71,7 +75,8 @@ You can specify VSCode extensions with `install.vscode_extensions` function. The ```python def build(): - base(os="ubuntu20.04", language="r") + base(dev=True) + install.r_lang() install.vscode_extensions(["REditorSupport.r-lsp"]) ```