__init__
v1 syntax
TIP
Note that the documentation is automatically generated from envd/api folder in tensorchord/envd repo. Please update the python file there instead of directly editing file inside envd-docs repo.
WARNING
Enable v1 by adding # syntax=v1
to the 1st line of your envd file.
v1 is experimental and may change in the future. Make sure to freeze the envd version for online CI/CD.
base
def base(image: str = "ubuntu:20.04", dev: bool = False)
Set up the base env.
Arguments:
image
str - docker image, can be any Debian-based imagedev
bool - enabling the dev env will add lots of development related libraries like envd-sshd, vim, git, shell prompt, vscode extensions, etc.
shell
def shell(name: str = "bash")
Interactive shell
Arguments:
name
str - shell name (i.e.zsh
,bash
)
run
def run(commands: List[str], mount_host: bool = False)
Execute command
Arguments:
commands
List[str] - command to run during the building processmount_host
bool - mount the host directory. Default is False. Enabling this will disable the build cache for this operation.
Example:
run(commands=["conda install -y -c conda-forge exa"])
git_config
def git_config(name: Optional[str] = None,
email: Optional[str] = None,
editor: Optional[str] = None)
Setup git config.
Arguments:
name
str - User nameemail
str - User emaileditor
str - Editor for git operationsExample usage:
git_config(name="My Name", email="my@email.com", editor="vim")
include
def include(git: str)
Import from another git repo
This will pull the git repo and execute all the envd
files. The return value will be a module contains all the variables/functions defined (except the ones with _
prefix).
Arguments:
git
str - git URLExample usage:
envd = include("https://github.com/tensorchord/envdlib")
def build():
base(os="ubuntu20.04", language="python")
envd.tensorboard(host_port=8000)