Skip to main content

Beer-garden plugin and utility library

Project description

Brewtils

Brewtils is the Python library for interfacing with Beergarden systems. If you are planning on writing beer-garden plugins, this is the correct library for you. In addition to writing plugins, it provides simple ways to query the API and is officially supported by the beer-garden team.

Gitter PyPi Version Code Coverage

Features

Brewtils helps you interact with beer-garden.

  • Easy way to create beer-garden plugins
  • Full support of the entire Beer-Garden API
  • Officially supported by the beer-garden team

Installation

To install brewtils, run this command in your terminal:

$ pip install brewtils

Or add it to your requirements.txt

$ cat brewtils >> requirements.txt
$ pip install -r requirements.txt

Quick Start

You can create your own beer-garden plugins without much problem at all. To start, we'll create the obligatory hello-world plugin. Creating a plugin is as simple as:

from brewtils.decorators import system, parameter, command
from brewtils.plugin import RemotePlugin

@system
class HelloWorld(object):

    @parameter(key="message", description="The message to echo", type="String")
    def say_hello(self, message="World!"):
        print("Hello, %s!" % message)
        return "Hello, %s!" % message

if __name__ == "__main__":
    client = HelloWorld()
    plugin = RemotePlugin(client,
                            name="hello",
                            version="0.0.1",
                            bg_host='127.0.0.1',
                            bg_port=2337)
    plugin.run()

Assuming you have a Beer Garden running on port 2337 on localhost, running this will register and start your plugin! You now have your first plugin running in beer-garden. Let's use another part of the brewtils library to exercise your plugin from python.

The SystemClient is designed to help you interact with registered Systems as if they were native Python objects.

from brewtils.rest.system_client import SystemClient

hello_client = SystemClient('localhost', 2337, 'hello')

request = hello_client.say_hello(message="from system client")

print(request.status) # 'SUCCESS'
print(request.output) # Hello, from system client!

In the background, the SystemClient has executed an HTTP POST with the payload required to get beer-garden to execute your command. The SystemClient is how most people interact with beer-garden when they are in the context of python and want to be making requests.

Of course, the rest of the API is accessible through the brewtils package. The EasyClient provides simple convenient methods to call the API and auto-serialize the responses. Suppose you want to get a list of all the commands on all systems:

from brewtils.rest.easy_client import EasyClient

client = EasyClient('localhost', 2337)

systems = client.find_systems()

for system in systems:
    for command in system.commands:
        print(command.name)

This is just a small taste of what is possible with the EasyClient. Feel free to explore all the methods that are exposed.

For more detailed information and better walkthroughs, checkout the full documentation!

Documentation

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brewtils-3.33.0.tar.gz (108.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brewtils-3.33.0-py2.py3-none-any.whl (118.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file brewtils-3.33.0.tar.gz.

File metadata

  • Download URL: brewtils-3.33.0.tar.gz
  • Upload date:
  • Size: 108.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for brewtils-3.33.0.tar.gz
Algorithm Hash digest
SHA256 a53c881ee03b4f573e7bd06e5c94bc42d9930c7ddc9a4d5a2c020c5190624cdf
MD5 dc8160099b23282bfb9abec92e25dfa6
BLAKE2b-256 bd88a98f80207e1bd2983b1a68b0b05346e1079e0c111c137584f96861984795

See more details on using hashes here.

Provenance

The following attestation bundles were made for brewtils-3.33.0.tar.gz:

Publisher: tag-actions.yml on beer-garden/brewtils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brewtils-3.33.0-py2.py3-none-any.whl.

File metadata

  • Download URL: brewtils-3.33.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 118.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for brewtils-3.33.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7992c3329d30d222233ee40213a28cab605aa1b5d3827361ad54bbca5266d969
MD5 78be49e6a6986d394a199667023ef5d3
BLAKE2b-256 b3f027f4bde2bcd253836e36d79f3250e46984c2379f1efe231d62d375f059ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for brewtils-3.33.0-py2.py3-none-any.whl:

Publisher: tag-actions.yml on beer-garden/brewtils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page