Skip to main content

Python library for Juju

Project description

Source code:

Bug reports:



  • Python 3.5+
  • Juju 2.0+

Design Notes

  • Asynchronous - uses asyncio and async/await features of python 3.5
  • Websocket-level bindings are programmatically generated (indirectly) from the Juju golang code, ensuring full api coverage
  • Provides an OO layer which encapsulates much of the websocket api and provides familiar nouns and verbs (e.g. Model.deploy(), Application.add_unit(), etc.)


pip install juju


Here’s a simple example that shows basic usage of the library. The example connects to the currently active Juju model, deploys a single unit of the ubuntu charm, then exits.

More examples can be found in the examples/ directory of the source tree, and in the documentation.


import asyncio
import logging

from juju.model import Model

async def run():
    # Create a Model instance. We need to connect our Model to a Juju api
    # server before we can use it.
    model = Model()

    # Connect to the currently active Juju model
    await model.connect_current()

    # Deploy a single unit of the ubuntu charm, using revision 0 from the
    # stable channel of the Charm Store.
    ubuntu_app = await model.deploy(

    # Disconnect from the api server and cleanup.

    # Stop the asyncio event loop.

def main():
    # Set logging level to debug so we can see verbose output from the
    # juju library.

    # Quiet logging from the websocket library. If you want to see
    # everything sent over the wire, set this to DEBUG.
    ws_logger = logging.getLogger('websockets.protocol')

    # Create the asyncio event loop
    loop = asyncio.get_event_loop()

    # Queue up our `run()` coroutine for execution

    # Start the event loop

if __name__ == '__main__':

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
juju-0.1.1.tar.gz (122.2 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page