compas.plugins.plugin(method=None, category=None, requires=None, tryfirst=False, trylast=False, pluggable_name=None, domain='')[source]

Decorator to declare a plugin.

A plugin decorator marks a method as a plugin for a specified pluggable() extension point. Plugins are matched to their pluggable counterparts by a combination of the name of the plugin method, the category and the domain specified. These 3 parts form the extension point URL used for matching.

  • method (callable) – The method to decorate as plugin.

  • category (str, optional) – An optional string to group or categorize plugins.

  • requires (list of str, optional) – Optionally defines a list of packages that should be importable for this plugin to be used.

  • tryfirst (bool, optional) – Plugins can declare a preferred priority by setting this to True. By default False.

  • trylast (bool, optional) – Alternatively, a plugin can demote itself to be least preferable setting trylast to True. By default False.

  • pluggable_name (str, optional) – Usually, the name of the decorated plugin method matches that of the pluggable interface. When that is not the case, the pluggable name can be specified via this parameter.

  • domain (str, optional) – Domain name that “owns” the pluggable extension point. This is useful to disambiguate name collisions between extension points of different packages.