From 561a68b42d847d63606cd73a9bdf129590538a1b Mon Sep 17 00:00:00 2001 From: Tim Van Steenburgh Date: Fri, 1 Jul 2016 16:33:56 -0400 Subject: [PATCH] Update readme --- README.md | 38 +++++++++++++++++++++++++++----------- examples/fullstatus.py | 4 ++-- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 075a9ec..56508fb 100644 --- a/README.md +++ b/README.md @@ -2,26 +2,41 @@ A python library for Juju. -NOTE: There is no implementation here yet. It is simply a mocked out -design of what this library might look like. The design itself is not -complete. Comments on the design, good or bad, are welcomed. Use cases -are also appreciated as they will shape the design. +NOTE: This is early work-in-progress, pre-alpha software. There is very little +implementation here yet. The design itself is not complete. Comments on the +design, good or bad, are welcomed. Use cases are also appreciated as they will +shape the design. -The goal is to end up with a feature-full and officially supported -python library for Juju. +The goal is to end up with a feature-full and officially supported python +library for Juju. The focus right now is on Juju 2+ only. -# Design Ideas +# Design Notes -* Present an object-oriented interface to all the features of the Juju - CLI +* Require python3.5+ (async/await) and juju-2.0+ +* Auto-generate async (and sync? see below) websocket client from juju golang code +* Present an object-oriented interface to all the features of the Juju CLI * Do as much as possible through the API so that the library can be used - without actually installing Juju + without actually installing Juju + +# Implementation Status + +There is an async websocket client that is auto-generated (indirectly) from the +juju golang code so that the entire api is supported. This is mostly working. +There will probably a synchronous client as well because why not. + +On top of that will be an object-oriented layer that supports the full range of +operations that one could perform with the CLI (at least), which uses the +websocket client underneath but presents a friendlier interface. One advantage +of using an async client is that we can have a live-updating object layer, +where user code is informed of changes that are occurring to the underlying +juju model in real time. There is an example of what this might look like in +examples/livemodel.py. # Example Use Cases -Please add more! +See the `examples/` directory for some simple working examples. ## Simple bootstrap/deploy @@ -38,4 +53,5 @@ model.deploy('mediawiki-single') mediawiki = model.get_service('mediawiki') mediawiki.expose() + ``` diff --git a/examples/fullstatus.py b/examples/fullstatus.py index 55c86f8..fb50621 100644 --- a/examples/fullstatus.py +++ b/examples/fullstatus.py @@ -1,7 +1,7 @@ import asyncio from juju.client.connection import Connection -from juju.client.client import Client +from juju.client.client import ClientFacade loop = asyncio.get_event_loop() @@ -9,7 +9,7 @@ conn = loop.run_until_complete(Connection.connect_current()) async def status(): - client = Client() + client = ClientFacade() client.connect(conn) patterns = None -- 2.25.1