Skip to content
/ envd Public
forked from tensorchord/envd

πŸ•οΈ Reproducible development environment for AI/ML

License

Notifications You must be signed in to change notification settings

xxchan/envd

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

envd cat wink envd cat wink

Development environment for AI/ML

discord invitation link trackgit-views Python Version all-contributors envd package donwloads continuous integration Coverage Status

explain

explain

What is envd?

envd (ΙͺnˈvdΙͺ) is a command-line tool that helps you create the container-based development environment for AI/ML.

Development environments are full of Python and system dependencies, CUDA, BASH scripts, Dockerfiles, SSH configurations, Kubernetes YAMLs, and many other clunky things that are always breaking. envd is to solve the problem:

  1. Declare the list of dependencies (CUDA, Python packages, your favorite IDE, and so on) in build.envd
  2. Simply run envd up.
  3. Develop in the isolated environment.

Why use envd?

Environments built with envd provide the following features out-of-the-box:

❀️ Knowledge reuse in your team

envd build functions can be reused. Use include function to import any Git repositories. No more copy/paste Dockerfile instructions, let's reuse them.

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

def build():
    base(os="ubuntu20.04", language="python")
    envdlib.tensorboard(host_port=8888)
envdlib.tensorboard is defined in github.com/tensorchord/envdlib
def tensorboard(
    envd_port=6006,
    envd_dir="/home/envd/logs",
    host_port=0,
    host_dir="/tmp",
):
    """Configure TensorBoard.

    Make sure you have permission for `host_dir`

    Args:
        envd_port (Optional[int]): port used by envd container
        envd_dir (Optional[str]): log storage mount path in the envd container
        host_port (Optional[int]): port used by the host, if not specified or equals to 0,
            envd will randomly choose a free port
        host_dir (Optional[str]): log storage mount path in the host
    """
    install.python_packages(["tensorboard"])
    runtime.mount(host_path=host_dir, envd_path=envd_dir)
    runtime.daemon(
        commands=[
            [
                "tensorboard",
                "--logdir",
                envd_dir,
                "--port",
                str(envd_port),
                "--host",
                "0.0.0.0",
            ],
        ]
    )
    runtime.expose(envd_port=envd_port, host_port=host_port, service="tensorboard")

⏱️ BuildKit-native, build up to 6x faster

BuildKit supports parallel builds and software cache (e.g. pip index cache and apt cache). You can enjoy the benefits without knowledge of it.

For example, the PyPI cache is shared across builds and thus the package will be cached if it has been downloaded before.

Getting Started πŸš€

Requirements

  • Docker (20.10.0 or above)

Install and bootstrap envd

envd can be installed with pip, or you can download the binary release directly. After the installation, please run envd bootstrap to bootstrap.

pip3 install --upgrade envd

After the installation, please run envd bootstrap to bootstrap:

envd bootstrap

Read the documentation for more alternative installation methods.

You can add --dockerhub-mirror or -m flag when running envd bootstrap, to configure the mirror for docker.io registry:

envd bootstrap --dockerhub-mirror https://docker.mirrors.sjtug.sjtu.edu.cn

Create an envd environment

Please clone the envd-quick-start:

git clone https://github.com/tensorchord/envd-quick-start.git

The build manifest build.envd looks like:

def build():
    base(os="ubuntu20.04", language="python3")
    # Configure the pip index if needed.
    # config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple")
    install.python_packages(name = [
        "numpy",
    ])
    shell("zsh")

Note that we use Python here as an example but please check out examples for other languages such as R and Julia here.

Then please run the command below to set up a new environment:

cd envd-quick-start && envd up
$ 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:https://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
⬒ [envd]❯ # You are in the container-based environment!

Set up Jupyter notebook

Please edit the build.envd to enable jupyter notebook:

def build():
    base(os="ubuntu20.04", language="python3")
    # Configure the pip index if needed.
    # config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple")
    install.python_packages(name = [
        "numpy",
    ])
    shell("zsh")
    config.jupyter()

You can get the endpoint of the running Jupyter notebook via envd envs ls.

$ envd up --detach
$ envd envs ls
NAME                    JUPYTER                 SSH TARGET              CONTEXT                                 IMAGE                   GPU     CUDA    CUDNN   STATUS          CONTAINER ID
envd-quick-start        https://localhost:42779   envd-quick-start.envd   /home/gaocegege/code/envd-quick-start   envd-quick-start:dev    false   <none>  <none>  Up 54 seconds   bd3f6a729e94

