SDK Reference
  • Dark
  • PDF

SDK Reference

  • Dark
  • PDF

SDK Reference - Repositories, Entities & Tutorials

The Dataloop Python dtlpy package enables a Python connection to Dataloop's environment.


Install Python

Python version 3.6 to 3.9 needs to be installed on your system using this official website. Earlier or later versions are not supported.

Install the dtlpy package

Install the plugin using pip, write the following command and press ENTER:

Please make sure you have pip installed on your computer (you can verify this by typing the command 'pip help' in your terminal); otherwise, download pip.
pip install dtlpy

Alternatively, install pip from the source by cloning the GitHub repo, then run the following command:

python install
Optional: Install Virtualenv

You can use pip to install the Virtualenv tool, which lets you create an isolated Python environment for your project.

pip install virtualenv
Optional: Set "Dataloop Directory" for cookie location

If needed, you can set the Dataloop path by setting an environment variable DATALOOP_PATH.
It is for users who do not have access to the default location cookie ”~/.dataloop”.

  1. Windows
  2. Linux
  3. Python
os.environ["DATALOOP_PATH"] = "/tmp"
Optional: Set Python dtlpy logging level

Set your dtlpy logging level to be displayed. The default value is a warning.
To understand more about Python logging levels please click here.

#import the dtlpy package to your python environment
import dtlpy as dl
#All supported levels
#For example, set INFO level  :
dl.verbose.logging_level = dl.VERBOSE_LOGGING_LEVEL_INFO

Login to the platform

To log in, type the command below :

  1. Shell
  2. Python
dlp login
import dtlpy as dl

Notice that the login token expires after 24 hours.

Once your browser opens the Login  screen, type the credentials below or login with Google.
Password: [your password]

Please wait for the "Login Successful" tab to appear, then close the tab.

M2M Login

Long-running SDK jobs require API authentication.

The M2M flow allows machines to obtain valid, signed JWT (authentication token) and automatically refresh it, without the need for a real user account UI login.

M2M Login is recommended when you want to

  • run commands on the platform without an ongoing internet connection
  • run API commands directly from an external system to Dataloop

 Log In Via SDK

1. Create a bot user with a unique name

Create a bot user with developer permissions to be used for every M2M login.

You only need to perform this step if this is your first time logging in.

import dtlpy as dl
dl.login() # use browser login to create the bot
project = dl.projects.get(project_name='myProject') # get your project
myBot = project.bots.create(name='my-unique-name', return_credentials=True)
Make sure to save the bot's email and password for future logins:
print("the bot email is "
print("the bot password is "+myBot.password)

2. Log in to the SDK with your new bot:

import dtlpy as dl
# Login to Dataloop platform
dl.login_m2m(email=email, password=password)
The old m2m Login

Log In Via SDK

1. Register into the system using a password method.

  • You can sign up with your personal username and password.
  • You will need to log in to the Dataloop platform once via the browser, using a password method and not with Google.

2. Verify the user via email.

3. Log in to the SDK:

import dtlpy as dl
# Login to Dataloop platform
dl.login_m2m(email="my_email_address", password="my_password")


Use this script when you wish to log out of the platform:


Upgrade the dtlpy Package

If you wish to upgrade an already installed dtlpy:

  • Refer to the following page to see the dtlpy latest version and version history.
  • Explore our release notes to see the changes for each version.
pip install dtlpy --upgrade