Skip to content

Commit bd9490d

Browse files
authored
Merge pull request #676 from sed-i/patch-1
#676 This PR adds a short section to the readme describing how to use the library directly in a REPL.
2 parents 1c05345 + 1c237f1 commit bd9490d

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

docs/readme.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Installation
3636
3737
Quickstart
3838
----------
39+
3940
Here's a simple example that shows basic usage of the library. The example
4041
connects to the currently active Juju model, deploys a single unit of the
4142
ubuntu charm, then exits:
@@ -103,6 +104,25 @@ example, to run ``examples/connect_current_model.py``, use:
103104
tox -e example -- examples/connect_current_model.py
104105
105106
107+
REPL
108+
^^^^
109+
110+
To experiment with the library in a REPL, launch python in asyncio mode
111+
112+
.. code:: bash
113+
114+
$ python3 -m asyncio
115+
116+
and then, to connect to the current model and fetch status:
117+
118+
.. code::
119+
120+
>>> from juju.model import Model
121+
>>> model = Model()
122+
>>> await model.connect_current()
123+
>>> status = await model.get_status()
124+
125+
106126
Versioning
107127
----------
108128

0 commit comments

Comments
 (0)