diff --git a/envd/api/__init__.py b/envd/api/__init__.py index 8091a19bd..764222810 100644 --- a/envd/api/__init__.py +++ b/envd/api/__init__.py @@ -37,7 +37,7 @@ def shell(name: str): """Interactive shell Args: - name (str): shell name(i.e. `zsh`) + name (str): shell name(i.e. `zsh`, `bash`) """ @@ -45,7 +45,12 @@ def run(commands: str): """Execute command Args: - commands (str): command to run + commands (str): command to run during the building process + + Example: + ``` + run(commands=["conda install -y -c conda-forge exa"]) + ``` """ @@ -60,4 +65,29 @@ def git_config( name (optional, str): User name email (optional, str): User email editor (optional, str): Editor for git operations + + Example usage: + ``` + git_config(name="My Name", email="my@email.com", editor="vim") + ``` + """ + + +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). + + Args: + git (str): git URL + + Example usage: + ``` + envd = include("https://github.com/tensorchord/envdlib") + + def build(): + base(os="ubuntu20.04", language="python") + envd.tensorboard(8000) + ``` """ diff --git a/envd/api/runtime/__init__.py b/envd/api/runtime/__init__.py index 27f831bc3..1b63078cd 100644 --- a/envd/api/runtime/__init__.py +++ b/envd/api/runtime/__init__.py @@ -25,10 +25,20 @@ def command(commands: Dict[str, str]): - """Execute commands + """Execute commands during runtime Args: commands (Dict[str, str]): map name to command, similar to Makefile + + Example usage: + ``` + runtime.command(commands={ + "train": "python train.py --epoch 20 --notify me@tensorchord.ai", + "run": "python server.py --batch 1 --host 0.0.0.0 --port 8000", + }) + ``` + + You can run `envd run --command train` to train the model. """