Skip to content

Installing AI Verify Developer Tools

Before You Begin

This page prepares your environment for development on AI Verify. By the end of this guided example, you should end up with the following folder structure.

<working directory>/
├── aiverify/
    ├── ai-verify-shared-library/
    ├── test-engine-core/
    └── test-engine-core-modules/
├── aiverify-developer-tools/
    ├── README.md
    ├── ai-verify-algorithm-template/
    ├── ai-verify-plugin/
    └── template_plugin/
├── my_plugin/
└── my_virtual_environment/
The Developer Tools require specific modules from the main AI Verify repository. If you have not installed AI Verify, use sparse-checkout on the AI Verify repository to selectively checkout files that are relevant to the Developer Tools.

  1. Clone the required modules and selectively checkout dependencies needed for Developer Tools
    # Execute in the working directory
    git clone https://github.com/IMDA-BTG/aiverify.git
    cd aiverify
    git sparse-checkout init --cone
    git sparse-checkout set ai-verify-shared-library test-engine-core-modules test-engine-core
    
    ls # You should be able to see the three folders
    

After the sparse checkout, you should end up with these three folders in your aiverify project directory. Please take note of the test-engine-core-modules path, as you will need it later while testing the algorithm component.

Sparse Checkout Folders

Installing Dependencies

Install the following dependencies if they are not already available.

  1. Install jq and zip

    sudo apt-get install -y jq zip
    

  2. Install Python and its virtual environment packages

    sudo apt-get install -y python3.10 python3-pip python3.10-venv
    

  3. Install NodeJS

    curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
    sudo apt-get install -y nodejs
    

Preparing a Virtual Environment

We recommend setting up a virtual environment for your plugin project to ensure that these libraries will not mess up your main development environment.

  1. Create a virtual environment

    # Execute in the working directory
    python3 -m venv my_virtual_environment
    

  2. Activate your newly created virtual environment

    source my_virtual_environment/bin/activate
    

  3. Check that you're working from the virtual environment

    which python # you should see something like <working directory>/my_virtual_environment/bin/python
    

  4. Install plugin dependencies in your virtual environment

    pip install --upgrade pip
    pip install cookiecutter
    

  5. Install AI Verify Test Engine Core.

    # Execute these in the aiverify directory
    cd test-engine-core
    pip install dist/test_engine_core-0.9.0.tar.gz
    
    # Head back to the aiverify directory
    cd ..
    

    Note

    AI Verify Test Engine currently runs Pandas V1.5.3. We do not support Pandas 2.x.x.

  6. Install necessary requirements from test-engine-core-modules.

    # Execute these in the aiverify directory
    cd test-engine-core-modules
    pip install -r requirements.txt
    
    # Head back to the aiverify directory
    cd ..
    

  7. Install dependencies and build AI Verify Frontend Shared Library

    # Execute these in the aiverify directory
    cd ai-verify-shared-library
    npm install
    npm run build
    
    # Head back to the aiverify directory
    cd ..
    

Installing AI Verify Developer Tools

Install AI Verify Developer Tools in your environment.

  1. Clone our developer's repository. We recommend cloning this in the same directory you cloned aiverify.

    # Execute in the working directory
    git clone https://github.com/IMDA-BTG/aiverify-developer-tools.git
    

  2. Install AI Verify Plugin Tool

    cd aiverify-developer-tools/ai-verify-plugin
    npm install
    npm link ../../aiverify/ai-verify-shared-library
    sudo npm install -g # You may need sudo for this command
    

If the installation is successful, you should see a similar output as shown below.

ai-verify-plugin

$ ai-verify-plugin --help
ai-verify-plugin <cmd> [args]

Commands:
  ai-verify-plugin generate-plugin [gid]      Generate skeleton AI Verify plugin project                  [aliases: gp]
  ai-verify-plugin generate-widget <cid>      Generate skeleton AI Verify widget                          [aliases: gw]
  ai-verify-plugin generate-inputblock <cid>  Generate skeleton AI Verify input block                    [aliases: gib]
  ai-verify-plugin generate-algorithm <cid>   Generate skeleton AI Verify algorithm                       [aliases: ga]
  ai-verify-plugin zip [pluginDir]            Create the plugin zip file
  ai-verify-plugin validate                   Validate AI Verify plugin
  ai-verify-plugin test-widget                Run the plugin tests for widgets and input blocks        [aliases: testw]
  ai-verify-plugin test-algorithm             Run the plugin tests for algorithms                      [aliases: testa]
  ai-verify-plugin test-all                   Run all the tests for widgets, input blocks and algorithms with default
                                              options
  ai-verify-plugin playground                 Launch the plugin playround

Options:
  --help  Show help                                                                                           [boolean]

cookiecutter

cookiecutter -h

cookiecutter Help Text

Congratulations! You are ready to create your first plugin.