# Python API Documentation

**URL:** <https://forum.ansible.com/t/python-api-documentation/20395>\
**Category:** Ansible Developer\
**Created:** [January 31, 2016, 11:00pm UTC](https://forum.ansible.com/t/python-api-documentation/20395 "2016-01-31T23:00:50Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![Alexander\_Sauta](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Alexander\_Sauta](https://forum.ansible.com/u/Alexander_Sauta)\
**Post date:** [February 11, 2016, 5:16pm UTC](https://forum.ansible.com/t/python-api-documentation/20395/21 "2016-02-11T17:16:13Z")

</div>

Ok, got it, thank you for your reply.  
btw, why is it called stdout\_callback? What’s the difference/purpose between stdout\_callback and \_callback\_plugins in TQM?

Alexander.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [February 11, 2016, 5:21pm UTC](https://forum.ansible.com/t/python-api-documentation/20395/22 "2016-02-11T17:21:44Z")

</div>

Per it’s name, it was defined, to only load a single callback that defines itself as ‘stdout’. Generally speaking the name is designed around the idea that the bundled command line tools are the users of the API.

At minimum a “stdout” callback is required.

You can kind of think of it as the “default” callback. All other callbacks are in addition to this default callback.

---

<div class="post-metadata">

**Author:** ![Alexander\_Sauta](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Alexander\_Sauta](https://forum.ansible.com/u/Alexander_Sauta)\
**Post date:** [February 11, 2016, 5:30pm UTC](https://forum.ansible.com/t/python-api-documentation/20395/23 "2016-02-11T17:30:09Z")

</div>

Ok, thank you. So I’m gonna define all callback methods in \_stdout\_callback and this way I won’t need any other callback classes. That’s neat =)  
Thank you for your replies!

Alexander.

---

<div class="post-metadata">

**Author:** ![Phil\_Nelson](https://avatars.discourse-cdn.com/v4/letter/p/8e7dd6/32.png) [@Phil\_Nelson](https://forum.ansible.com/u/Phil_Nelson)\
**Post date:** [April 23, 2016, 7:42pm UTC](https://forum.ansible.com/t/python-api-documentation/20395/24 "2016-04-23T19:42:18Z")

</div>

The current thread warns that “only the plugin APIs are guaranteed to work from version to version,” and that the API generally “was not intended for direct use.”

I’ve written an extension to the stdout\_callback used in [roots/trellis](https://github.com/roots/trellis) to streamline some output and enable text colors in debug msgs.

However, I have decided not to merge the extension because it calls some Ansible modules in a way probably considered to be outside the plugin API. I figure my particular code poses a moderate risk that future Ansible updates could “break” our project for users. My extension’s features are merely “nice-to-have” and should only be included if the risk is very low.

If anyone cares to look, and thinks my code actually poses little risk, I would love to hear it.  
Here is the [PR and discussion](https://github.com/roots/trellis/pull/559), the [code](https://github.com/roots/trellis/commits/output-options) (see most recent 2 commits), and [docs](https://github.com/roots/docs/blob/trellis-output-options/trellis/cli-output.md) describing relevant features.

[Previous page](https://forum.ansible.com/t/python-api-documentation/20395.md?page=1)
