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.
Install Truefoundry CLI
You need Python >= 3.9 to use the Truefoundry CLI.
By default just installing truefoundry
does not include support to work with Workflows. To include support for Workflows install the workflow
extra.
Authenticate CLI
To be able to use the TrueFoundry CLI, you first need to authenticate. You can login either via browser or using API Key.
To log in to TrueFoundry, run the following command:
The value for --host
is the first part of the url when you open the platform. This domain might be subdomain of your organization. The below example shows https://myorg.truefoundry.cloud
This will prompt you to open a URL and show you a Submit
button.
Once you click on Submit, you will be signed in to the CLI.
To log in to TrueFoundry, run the following command:
The value for --host
is the first part of the url when you open the platform. This domain might be subdomain of your organization. The below example shows https://myorg.truefoundry.cloud
This will prompt you to open a URL and show you a Submit
button.
Once you click on Submit, you will be signed in to the CLI.
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. The steps for this are as follows:
Generate a TrueFoundry API Key
Generate a Truefoundry API Key from Access -> Personal Access Tokens.
Your API Key is a sensitive piece of information - so Never share it with unauthorized individuals. You will not be able to see the value of the API key on the Truefoundry platform again - so please save it in a secure location.
For production environments, you can use Virtual Account API Keys instead of Personal Access Tokens to authenticate. Virtual Account API Keys are not tied to a user and hence don’t expire when the user leaves the organization.
Use the API key to login
You can use the API key to login in two ways:
Option 1: 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.
You can now use the Truefoundry SDK to interact with the platform.
Option 2: Using the login
command on CLI
When using the CLI, you can provide the API key directly within the command: