Links

Environment variables

Supervisely sets default environment variables for each Supervisely Application run. You can also use these environment variables for your development and debugging.
Supervisely has the set default environment variables, Supervisely Application has access to them and we recommend using the same variables during development and debugging.
Environment variables are case-sensitive.
For development and debugging purposes you can manually copy the ID to a clipboard for every item you are working on: team, workspace, project, dataset, image, labeling job, team member, etc... Just open the context menu of the item and press Copy ID button.
​
​

.ENV file

For convenient development and debugging we recommend using .env files to avoid hardcoding test variables into your sources and keep private your passwords, secrets, and other sensitive information. Also, it allows avoiding accidentally committing (exposing) these values to a git repository.
Save .env file to ~/supervisely.env with your credentials. The content of this file will look something like this:
SERVER_ADDRESS="https://app.supervise.ly"
API_TOKEN="4r47N.....blablabla......xaTatb"
Also with every tutorial, guide, and demo application you will find local.env file that contains other environment variables used for debugging. For example:
# change the Project ID to your value
modal.state.slyProjectId=12208 # ⬅️ change it
And then load it in your python code:
import os
from dotenv import load_dotenv
import supervisely as sly
​
load_dotenv("local.env")
load_dotenv(os.path.expanduser("~/supervisely.env"))
​
api = sly.Api.from_env()

Default environment variables

SERVER_ADDRESS

address of your Supervisely instance, for Community Edition the value should be https://app.supervise.ly. For the Enterprise Edition the value is custom and depends on your configuration. Learn more here. This variable is always passed to an App.

API_TOKEN

Your personal access token for authentication. Learn more here. This variable is always passed to an App.

TASK_ID

When you run an app on Supervisely, the platform creates a task for this app to store all relevant information for this task (logs, persistent data, cache, temporary files, ...). Task ID is needed to access this data (read or write). This variable is always passed to an App.
Aplication task on page "Workspace tasks"

TEAM_ID

The ID of the currently opened team. This variable is always passed to an App.
Current team
Alternative env is duplicated for compatibility: context.teamId
Some Docker images do not support env names with dot . symbols. For such cases, the alternative variable CONTEXT_TEAMID is available starting from Agent version >=6.7.0.

WORKSPACE_ID

The ID of the currently opened workspace. This variable is always passed to an App.
Current workspace
Alternative env is duplicated for compatibility: context.workspaceId
Some Docker images do not support env names with dot . symbols. For such cases, the alternative variable CONTEXT_WORKSPACEID is available starting from Agent version >=6.7.0.

USER_LOGIN

Name of the user who run (spawned) current application session (task_id).
Alternative env is duplicated for compatibility: context.userLogin
Some Docker images do not support env names with dot . symbols. For such cases, the alternative variable CONTEXT_USERLOGIN is available starting from Agent version >=6.7.0.

PROJECT_ID

It is set when an app is spawned from the context menu of a project. For apps, that are running on agents with version <= 6.6.6, please use modal.state.slyProjectId or be sure that you are using the latest version of the Supervisely Agent (recommended).
Alternative env is duplicated for compatibility: context.projectId
Some Docker images do not support env names with dot . symbols. For such cases, the alternative variable CONTEXT_PROJECTID is available starting from Agent version >=6.7.0.

DATASET_ID

It is set when an app is spawned from the context menu of a dataset. For apps, that are running on agents with version <= 6.6.6, please use modal.state.slyDatasetId or be sure that you are using the latest version of the Supervisely Agent (recommended).
Alternative env is duplicated for compatibility: context.datasetId
Some Docker images do not support env names with dot . symbols. For such cases, the alternative variable CONTEXT_DATASETID is available starting from Agent version >=6.7.0.

FOLDER

It is set when an app is spawned from the context menu of a folder in Team Files. For apps, that are running on agents with version <= 6.6.9, please use modal.state.slyFolder or be sure that you are using the latest version of the Supervisely Agent (recommended).
Alternative env is duplicated for compatibility: context.slyFolder
Some Docker images do not support env names with dot . symbols. For such cases, the alternative variable CONTEXT_SLYFOLDER is available starting from Agent version >=6.7.0.

FILE

It is set when an app is spawned from the context menu of a file in Team Files. For apps, that are running on agents with version <= 6.6.9, please use modal.state.slyFile or be sure that you are using the latest version of the Supervisely Agent (recommended).
Alternative env is duplicated for compatibility: context.slyFile
Some Docker images do not support env names with dot . symbols. For such cases, the alternative variable CONTEXT_SLYFILE is available starting from Agent version >=6.7.0.