rez.plugin_managers#

Manages loading of all types of Rez plugins.

rez.plugin_managers.extend_path(path, name)#

Extend a package’s path.

Intended use is to place the following code in a package’s __init__.py:

from pkgutil import extend_path __path__ = extend_path(__path__, __name__)

This will add to the package’s __path__ all subdirectories of directories on ‘config.plugin_path’ named after the package. This is useful if one wants to distribute different parts of a single logical package as multiple directories.

If the input path is not a list (as is the case for frozen packages) it is returned unchanged. The input path is not modified; an extended copy is returned. Items are only appended to the copy at the end.

It is assumed that ‘plugin_path’ is a sequence. Items of ‘plugin_path’ that are not (unicode or 8-bit) strings referring to existing directories are ignored. Unicode items of sys.path that cause errors when used as filenames may cause this function to raise an exception (in line with os.path.isdir() behavior).

rez.plugin_managers.uncache_rezplugins_module_paths(instance=None)#
class rez.plugin_managers.RezPluginType#

Bases: object

An abstract base class representing a single type of plugin.

‘type_name’ must correspond with one of the source directories found under the ‘plugins’ directory.

type_name = None#
__init__()#
register_plugin(plugin_name, plugin_class, plugin_module)#
load_plugins()#
get_plugin_class(plugin_name)#

Returns the class registered under the given plugin name.

get_plugin_module(plugin_name)#

Returns the module containing the plugin of the given name.

config_schema()#

Returns the merged configuration data schema for this plugin type.

create_instance(plugin, **instance_kwargs)#

Create and return an instance of the given plugin.

class rez.plugin_managers.RezPluginManager#

Bases: object

Primary interface for working with registered plugins.

Custom plugins are organized under a python package named ‘rezplugins’. The direct sub-packages of ‘rezplugins’ are the plugin types supported by rez, and the modules below that are individual custom plugins extending that type.

For example, rez provides plugins of type ‘build_system’: ‘cmake’ and ‘make’:

rezplugins/
  __init__.py
  build_system/
    __init__.py
    cmake.py
    make.py
  ...

Here is an example of how to provide your own plugin. In the example, we’ll be adding a plugin for the SCons build system.

  1. Create the ‘rezplugins/build_system’ directory structure, add the empty ‘__init__.py’ files, and then place your new ‘scons.py’ plugin module into the ‘build_system’ sub-package:

    rezplugins/
      __init__.py
      build_system/
        __init__.py
        scons.py
    
  2. Write your ‘scons.py’ plugin module, sub-classing your SConsBuildSystem class from rez.build_systems.BuildSystem base class.

    At the bottom of the module add a register_plugin function that returns your plugin class:

    def register_plugin():
        return SConsBuildSystem
    
3 Set or append the rez config setting plugin_path to point to the

directory above your ‘rezplugins’ directory.

All ‘rezplugin’ packages found on the search path will all be merged into a single python package.

Note:

Even though ‘rezplugins’ is a python package, your sparse copy of it should not be on the PYTHONPATH, just the REZ_PLUGIN_PATH. This is important because it ensures that rez’s copy of ‘rezplugins’ is always found first.

__init__()#
rezplugins_module_paths()#
register_plugin_type(type_class)#
get_plugin_types()#

Return a list of the registered plugin types.

get_plugins(plugin_type)#

Return a list of the registered names available for the given plugin type.

get_plugin_class(plugin_type, plugin_name)#

Return the class registered under the given plugin name.

get_plugin_module(plugin_type, plugin_name)#

Return the module defining the class registered under the given plugin name.

get_plugin_config_data(plugin_type)#

Return the merged configuration data for the plugin type.

get_plugin_config_schema(plugin_type)#
get_failed_plugins(plugin_type)#

Return a list of plugins for the given type that failed to load.

Returns:

List of 2-tuples: name (str): Name of the plugin. reason (str): Error message.

Return type:

tuple

create_instance(plugin_type, plugin_name, **instance_kwargs)#

Create and return an instance of the given plugin.

get_summary_string()#

