Setup for CLI

TrueFoundry CLI Library

TrueFoundry CLI library to help you interact with the platform programmatically by

  • Interacting with the deployments side of TrueFoundry, enabling you to manage workspaces, deployments, applications, and view logs.
  • Providing experiment tracking capabilities, allowing you to track ML experiments and interact with ML repositories within TrueFoundry.

Setup for CLI

Installation

📘

Prerequisites

  • Python >= 3.8

To install the Truefoundry CLI to enable both deployment and models functionality, run the following command:

pip install -U "truefoundry[workflow]"

Login

Login by entering a Device Code

You can log in to TrueFoundry using Truefoundry CLI.

To log in to TrueFoundry, run the following command:

tfy login --host <your-truefoundry-host> # e.g. host: https://your-domain.truefoundry.com

This will prompt you to open a URL and enter the displayed code

Login using API Key (Non-Interactive Mode)

For scenarios where code interacts with Truefoundry APIs or where opening a browser is not feasible, you can log in using the Truefoundry API Key.

To begin, Generate a TrueFoundry API Key. Once you have the API key, you can authenticate in these ways:

Setting environment variables

Set the TFY_API_KEY and TFY_HOST environment variables.

  • Set TFY_HOST to your Truefoundry host URL. e.g. https://your-domain.truefoundry.com
  • Set TFY_API_KEY to your API key.

Using the login command on CLI

When using the CLI, you can provide the API key directly within the command:

tfy login --host <your-truefoundry-host> --api-key <your-api-key>

Generate TrueFoundry API Key

TrueFoundry API comes in handy when you want to interact with the Platform programmatically. You can generate the API key by following the instructions below:

📘

For production environments, prefer Virtual Account API Keys

📘

Note:

Your API Key is a sensitive piece of information, so handle it with care. Never share it with unauthorized individuals.