More on documentation πŸ“

See envd documentation.

Roadmap πŸ—‚οΈ

Please checkout ROADMAP.

Contribute 😊

We welcome all kinds of contributions from the open-source community, individuals, and partners.

Open in Gitpod

Contributors ✨

Thanks goes to these wonderful people (emoji key):

 Friends A.
Friends A.

πŸ“– 🎨
Aaron Sun
Aaron Sun

πŸ““ πŸ’»
Aka.Fido
Aka.Fido

πŸ“¦ πŸ“– πŸ’»
Alex Xi
Alex Xi

πŸ’»
Bingyi Sun
Bingyi Sun

πŸ’»
Ce Gao
Ce Gao

πŸ’» πŸ“– 🎨 πŸ“†
Frost Ming
Frost Ming

πŸ’» πŸ“–
Guangyang Li
Guangyang Li

πŸ’»
Gui-Yue
Gui-Yue

πŸ’»
Haiker Sun
Haiker Sun

πŸ’»
Ikko Ashimine
Ikko Ashimine

πŸ’»
Isaac
Isaac

πŸ’»
JasonZhu
JasonZhu

πŸ’»
Jian Zeng
Jian Zeng

🎨 πŸ€” πŸ”¬
Jinjing Zhou
Jinjing Zhou

πŸ› πŸ’» 🎨 πŸ“–
Jun
Jun

πŸ“¦ πŸ’»
Keming
Keming

πŸ’» πŸ“– πŸ€” πŸš‡
Kevin Su
Kevin Su

πŸ’»
Ling Jin
Ling Jin

πŸ› πŸš‡
Manjusaka
Manjusaka

πŸ’»
Nino
Nino

🎨 πŸ’»
Pengyu Wang
Pengyu Wang

πŸ“–
Sepush
Sepush

πŸ“–
Siyuan Wang
Siyuan Wang

πŸ’» πŸš‡ 🚧
Suyan
Suyan

πŸ“–
To My
To My

πŸ“–
Tumushimire Yves
Tumushimire Yves

πŸ’»
Wei Zhang
Wei Zhang

πŸ’»
Weizhen Wang
Weizhen Wang

πŸ’»
XRW
XRW

πŸ’»
Xu Jin
Xu Jin

πŸ’»
Xuanwo
Xuanwo

πŸ’¬ 🎨 πŸ€” πŸ‘€
Yijiang Liu
Yijiang Liu

πŸ’»
Yilong Li
Yilong Li

πŸ“– πŸ› πŸ’»
Yuan Tang
Yuan Tang

πŸ’» 🎨 πŸ“– πŸ€”
Yuchen Cheng
Yuchen Cheng

πŸ› πŸš‡ 🚧 πŸ”§
Yuedong Wu
Yuedong Wu

πŸ’»
Yunchuan Zheng
Yunchuan Zheng

πŸ’»
Zheming Li
Zheming Li

πŸ’»
Zhenguo.Li
Zhenguo.Li

πŸ’» πŸ“–
Zhenzhen Zhao
Zhenzhen Zhao

πŸš‡ πŸ““ πŸ’»
Zhizhen He
Zhizhen He

πŸ’» πŸ“–
cutecutecat
cutecutecat

πŸ’»
dqhl76
dqhl76

πŸ“– πŸ’»
jimoosciuc
jimoosciuc

πŸ““
kenwoodjw
kenwoodjw

πŸ’»
nullday
nullday

πŸ€” πŸ’»
rrain7
rrain7

πŸ’»
tison
tison

πŸ’»
wangxiaolei
wangxiaolei

πŸ’»
wyq
wyq

πŸ› 🎨 πŸ’»
x0oo0x
x0oo0x

πŸ’»
xiangtianyu
xiangtianyu

πŸ“–
xieydd
xieydd

πŸ’»
xing0821
xing0821

πŸ€” πŸ““ πŸ’»
zhyon404
zhyon404

πŸ’»
ζ¨ζˆι”΄
ζ¨ζˆι”΄

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!

Star History

Star History Chart

License πŸ“‹

Apache 2.0

trackgit-views

About

πŸ•οΈ Reproducible development environment for AI/ML

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 90.7%
  • Python 3.9%
  • Shell 3.5%
  • Makefile 1.3%
  • Dockerfile 0.6%