Get a formatted string summarising the plugins that were loaded.

class rez.plugin_managers.ShellPluginType#

Bases: RezPluginType

Support for different types of target shells, such as bash, tcsh.

type_name = 'shell'#
__init__()#
config_schema()#

Returns the merged configuration data schema for this plugin type.

create_instance(plugin, **instance_kwargs)#

Create and return an instance of the given plugin.

get_plugin_class(plugin_name)#

Returns the class registered under the given plugin name.

get_plugin_module(plugin_name)#

Returns the module containing the plugin of the given name.

load_plugins()#
register_plugin(plugin_name, plugin_class, plugin_module)#
class rez.plugin_managers.ReleaseVCSPluginType#

Bases: RezPluginType

Support for different version control systems when releasing packages.

type_name = 'release_vcs'#
__init__()#
config_schema()#

Returns the merged configuration data schema for this plugin type.

create_instance(plugin, **instance_kwargs)#

Create and return an instance of the given plugin.

get_plugin_class(plugin_name)#

Returns the class registered under the given plugin name.

get_plugin_module(plugin_name)#

Returns the module containing the plugin of the given name.

load_plugins()#
register_plugin(plugin_name, plugin_class, plugin_module)#
class rez.plugin_managers.ReleaseHookPluginType#

Bases: RezPluginType

Support for different version control systems when releasing packages.

type_name = 'release_hook'#
__init__()#
config_schema()#

Returns the merged configuration data schema for this plugin type.

create_instance(plugin, **instance_kwargs)#

Create and return an instance of the given plugin.

get_plugin_class(plugin_name)#

Returns the class registered under the given plugin name.

get_plugin_module(plugin_name)#

Returns the module containing the plugin of the given name.

load_plugins()#
register_plugin(plugin_name, plugin_class, plugin_module)#
class rez.plugin_managers.BuildSystemPluginType#

Bases: RezPluginType

Support for different build systems when building packages.

type_name = 'build_system'#
__init__()#
config_schema()#

Returns the merged configuration data schema for this plugin type.

create_instance(plugin, **instance_kwargs)#

Create and return an instance of the given plugin.

get_plugin_class(plugin_name)#

Returns the class registered under the given plugin name.

get_plugin_module(plugin_name)#

Returns the module containing the plugin of the given name.

load_plugins()#
register_plugin(plugin_name, plugin_class, plugin_module)#
class rez.plugin_managers.PackageRepositoryPluginType#

Bases: RezPluginType

Support for different package repositories for loading packages.

type_name = 'package_repository'#
__init__()#
config_schema()#

Returns the merged configuration data schema for this plugin type.

create_instance(plugin, **instance_kwargs)#

Create and return an instance of the given plugin.

get_plugin_class(plugin_name)#

Returns the class registered under the given plugin name.

get_plugin_module(plugin_name)#

Returns the module containing the plugin of the given name.

load_plugins()#
register_plugin(plugin_name, plugin_class, plugin_module)#
class rez.plugin_managers.BuildProcessPluginType#

Bases: RezPluginType

Support for different build and release processes.

type_name = 'build_process'#
__init__()#
config_schema()#

Returns the merged configuration data schema for this plugin type.

create_instance(plugin, **instance_kwargs)#

Create and return an instance of the given plugin.

get_plugin_class(plugin_name)#

Returns the class registered under the given plugin name.

get_plugin_module(plugin_name)#

Returns the module containing the plugin of the given name.

load_plugins()#
register_plugin(plugin_name, plugin_class, plugin_module)#
class rez.plugin_managers.CommandPluginType#

Bases: RezPluginType

Support for different custom Rez applications/subcommands.

type_name = 'command'#
__init__()#
config_schema()#

Returns the merged configuration data schema for this plugin type.

create_instance(plugin, **instance_kwargs)#

Create and return an instance of the given plugin.

get_plugin_class(plugin_name)#

Returns the class registered under the given plugin name.

get_plugin_module(plugin_name)#

Returns the module containing the plugin of the given name.

load_plugins()#
register_plugin(plugin_name, plugin_class, plugin_module)#