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"

context.teamId

The ID of the currently opened team. This variable is always passed to an App.
Current team

context.workspaceId

The ID of the currently opened workspace. This variable is always passed to an App.
Current workspace

context.userLogin

Name of the user who run (spawned) current application session (task_id).

modal.state.slyProjectId

It is set when an app is spawned from the context menu of a project.

modal.state.slyDatasetId

It is set when an app is spawned from the context menu of a dataset.

context.slyFolder

It is set when an app is spawned from the context menu of a folder in Team Files.