Copying a Project creates another Project with the same Ontology and settings. You also have the option to copy over the same users, datasets and models (which are not copied over by default).

The copy_project() method takes the following parameters, all of which are optional:

  • Copydatasets: when set to _True, the datasets from the original Project will be copied over and new tasks will be created from them.

  • Copycollaborators: when set to _True, the collaborators from the original Project will be copied over with their existing roles.

  • Copymodels: when set to _True, the models and their training data from the original Project will be copied over.

The parameters above are set to False by default, which means that they don't need to be included if a given feature shouldn't be copied to the new Project.

The copy_project() method returns the <project_hash> of the new project.

🚧

Caution

If collaborators are not copied, reviewer and label mapping settings are not copied over either.

👍

Tip

The project hash can be found within the URL once a project has been selected:
app.encord.com/projects/view/<project_hash>/summary

The sample code below demonstrates how to copy a Project in the most simple way.

# Import dependencies
from encord import EncordUserClient, Project

#Authenticate using the path to your private key
user_client = EncordUserClient.create_with_ssh_private_key(ssh_private_key_path="<private_key_path>")

# Specify the project you'd like to copy using its project hash
project = user_client.get_project("<project_hash>")

# Copy the project with attached datasets and collaborators, but without models
new_project_hash = project.copy_project(
    copy_datasets=True,
    copy_collaborators=True,
    copy_models=False,  # Not strictly needed
)
# Print the new project's hash
print(new_project_hash)


# the new project's <project_hash>
"046550d1-13fe-4052-ac99-e6a2d84f9b72" 

The sample code below demonstrates how to copy a project in a more advanced way.

# Import dependencies
from encord import EncordUserClient
from encord.orm.project import (
    CopyDatasetAction,
    CopyDatasetOptions,
    CopyLabelsOptions,
    ReviewApprovalState
)

#Authenticate using the path to your private key
user_client = EncordUserClient.create_with_ssh_private_key(ssh_private_key_path="<private_key_path>")

# Specify the project to be copied
project = user_client.get_project("<project_hash>")

# Copy the project
project.copy_project(
    new_title="foo",            #specify the new project's title
    new_description="bar",      #specify the new project's description
    copy_collaborators=True,    # specify whether project collaborators should be copied to the new project
    copy_datasets=CopyDatasetOptions(
        action=CopyDatasetAction.CLONE,  # This will also create a new dataset
        dataset_title="baz",    #specify the new dataset's title
        dataset_description="quz", # Specify the new dataset's description
        datasets_to_data_hashes_map={
            "<dataset_hash>": ["<data_hash_1", "<data_hash_2"]
        },
    ),
    copy_labels=CopyLabelsOptions(
        accepted_label_statuses=[ReviewApprovalState.APPROVED],     # Copy over all labels in the 'Approved' state.
        accepted_label_hashes=["<label_hash_1>", "<label_hash_2>"], # Copy over labels with the listed hashes.
    ),
)


# the new project's <project_hash>
"046550d1-13fe-4052-ac99-e6a2d84f9b72"