Skip to content

Commit

Permalink
Merge pull request #676 from sed-i/patch-1
Browse files Browse the repository at this point in the history
#676

This PR adds a short section to the readme describing how to use the library directly in a REPL.
  • Loading branch information
jujubot authored Jun 10, 2022
2 parents 1c05345 + 1c237f1 commit bd9490d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
----------

Expand Down

0 comments on commit bd9490d

Please sign in to comment.