Skip to content

__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

python
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 images
  • dev bool - enabling the dev env will add lots of development related libraries like envd-sshd, vim, git, shell prompt, vscode extensions, etc.

shell

python
def shell(name: str = "base")

Interactive shell

Arguments:

  • name str - shell name (i.e. zsh, bash)

run

python
def run(commands: str, mount_host: bool = False)

Execute command

Arguments:

  • commands str - command to run during the building process
  • mount_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

python
def git_config(name: Optional[str] = None,
               email: Optional[str] = None,
               editor: Optional[str] = None)

Setup git config

Arguments:

  • name str - User name

  • email str - User email

  • editor str - Editor for git operations

    Example usage:

git_config(name="My Name", email="my@email.com", editor="vim")

include

python
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 (expect those has _ prefix).

Arguments:

  • git str - git URL

    Example usage:

envd = include("https://github.com/tensorchord/envdlib")

def build():
    base(os="ubuntu20.04", language="python")
    envd.tensorboard(host_port=8000)

Released under the Apache-2.0 License. Built with VitePress.