SG default entities

This module collects all default pyshotgrid custom entities.

class pyshotgrid.sg_default_entities.SGProject(sg, entity_id, entity_type=None)[source]

Bases: SGEntity

An instance of this class represents a single Project entity in ShotGrid.

Note

Try to avoid creating instances of this class in production code and use the pyshotgrid.new_entity method instead. This will make sure that you always get the correct entity class to work with.

DEFAULT_SG_ENTITY_TYPE: Optional[str] = 'Project'

The SG entity type that will be used when you do not specify it in the init arguments. For the base SGEntity this should always be None, but for sub classes this should be set to the SG entity type that the class should represent.

property name: Field
Returns:

The field that represents the name of the Project.

shots(glob_pattern=None)[source]
Parameters:

glob_pattern (Optional[str]) – A glob to match the shots to return. For example TEST_01_* would return all shots that start with TEST_01_.

Return type:

list[SGEntity]

Returns:

All the shots from this project.

assets(glob_pattern=None)[source]
Parameters:

glob_pattern (Optional[str]) – A glob to match the assets to return. For example TEST_* would return all assets that start with TEST_.

Return type:

list[SGEntity]

Returns:

All the assets from this project.

publishes(pub_types=None, latest=False)[source]
Parameters:
  • pub_types (Union[str, list[str], None]) – The names of the Publish File Types to return.

  • latest (bool) –

    Whether to get the “latest” publishes or not. This uses the same logic as the tk-multi-loader2 app which is as follows:

    • group all publishes with the same “name” field together

    • from these get the publishes with the highest “version_number” field

    • if there are publishes with the same “name” and “version_number” the newest one wins.

Return type:

list[SGEntity]

Returns:

All published files from this project.

people(only_active=True)[source]
Parameters:

only_active (bool) – Whether to list only active people or all the people.

Return type:

list[SGEntity]

Returns:

All HumanUsers assigned to this project.

playlists()[source]
Return type:

list[SGEntity]

Returns:

All playlists attached to this project.

versions(user=None, pipeline_step=None, latest=False)[source]
Parameters:
Return type:

list[SGEntity]

Returns:

A list of Versions

class pyshotgrid.sg_default_entities.SGShot(sg, entity_id, entity_type=None)[source]

Bases: SGEntity

An instance of this class represents a single Shot entity in ShotGrid.

Note

Try to avoid creating instances of this class in production code and use the pyshotgrid.new_entity method instead. This will make sure that you always get the correct entity class to work with.

DEFAULT_SG_ENTITY_TYPE: Optional[str] = 'Shot'

The SG entity type that will be used when you do not specify it in the init arguments. For the base SGEntity this should always be None, but for sub classes this should be set to the SG entity type that the class should represent.

property name: Field
Returns:

The field that represents the name of the Shot.

publishes(pub_types=None, latest=False)[source]
Parameters:
  • pub_types (Union[str, list[str], None]) – The names of the Publish File Types to return.

  • latest (bool) –

    Whether to get the “latest” publishes or not. This uses the same logic as the tk-multi-loader2 app which is as follows:

    • group all publishes with the same “name” field together

    • from these get the publishes with the highest “version_number” field

    • if there are publishes with the same “name” and “version_number” the newest one wins.

Return type:

list[SGEntity]

Returns:

All published files from this shot.

tasks(names=None, assignee=None, pipeline_step=None)[source]
Parameters:
Return type:

list[SGEntity]

Returns:

A list of Tasks.

versions(user=None, pipeline_step=None, latest=False)[source]
Parameters:
Return type:

list[SGEntity]

Returns:

A list of Versions

class pyshotgrid.sg_default_entities.SGAsset(sg, entity_id, entity_type=None)[source]

Bases: SGEntity

An instance of this class represents a single Asset entity in ShotGrid.

Note

Try to avoid creating instances of this class in production code and use the pyshotgrid.new_entity method instead. This will make sure that you always get the correct entity class to work with.

DEFAULT_SG_ENTITY_TYPE: Optional[str] = 'Asset'

The SG entity type that will be used when you do not specify it in the init arguments. For the base SGEntity this should always be None, but for sub classes this should be set to the SG entity type that the class should represent.

property name: Field
Returns:

The field that represents the name of the Asset.

publishes(pub_types=None, latest=False)[source]
Parameters:
  • pub_types (Union[str, list[str], None]) – The names of the Publish File Types to return.

  • latest (bool) –

    Whether to get the “latest” publishes or not. This uses the same logic as the tk-multi-loader2 app which is as follows:

    • group all publishes with the same “name” field together

    • from these get the publishes with the highest “version_number” field

    • if there are publishes with the same “name” and “version_number” the newest one wins.

Return type:

list[SGEntity]

Returns:

All published files from this asset.

tasks(names=None, assignee=None, pipeline_step=None)[source]
Parameters:
Return type:

list[SGEntity]

Returns:

A list of Tasks.

versions(user=None, pipeline_step=None, latest=False)[source]
Parameters:
Return type:

list[SGEntity]

Returns:

A list of Versions

class pyshotgrid.sg_default_entities.SGTask(sg, entity_id, entity_type=None)[source]

Bases: SGEntity

An instance of this class represents a single Task entity in ShotGrid.

Note

Try to avoid creating instances of this class in production code and use the pyshotgrid.new_entity method instead. This will make sure that you always get the correct entity class to work with.

