Applied Libraries#

Introduction#

Helping to contribute towards the ivy libraries requires a slightly more complex setup than is needed for contributing to ivy alone. For instance, Ivy Robot depends on Mech, Vision and Demo Utils. Thus, the related repositories have to be pulled into the same local folder, and Ivy must also be pulled into this same folder.

To have a better grasp, let’s look at an example for Ivy Robot in the next section!

Example - Ivy Robot#

Directory Tree

  1. Due to dependencies, the related Ivy repositories have to be placed in the same local directory:

|-- your-local-dir
|   |-- ivy
|   |-- mech
|   |-- vision
|   |-- robot
|   |-- demo-utils
  1. Clone all repositories into a mutual directory:

    git clone https://github.com/unifyai/ivy.git
    
    git clone https://github.com/unifyai/mech.git
    
    git clone https://github.com/unifyai/vision.git
    
    git clone https://github.com/unifyai/robot.git
    
    git clone https://github.com/unifyai/demo-utils.git
    
  2. The next steps will depend on your type of development.

Local Development

  1. Create a virtual environment (venv) in the same directory:

    python3 -m venv ivy_dev
    
  2. Activate the environment:

    (on Windows)
    ivy_dev\Scripts\activate.bat
    
    (on Mac/Linux)
    source ivy_dev/bin/activate
    
  3. Go into each directory and install packages in develop/editable mode:

    cd ivy
    python3 -m pip install --user -e .
    

    (repeat for all repositories)

    NOTE: In develop mode, packages are linked to their local directory. Therefore, changes or edits are reflected immediately when in use.

  4. To use:

    python3
    
    import ivy_robot
    

Docker Development

  1. Install Docker Desktop

  2. Go into the robot repository and build the docker image:

    cd robot
    docker build -t my-robot .
    
  3. To use, first mount the local directories, then start up python3 with Docker:

    (in the folder containing all repositories)
    docker run --rm -it -v `pwd`/ivy:/ivy -v `pwd`/mech:/mech -v `pwd`/vision:/vision -v `pwd`/robot:/robot -v `pwd`/demo-utils:/demo-utils my-robot python3
    

    NOTE: Mounting allows the docker container to use local folder as volumes, thus reflecting the local changes or edits made. Users are not required to rebuild the docker image after every change.

IDE Development

  1. For PyCharm, configurations are saved in the .idea folder (part of the ivy repo).

  2. For VSCode, configurations can be found in the .devcontainer folder (not part of the ivy repo).

NOTE: To use development container in VSCode, the extension “Remote - Containers” needs to be installed.

NOTE: When using GitHub Codespaces, the mounts config in .devcontainer/devcontainer.json is not supported.

Round Up

These examples should hopefully give you a good understanding of what is required when developing the Ivy applied libraries.

If you have any questions, please feel free to reach out on discord in the pycharm channel, docker channel, pre-commit channel, pip packages channel or `other channel`_, depending on the question!