Table of Contents

Projects

Alex Cota Updated by Alex Cota

Below are some frequently used methods for Projects. For a complete list of methods see the API reference.

A Project contains all labeling and reviewing work for a set of data.

Before you start

Complete the installation and authentication steps.

Make sure the API client is initialized:

from labelbox import Client
client = Client()

Create a Project

Use the create_project method to create and name your Project.

project = client.create_project(name="<project_name>")

Where:

  • name is the name you give your project.

Fetch a Project

Use the get_project method to fetch a single Project.

project = client.get_project("<project_id>")
print(project)

Fetch multiple Projects

There are three ways to fetch multiple Projects.

a. Fetch all projects.

for project in client.get_projects():
print(project.name, project.uid)

b. Pass a where parameter with a standard comparison operator (==, !=, >, >=, <, <=). Then, iterate over the PaginatedCollection object.

To learn more about PaginatedCollection objects, see our docs Pagination.
from labelbox import Project
projects_x = client.get_projects(where=Project.name == "<project_name>")
for x in projects_x:
print(x)

Or you can use the this code to get your desired object which will raise an error if there is not at least one item in the collection.

item = next(iter(projects_x))
print(item)

For more information on pagination, see General concepts.

c. Specify a Project by combining comparisons using logical expressions. Currently, the where clause supports the logical AND operator.

from labelbox import Project
projects = client.get_projects(where=(Project.name == "<project_name>") & (Project.description == "<project_description>"))
for x in projects:
print(x)

Update a Project field

Use the update method to target and modify any updatable value for Project. For a complete list of updatable and non-updatable fields in the Project object, see the API reference.

project = client.get_project("<project_id>")
project.update(name="<new_project_name>", description="<new_description>")

Was this page helpful?

Project setup script

Datasets

Contact