The context represents the world.

Source Added
Link 0.1.6

Inherits AbstractEntity

Public Functions

Output Method
Instance .create_instance(str, **kwargs)

4 functions inherited from AbstractEntity


The context encapsulates one or more Instance's along with information about the current execution environment, such as the current user and time of day. Publishing is performed by iterating over the members of a context.

# Psuedo-code
for plugin in plugins:
  for instance in context:


# Creating a context
# The context is normally created for you by a user interface or
# through convenience functions, but can be helpful to manually
# create for debugging purposes.

import pyblish.api as pyblish
context = pyblish.Context()
# Creating instances from a context
# Instances can be created directly or through a context. When
# created through a context, the context is automatically set
# as the parent of the newly created instance.

import pyblish.api as pyblish
context = pyblish.Context()
instanceA = context.create_instance(name="MyInstanceA")
instanceB = pyblish.Instance(name="MyInstanceB", parent=context)

print("The context contains these instances:")
for instance in context:
# MyInstanceA
# MyInstanceB
# Setting data on a context
# Both Instance and Context inherit from AbstractEntity which
# provides the mechanism for modifying data.

import pyblish.api as pyblish
context = pyblish.Context()
data =["hostname"] = "localhost"
assert "hostname" in is True"hostname")
assert "hostname" in is False
Fri Sep 07 2018 07:46:00 GMT+0000 (UTC)

results matching ""

    No results matching ""