DEFAULT_SG_ENTITY_TYPE: Optional[str] = 'Task'

The SG entity type that will be used when you do not specify it in the init arguments. For the base SGEntity this should always be None, but for sub classes this should be set to the SG entity type that the class should represent.

property name: Field
Returns:

The field that represents the name of the Task.

publishes(pub_types=None, latest=False)[source]
Parameters:
  • pub_types (Union[str, list[str], None]) – The names of the Publish File Types to return.

  • latest (bool) –

    Whether to get the “latest” publishes or not. This uses the same logic as the tk-multi-loader2 app which is as follows:

    • group all publishes with the same “name” field together

    • from these get the publishes with the highest “version_number” field

    • if there are publishes with the same “name” and “version_number” the newest one wins.

Return type:

list[SGEntity]

Returns:

All published files from this shot.

versions(user=None, pipeline_step=None, latest=False)[source]
Parameters:
Return type:

list[SGEntity]

Returns:

A list of Versions

class pyshotgrid.sg_default_entities.SGPublishedFile(sg, entity_id, entity_type=None)[source]

Bases: SGEntity

An instance of this class represents a single PublishedFile entity in ShotGrid.

Note

Try to avoid creating instances of this class in production code and use the pyshotgrid.new_entity method instead. This will make sure that you always get the correct entity class to work with.

DEFAULT_SG_ENTITY_TYPE: Optional[str] = 'PublishedFile'

The SG entity type that will be used when you do not specify it in the init arguments. For the base SGEntity this should always be None, but for sub classes this should be set to the SG entity type that the class should represent.

property name: Field
Returns:

The field that represents the name of the PublishedFile.

is_latest()[source]
Return type:

bool

Returns:

Whether this published file is the latest of its kind.

get_latest()[source]
Return type:

SGEntity

Returns:

The latest published file of its kind (which might be this same entity).

get_next_publishes()[source]
Return type:

list[SGEntity]

Returns:

The next publishes after this publish.

get_previous_publishes()[source]
Return type:

list[SGEntity]

Returns:

The previous publishes before this publish.

get_all_publishes()[source]
Return type:

list[SGEntity]

Returns:

A list of all the published file versions from lowest to highest version number.

class pyshotgrid.sg_default_entities.SGVersion(sg, entity_id, entity_type=None)[source]

Bases: SGEntity

An instance of this class represents a single Version entity in ShotGrid.

Note

Try to avoid creating instances of this class in production code and use the pyshotgrid.new_entity method instead. This will make sure that you always get the correct entity class to work with.

DEFAULT_SG_ENTITY_TYPE: Optional[str] = 'Version'

The SG entity type that will be used when you do not specify it in the init arguments. For the base SGEntity this should always be None, but for sub classes this should be set to the SG entity type that the class should represent.

property name: Field
Returns:

The field that represents the name of the Version.

class pyshotgrid.sg_default_entities.SGPlaylist(sg, entity_id, entity_type=None)[source]

Bases: SGEntity

An instance of this class represents a single Playlist entity in ShotGrid.

Note

Try to avoid creating instances of this class in production code and use the pyshotgrid.new_entity method instead. This will make sure that you always get the correct entity class to work with.

DEFAULT_SG_ENTITY_TYPE: Optional[str] = 'Playlist'

The SG entity type that will be used when you do not specify it in the init arguments. For the base SGEntity this should always be None, but for sub classes this should be set to the SG entity type that the class should represent.

property name: Field
Returns:

The field that represents the name of the Playlist.

property media_url: str
Returns:

The Media center URL for this playlist.

Raises:
RuntimeError:

When this playlist is not attached to a project.

class pyshotgrid.sg_default_entities.SGHumanUser(sg, entity_id, entity_type=None)[source]

Bases: SGEntity

An instance of this class represents a single HumanUser entity in ShotGrid.

Note

Try to avoid creating instances of this class in production code and use the pyshotgrid.new_entity method instead. This will make sure that you always get the correct entity class to work with.

DEFAULT_SG_ENTITY_TYPE: Optional[str] = 'HumanUser'

The SG entity type that will be used when you do not specify it in the init arguments. For the base SGEntity this should always be None, but for sub classes this should be set to the SG entity type that the class should represent.

property name: Field
Returns:

The field that represents the name of the HumanUser.

versions(entity=None, pipeline_step=None, latest=False)[source]
Parameters:
  • entity (Union[dict[str, Any], SGEntity, None]) – entity to filter by eg. (Shot, Asset, Project, Task…).

  • pipeline_step (Union[str, dict[str, Any], SGEntity, None]) – Name, short name or entity object or the Pipeline Step to filter by.

  • latest (bool) – Whether to return only the latest Version per link/entity.

Return type:

list[SGEntity]

Returns:

A list of Versions

tasks(names=None, entity=None, pipeline_step=None)[source]
Parameters:
Return type:

list[SGEntity]

Returns:

A list of Tasks

publishes(pub_types=None, latest=False)[source]
Parameters:
  • pub_types (Union[str, list[str], None]) – The names of the Publish File Types to return.

  • latest (bool) –

    Whether to get the “latest” publishes or not. This uses the same logic as the tk-multi-loader2 app which is as follows:

    • group all publishes with the same “name” field together

    • from these get the publishes with the highest “version_number” field

    • if there are publishes with the same “name” and “version_number” the newest one wins.

Return type:

list[SGEntity]

Returns:

All published files from this shot.