Build the extension

This guide explains how to use the build-extension command to package your Python code into extensions for Altair AI Tools.

Build Command Overview

The build-extension command packages your Python code, configuration files, and environment specifications into a distributable ZIP archive that can be installed in AI Studio.

Basic Usage

build-extension [options] PATH

Where PATH is the directory containing your extension definition and source code.

Command Options

Option Description
-h, --help Show the help message and exit
-f FILE, --file FILE Specify the extension configuration file (default: extension.toml)
-o OUTPUT, --output OUTPUT Set the output directory for the built extension
-c, --compile Compile Python files to .pyc format
--download-env Download and include environment packages for offline deployment
--list-at-root List operators at root level in Studio (not within folders)
-v, --verbose Show detailed information during the build process

Common Build Scenarios

Building for Online Environment (Default)

When users have internet access, you can build a lightweight extension that will download required packages during installation:

On Windows

build-extension -o "%USERPROFILE%\.AltairRapidMiner\AI Studio\shared\extensions\python-extensions" .

On macOS/Linux

build-extension -o "~/.AltairRapidMiner/AI Studio/shared/extensions/python-extensions" .

This creates an extension ZIP file that includes just the environment specification file.

This will create the extension zip file including the environment file in the output directory.

Building for Offline Environment (Air-Gapped)

This downloads all required packages and includes them in the extension ZIP file for offline installation.

build-extension -o "output_directory" -c --download-env .

Compiling Python Files

You can also compile python files to .pyc format by specifying the -c flag in the build-extension command.

Building Process

When you run build-extension, the command:

  1. Reads your extension configuration from extension.toml
  2. Validates the extension structure and dependencies
  3. Creates the environment specification (or downloads packages if requested)
  4. Packages everything into a ZIP file named after your extension
  5. Places the ZIP file in the specified output directory

Next Steps

After building your extension, you can:

  • Start Altair AI Studio and test the extension.
  • Share it with others for installation on their systems
  • Update your code and rebuild as needed during development