# Targets

Filter plug-ins by an arbitrary "target", such as `Global Assets`, `Local User`, `Animators`, `Everyone with Read Hair` etc.

This differs from `families` in that the caller provides the data, as opposed to the DCC. Useful for special-purpose GUIs or publishing tasks.

## Targets Workflow

This release enables assigning targets to plugins. Targets are registered globally so you can enable and disable plugins based on targets. This workflow helps when needing to run plugins from the same host but with different sets of plugins. Possible use cases could be submitting to a render farm, or publishing to a different location.

Targets work the same way as families, so a wildcard of `*` enables the plugin for all targets. Since all plugins are registered with `*` as targets, this workflow is backwards compatible with existing plugins that has not overwritten the targets attribute.

**Targets with `publish.util`**

```python
from pyblish import api, util


class plugin(api.ContextPlugin):
targets = ["custom"]

def process(self, context):
self.log.info("Custom target publishing.")


api.register_plugin(plugin)

util.publish(targets=["custom"])
```

### Example

```python
import pyblish.api
import pyblish.util

class StudioPlugin(pyblish.api.ContextPlugin):

    targets = ["studio"]

    def process(self, context):
        self.log.info("Publishing to studio library.")

class ProjectPlugin(pyblish.api.ContextPlugin):

    def process(self, context):
        self.log.info("Publishing to project library.")


pyblish.api.register_plugin(StudioPlugin)
pyblish.api.register_plugin(ProjectPlugin)

# Publishing with ProjectPlugin only.
pyblish.util.publish()

# Publishing with ProjectPlugin and StudioPlugin.
pyblish.api.register_target("studio")
pyblish.util.publish()
```

{{ file.mtime }}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.pyblish.com/data/targets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
