<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>How to package Buildbot plugins — Buildbot 0.8.12 documentation</title> <link rel="stylesheet" href="../_static/agogo.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '0.8.12', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="shortcut icon" href="../_static/buildbot.ico"/> <link rel="top" title="Buildbot 0.8.12 documentation" href="../index.html" /> <link rel="up" title="Buildbot Development" href="index.html" /> <link rel="next" title="Classes" href="classes.html" /> <link rel="prev" title="Metrics" href="metrics.html" /> </head> <body role="document"> <div class="header-wrapper" role="banner"> <div class="header"> <p class="logo"><a href="../index.html"> <img class="logo" src="../_static/header-text-transparent.png" alt="Logo"/> </a></p> <div class="headertitle"><a href="../index.html">Buildbot 0.8.12 documentation</a></div> <div class="rel" role="navigation" aria-label="related navigation"> <a href="metrics.html" title="Metrics" accesskey="P">previous</a> | <a href="classes.html" title="Classes" accesskey="N">next</a> | <a href="../py-modindex.html" title="Python Module Index" >modules</a> | <a href="../genindex.html" title="General Index" accesskey="I">index</a> </div> </div> </div> <div class="content-wrapper"> <div class="content"> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="how-to-package-buildbot-plugins"> <h1>How to package Buildbot plugins<a class="headerlink" href="#how-to-package-buildbot-plugins" title="Permalink to this headline">¶</a></h1> <p>If you customized an existing component (see <a class="reference internal" href="../manual/customization.html"><span class="doc">Customization</span></a>) or created a new component that you believe might be useful for others, you have two options:</p> <ul class="simple"> <li>submit the change to the Buildbot main tree, however you need to adhere to certain requirements (see <a class="reference internal" href="style.html"><span class="doc">Buildbot Coding Style</span></a>)</li> <li>prepare a Python package that contains the functionality you created</li> </ul> <p>Here we cover the second option.</p> <div class="section" id="package-the-source"> <h2>Package the source<a class="headerlink" href="#package-the-source" title="Permalink to this headline">¶</a></h2> <p>To begin with, you must package your changes. If you do not know what a Python package is, these two tutorials will get you going:</p> <ul class="simple"> <li><a class="reference external" href="https://packaging.python.org/en/latest/tutorial.html#creating-your-own-project">Installation and Packaging Tutorial</a></li> <li><a class="reference external" href="http://guide.python-distribute.org/index.html">The Hitchhiker’s Guide to Packaging</a></li> </ul> <p>The former is more recent and, while it addresses everything that you need to know about Python packages, is still work in progress. The latter is a bit dated, though it was the most complete guide for quite some time available for Python developers looking to package their software.</p> <p>You may also want to check the <a class="reference external" href="https://github.com/pypa/sampleproject">sample project</a>, which exemplifies the best Python packaging practices.</p> </div> <div class="section" id="making-the-plugin-package"> <h2>Making the plugin package<a class="headerlink" href="#making-the-plugin-package" title="Permalink to this headline">¶</a></h2> <p>Buildbot supports several kinds of pluggable components:</p> <ul class="simple"> <li><code class="docutils literal"><span class="pre">buildslave</span></code></li> <li><code class="docutils literal"><span class="pre">changes</span></code></li> <li><code class="docutils literal"><span class="pre">schedulers</span></code></li> <li><code class="docutils literal"><span class="pre">steps</span></code></li> <li><code class="docutils literal"><span class="pre">status</span></code></li> <li><code class="docutils literal"><span class="pre">util</span></code></li> </ul> <p>which are described in <a class="reference internal" href="../manual/plugins.html"><span class="doc">Plugin Infrastructure in Buildbot</span></a>.</p> <p>Once you have your component packaged, it's quite straightforward: you just need to add a few lines to the <code class="docutils literal"><span class="pre">entry_points</span></code> parameter of your call of <code class="docutils literal"><span class="pre">setup</span></code> function in <code class="file docutils literal"><span class="pre">setup.py</span></code> file:</p> <div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">setup</span><span class="p">(</span> <span class="o">...</span> <span class="n">entry_points</span> <span class="o">=</span> <span class="p">{</span> <span class="o">...</span><span class="p">,</span> <span class="s1">'buildbot.kind'</span><span class="p">:</span> <span class="p">[</span> <span class="s1">'PluginName = PluginModule:PluginClass'</span> <span class="p">]</span> <span class="p">},</span> <span class="o">...</span> <span class="p">)</span> </pre></div> </div> <p>(You might have seen different ways to specify the value for <code class="docutils literal"><span class="pre">entry_points</span></code>, however they all do the same thing. Full description of possible ways is available in <a class="reference external" href="http://pythonhosted.org/setuptools/setuptools.html#dynamic-discovery-of-services-and-plugins">setuptools documentation</a>.)</p> <p>After the <code class="file docutils literal"><span class="pre">setup.py</span></code> file is updated, you can build and install it:</p> <div class="highlight-bash"><div class="highlight"><pre><span></span>$ python setup.py build $ sudo python setup.py install </pre></div> </div> <p>(depending on your particular setup, you might not need to use <strong class="command">sudo</strong>).</p> <p>After that the plugin should be available for Buildbot and you can use it in your <code class="file docutils literal"><span class="pre">master.cfg</span></code> as:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">buildbot.kind</span> <span class="k">import</span> <span class="n">PluginName</span> <span class="o">...</span> <span class="n">PluginName</span> <span class="o">...</span> </pre></div> </div> </div> <div class="section" id="publish-the-package"> <h2>Publish the package<a class="headerlink" href="#publish-the-package" title="Permalink to this headline">¶</a></h2> <p>This is the last step before the plugin is available to others.</p> <p>Once again, there is a number of options available for you:</p> <ul class="simple"> <li>just put a link to your version control system</li> <li>prepare a source tarball with the plugin (<code class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">sdist</span></code>)</li> <li>or publish it on <a class="reference external" href="https://pypi.python.org">PyPI</a></li> </ul> <p>The last option is probably the best one since it will make your plugin available pretty much to all Python developers.</p> <p>Once you have published the package, please send a link to <a class="reference external" href="mailto:buildbot-devel%40lists.sourceforge.net">buildbot-devel</a> mailing list, so we can include a link to your plugin to <a class="reference internal" href="../manual/plugins.html"><span class="doc">Plugin Infrastructure in Buildbot</span></a>.</p> </div> </div> </div> </div> </div> </div> <div class="sidebar"> <h3>Table Of Contents</h3> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Buildbot Tutorial</a></li> <li class="toctree-l1"><a class="reference internal" href="../manual/index.html">Buildbot Manual</a></li> <li class="toctree-l1 current"><a class="reference internal" href="index.html">Buildbot Development</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="master-overview.html">Master Organization</a></li> <li class="toctree-l2"><a class="reference internal" href="definitions.html">Definitions</a></li> <li class="toctree-l2"><a class="reference internal" href="style.html">Buildbot Coding Style</a></li> <li class="toctree-l2"><a class="reference internal" href="tests.html">Buildbot's Test Suite</a></li> <li class="toctree-l2"><a class="reference internal" href="config.html">Configuration</a></li> <li class="toctree-l2"><a class="reference internal" href="utils.html">Utilities</a></li> <li class="toctree-l2"><a class="reference internal" href="database.html">Database</a></li> <li class="toctree-l2"><a class="reference internal" href="results.html">Build Result Codes</a></li> <li class="toctree-l2"><a class="reference internal" href="formats.html">File Formats</a></li> <li class="toctree-l2"><a class="reference internal" href="webstatus.html">Web Status</a></li> <li class="toctree-l2"><a class="reference internal" href="master-slave.html">Master-Slave API</a></li> <li class="toctree-l2"><a class="reference internal" href="encodings.html">String Encodings</a></li> <li class="toctree-l2"><a class="reference internal" href="metrics.html">Metrics</a></li> <li class="toctree-l2 current"><a class="current reference internal" href="#">How to package Buildbot plugins</a><ul class="simple"> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="classes.html">Classes</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="../relnotes/index.html">Release Notes for Buildbot 0.8.12</a></li> </ul> <div role="search"> <h3 style="margin-top: 1.5em;">Search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <div class="clearer"></div> </div> </div> <div class="footer-wrapper"> <div class="footer"> <div class="left"> <div role="navigation" aria-label="related navigaton"> <a href="metrics.html" title="Metrics" >previous</a> | <a href="classes.html" title="Classes" >next</a> | <a href="../py-modindex.html" title="Python Module Index" >modules</a> | <a href="../genindex.html" title="General Index" >index</a> </div> <div role="note" aria-label="source link"> <br/> <a href="../_sources/developer/plugins-publish.txt" rel="nofollow">Show Source</a> </div> </div> <div class="right"> <div class="footer" role="contentinfo"> © Copyright Buildbot Team Members. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.1. </div> </div> <div class="clearer"></div> </div> </div> </body> </html>