> For the complete documentation index, see [llms.txt](https://learn.pyblish.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.pyblish.com/15-report-i.md).

# Report I

Publishing is about finding problems and the only way to find them is by bringing them to the surface, to visualise them. So in this example, we'll have a look at how you can do just that.

We can use the results produced during publishing to pretty-print ourselves a report of how things went. This is what we will be producing in this example.

```bash
Success   Plug-in                                   -> Instance
----------------------------------------------------------------------
1         CollectCaptainAmerica                     -> None
0         ValidateCaptainAmerica                    -> Captain America
```

Let's dive into the plug-ins now.

```python
import pyblish.api

class CollectCaptainAmerica(pyblish.api.ContextPlugin):
  order = pyblish.api.CollectorOrder

  def process(self, context):
    context.create_instance("Captain America", isHero=False)

class ValidateCaptainAmerica(pyblish.api.InstancePlugin):
  order = pyblish.api.ValidatorOrder

  def process(self, instance):
    # Any raised exception will mark a plug-in as failed
    assert instance.data.get("isHero") == True, "%s must be a hero" % instance

pyblish.api.register_plugin(CollectCaptainAmerica)
pyblish.api.register_plugin(ValidateCaptainAmerica)

import pyblish.util
context = pyblish.util.publish()
```

With `context` at hand, we can now format the results using the `results` dictionary stored within.

```python
results = context.data.get("results")
header = "{:<10}{:<40} -> {}".format("Success", "Plug-in", "Instance")
result = "{success:<10}{plugin.__name__:<40} -> {instance}"
results = "\n".join(result.format(**r) for r in results)
report = """
{header}
{line}
{results}
"""
print(report.format(header=header,
                    results=results,
                    line="-" * 70))
```

The actual output is this.

```bash
Success   Plug-in                                   -> Instance
----------------------------------------------------------------------
1         CollectCurrentWorkingDirectory            -> None
1         CollectCaptainAmerica                     -> None
1         CollectCurrentUser                        -> None
0         ValidateCaptainAmerica                    -> Captain America
```

The plug-ins `CollectCurrentWorkingDirectory` and `CollectCurrentUser` are included by default with Pyblish and adds the following data to the context.

```yaml
cwd: The current working directory at the time of publish
user: The currently logged on user
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://learn.pyblish.com/15-report-i.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.
