CLI Setup
  • 14 Sep 2023
  • 3 Minutes to read
  • Dark
    Light
  • PDF

CLI Setup

  • Dark
    Light
  • PDF

 

This article is deprecated.

Article Summary

Note:
The LandingLens CLI has been deprecated. We recommend using the Python SDK instead. Additionally, the CLI is only supported in the Classic Flow version of LandingLens.

Install Python

The LandingLens CLI is Python-based. Before you can install LandingLens CLI, you must install Python.

LandingLens CLI supports Python versions 3.6, 3.7, and 3.8. Python is an open-source programming language for building machine learning applications. 

It is recommended to install Anaconda Python Distribution. This installation includes the entire scientific Python library, like NumPy, SciPy, and more. Or, if you prefer to go the minimal install route, use Miniconda. If you use this option, say "Yes" or select the checkbox for adding Python to Path. 

Verify your Anaconda Python installation by opening a terminal and entering conda. A list of options displays. 

Note:
If your system says the command is not found, it is likely that a step was missed when adding Python to the path. For more information on adding Anaconda to the Path, go here.

If you installed Python through the Anaconda or Miniconda distribution, use conda to create a virtual environment and install from the virtual environment.

# Specify a python version >=3.6
conda create -n llens python=3.6
conda activate llens

If you do not want to install Anaconda or Miniconda, you can create a virtual environment from your Terminal (for macOS or Linux) or PowerShell prompt (for Windows):

python3 -m venv ~/envs/llens
# Windows
~/envs/llens/Scripts/activate.bat
# Mac / Linux
. ~/envs/llens/bin/activate

Install LandingLens CLI

You must install the LandingLens CLI using Wheel.

pip install -U https://landinglens-client-releases.s3.us-east-2.amazonaws.com/landinglens-latest-py3-none-any.whl
Note:
Remember to activate your virtual environment every time you use LandingLens CLI.

Configure LandingLens CLI

This section explains how to configure LandingLens CLI so that it can interact with the LandingLens servers.

Generate API Key and Secret

Some commands requires your API Key and API Secret. For detailed information about how to generate these credentials, go to API Key and API Secret.

Quick Configuration

After you generated your API Key and Secret, you must configure llens. For general use cases, llens configure set-profile is the fastest way to set up.

Run the following command.

llens configure set-profile

When you enter this command, LandingLens CLI will ask you for the basic settings that are required to interact with LandingLens. This includes your LandingLens API Key and Secret, and Project ID.

Copy and paste them into LandingLens CLI, and you're good to go.

Note:
Remember to keep your credentials in a secure place. If you lose them, you will need to regenerate the credentials and reconfigure LandingLens CLI.

Advanced Configurations

LandingLens CLI configuration is stored in ~/.landinglens/config.ini. It has the following format.

[DEFAULT]
default_profile = primary

[primary]
api_key = <KEY>
api_secret = <SECRET>
project_id = <PROJECT_ID>

Named Profiles

You can create named profiles, by specifying --profile as an additional argument.

llens configure set-profile --profile=staging

This can be useful when working with multiple organizations in Production or running in multiple environments.

[DEFAULT]
default_profile = primary

[primary]
api_key = <KEY>
api_secret = <SECRET>
project_id = <PROJECT_ID>

[staging]
api_key = <KEY>
api_secret = <SECRET>
project_id = <PROJECT_ID>

Currently, LandingLens CLI does not allow you to choose which profile you want to use when running a job. Therefore, you need to change the default profile before you run a new job. You can achieve this by using the following command:

llens configure set-default <profile name>

Custom Endpoints

By default, LandingLens CLI calls Landing production servers. To send API calls to staging or other servers, add the following lines to the profile manually.

[staging]
api_key = <KEY>
api_secret = <SECRET>
project_id = <PROJECT_ID>

# Staging server URLs for all APIs
landing_api = https://staging.platform.landingai.io
landing_model_api = https://agw-staging.platform.landingai.io

# Print detailed output from request and response to server
debug = true

LandingLens CLI Configure Commands

# Get list of commands
llens

# Set Configurations
llens configure set-profile  # Set Configurations for "primary" profile
llens configure set-profile [--profile=]<profile_name>

# Get list of profiles
llens configure ls

# Set default profile (when working with local, dev, staging and prod)
llens configure set-default <profile name>

# Get profile credentials
llens configure get-profile  # Will print the default or primary profile
llens configure get-profile [--profile=]<profile name>

Was this article helpful?