Available to Instance and Context objects and used to pass data between library and plug-ins.


Data is primarily gathered during Collection and used during subsequent plug-ins, such as Validation and Extraction. Data can also be used as a means of messaging across plug-ins.

Naming Convention

Data members are using mixedCase.


instance.data["snake_case_is_for_python"] = True
instance.data["CamelCaseIsForClasses"] = False


instance.data["myVariable"] = True
instance.data["longName"] = 42
instance.data["veryLongVariable"] = 5

The motivation is to separate between what is Python and what is Pyblish data.


import pyblish.api as pyblish
context = pyblish.Context()
context.data["myData"] = "myValue"

instance = pyblish.Instance(name="MyInstance", parent=context)
instance.data["range"] = [0, 120]
instance.data["active"] = False

Data of any type may be added, including complex objects.

# Custom objects

import pyblish.api

class MyCustomChild(object):
   def __init__(self, name):
      self.name = name

instance = pyblish.api.Instance(name="Car")

MyCustomType = type("MyCustomType", (object,), {})

owner = MyCustomType()
owner.value = "John Doe"
make = MyCustomType()
make.value = "Ford"

instance.data["owner"] = owner
instance.data["make"] = make
instance.data["miles"] = "123"
Fri Aug 18 2017 08:16:29 GMT+0000 (UTC)

results matching ""

    No results matching ""