From 1c237f17f0c6ca5a1ca0223ec647b40e1fccfef1 Mon Sep 17 00:00:00 2001 From: Leon <82407168+sed-i@users.noreply.github.com> Date: Wed, 18 May 2022 17:54:13 -0400 Subject: [PATCH] Add REPL quickstart subsection --- docs/readme.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/readme.rst b/docs/readme.rst index d71151889..14f9ac8db 100644 --- a/docs/readme.rst +++ b/docs/readme.rst @@ -36,6 +36,7 @@ Installation Quickstart ---------- + 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: @@ -103,6 +104,25 @@ example, to run ``examples/connect_current_model.py``, use: tox -e example -- examples/connect_current_model.py +REPL +^^^^ + +To experiment with the library in a REPL, launch python in asyncio mode + +.. code:: bash + + $ python3 -m asyncio + +and then, to connect to the current model and fetch status: + +.. code:: + + >>> from juju.model import Model + >>> model = Model() + >>> await model.connect_current() + >>> status = await model.get_status() + + Versioning ----------