The publisher provides some utility methods that are generally useful for writing publish plugins that aren’t driven by templates. These methods are used by the basic Shotgun integration to infer information from file paths when templates are not available. This includes version and frame number identification, publish display name, image sequence paths, etc.


These utility methods are exposed via the publisher’s util module, but the implementation for most of them lives within the app’s path_info hook. Studios can override these path processing methods to account for their own naming conventions and path structures.

The utilty method are documented below:

tk_multi_publish2.util.get_version_path(path, version)[source]

Given a path without a version number, return the path with the supplied version number.

If a version number is detected in the supplied path, the path will be returned as-is.

  • path – The path to inject a version number.
  • version – The version number to inject.

The modified path with the supplied version number inserted.


Given a file path, return a path to the next version.

This is typically used by auto-versioning logic in plugins that need to save the current work file to the next version number.

If no version can be identified in the supplied path, None will be returned, indicating that the next version path can’t be determined.

Parameters:path – The path to a file, likely one to be published.
Returns:The path to the next version of the supplied path.

Convenience method for determining file components for a given path.

Parameters:path (str) – The path to the file to componentize.

Returns file path components in the form:

# path="/path/to/the/file/my_file.v001.ext"

    "path": "/path/to/the/file/my_file.v001.ext",
    "folder": "/path/to/the/file" ,
    "filename": "my_file.v001.ext",
    "extension": "ext",

# path="/path/to/the/folder"

    "path": "/path/to/the/folder",
    "folder": "/path/to/the" ,
    "filename": "folder",
    "extension": None,
tk_multi_publish2.util.get_frame_sequence_path(path, frame_spec=None)[source]

Given a path with a frame number, return the sequence path where the frame number is replaced with a given frame specification such as {FRAME} or %04d or $F.

  • path – The input path with a frame number
  • frame_spec – The frame specification to replace the frame number with.

The full frame sequence path

tk_multi_publish2.util.get_frame_sequences(folder, extensions=None, frame_spec=None)[source]

Given a folder, inspect the contained files to find what appear to be files with frame numbers.

  • folder – The path to a folder potentially containing a sequence of files.
  • extensions – A list of file extensions to retrieve paths for. If not supplied, the extension will be ignored.
  • frame_spec – A string to use to represent the frame number in the return sequence path.

A list of tuples for each identified frame sequence. The first item in the tuple is a sequence path with the frame number replaced with the supplied frame specification. If no frame spec is supplied, a python string format spec will be returned with the padding found in the file.


    ["exr", "jpg"],

        [<frame_1_path>, <frame_2_path>, ...]
        [<frame_1_path>, <frame_2_path>, ...]

tk_multi_publish2.util.get_publish_name(path, sequence=False)[source]

Given a file path, return the display name to use for publishing.

Typically, this is a name where the path and any version number are removed in order to keep the publish name consistent as subsequent versions are published.


in: /path/to/the/file/my_file.v001.jpg
out: my_file.jpg
  • path – The path to a file, likely one to be published.
  • sequence – If True, treat the path as a sequence name and replace the frame number with placeholder

A publish display name for the provided path.


Extract a version number from the supplied path.

This is used by plugins that need to know what version number to associate with the file when publishing.


in: /path/to/the/file/my_file.v001.jpg
out: 1
Parameters:path – The path to a file, likely one to be published.
Returns:An integer representing the version number in the supplied path. If no version found, None will be returned.