Skip to content

Writing Integrations

Marcus Ottosson edited this page May 20, 2015 · 3 revisions

This article summarises best practises for developing integrations of Pyblish into hosts, such as Autodesk Maya and SideFx Houdini.




Introduction

An integration, as opposed to an Extension, is distinguished by providing a host with access to Pyblish facilities, such as launching it's user interface.

Each integration must provide a series of selectors that append data common amongst integrations.

Key Value
currentFile The currently opened file
currentWorkspace Optional and where relevant, the currently opened workspace or project

Example

# pyblish-maya/select_current_file.py
import os
import pyblish.api
from maya import cmds

@pyblish.api.log
class SelectCurrentFile(pyblish.api.Selector):
    """Inject the current working file into context."""

    hosts = ['maya']

    def process_context(self, context):
        """Todo, inject the current working file"""
        current_file = cmds.file(sceneName=True, query=True)

        # Maya returns forward-slashes by default
        normalised = os.path.normpath(current_file)

        context.set_data('currentFile', value=normalised)



Naming Convention

Any integration with Pyblish must be prefixed with pyblish- and it's inner Python package with pyblish_.

Directory Layout

Integrations conform to a standard Python distribution directory layout, adopted from setuptools.

pyblish-<hostname>
├── README
├── setup.py
├── pyblish_<hostname>
│   ├── plugins
│   │   └── <plugin>.py
│   └── __init__.py
└── tests
    ├── __init__.py
    └── <test>.py

For example.

pyblish-maya
├── README
├── setup.py
├── pyblish_maya
│   ├── plugins
│   │   └── select_current_file.py
│   └── __init__.py
└── tests
    ├── __init__.py
    └── test_selectors.py

Language, software and platform agnostic, feature film-strength quality assurance for content.

Table of contents

Architecture

Developer Resources

Strategies

More

Community

Clone this wiki locally