Skip to content

Commit

Permalink
[Release] Update the examples
Browse files Browse the repository at this point in the history
  • Loading branch information
reboot-dev-bot committed Oct 2, 2023
1 parent eb3ced0 commit ca4fcc2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,19 @@ git clone https://github.com/reboot-dev/resemble-examples.git
cd resemble-examples/
```



### Create and activate a virtual environment

Create a new Python virtual environment in which to install Resemble
requirements and run an application:

<!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./readme_test.sh&lines=32-33) -->
<!-- The below code snippet is automatically added from ./readme_test.sh -->

```sh
python -m venv ./.hello-world-venv
source ./.hello-world-venv/bin/activate
```

<!-- MARKDOWN-AUTO-DOCS:END -->

To learn more about why virtual environments are a best practice for Python
Expand All @@ -149,9 +149,11 @@ Resemble definitions, and the `grpcio-tools` package that provides `protoc`.

<!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./readme_test.sh&lines=39-39) -->
<!-- The below code snippet is automatically added from ./readme_test.sh -->

```sh
pip install reboot-resemble-cli
```

<!-- MARKDOWN-AUTO-DOCS:END -->

## Run an Example
Expand All @@ -167,9 +169,11 @@ command will install requirements for the `hello-constructors` application.

<!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./readme_test.sh&lines=52-52) -->
<!-- The below code snippet is automatically added from ./readme_test.sh -->

```sh
pip install -r hello-constructors/backend/src/requirements.txt
```

<!-- MARKDOWN-AUTO-DOCS:END -->

### Compile Protocol Buffers
Expand All @@ -179,9 +183,11 @@ definition of a service.

<!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./readme_test.sh&lines=55-55) -->
<!-- The below code snippet is automatically added from ./readme_test.sh -->

```sh
rsm protoc
```

<!-- MARKDOWN-AUTO-DOCS:END -->

The `rsm` tool will automatically pull in required Resemble proto dependencies
Expand All @@ -197,9 +203,11 @@ use `pytest`, for example:

<!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./readme_test.sh&lines=58-58) -->
<!-- The below code snippet is automatically added from ./readme_test.sh -->

```sh
pytest hello-constructors/backend/
```

<!-- MARKDOWN-AUTO-DOCS:END -->

## Run
Expand Down
6 changes: 4 additions & 2 deletions hello-constructors/backend/src/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
import logging
from hello_constructors.v1.greeter_rsm import Greeter, GreetResponse
from greeter_servicer import GreeterServicer
from hello_constructors.v1.greeter_rsm import Greeter, GreetResponse
from resemble.aio.applications import Application
from resemble.aio.workflows import Workflow

Expand All @@ -17,7 +17,9 @@ async def initialize(workflow: Workflow):
await greeter.Create(workflow, greeting="Hello")

# Demonstrate that we can use the actor.
response: GreetResponse = await greeter.Greet(workflow, name="Constructors")
response: GreetResponse = await greeter.Greet(
workflow, name="Constructors"
)
logging.info(f"Received a greeting: '{response.message}'")


Expand Down
6 changes: 4 additions & 2 deletions hello-constructors/backend/tests/greeter_servicer_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from hello_constructors.v1.greeter_rsm import Greeter, GreetResponse
from greeter_servicer import GreeterServicer
from hello_constructors.v1.greeter_rsm import Greeter, GreetResponse
from resemble.aio.tests import Resemble
from resemble.aio.workflows import Workflow

Expand All @@ -25,5 +25,7 @@ async def test_hello_constructors(self) -> None:
# before other methods can be called on it.
await greeter.Create(workflow, greeting="Hello")

response: GreetResponse = await greeter.Greet(workflow, name="Constructors")
response: GreetResponse = await greeter.Greet(
workflow, name="Constructors"
)
self.assertEqual(response.message, "Hello, Constructors")
2 changes: 1 addition & 1 deletion hello-world/backend/src/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
import logging
from hello_world.v1.greeter_rsm import Greeter, GreetResponse
from greeter_servicer import GreeterServicer
from hello_world.v1.greeter_rsm import Greeter, GreetResponse
from resemble.aio.applications import Application
from resemble.aio.workflows import Workflow

Expand Down
2 changes: 1 addition & 1 deletion hello-world/backend/tests/greeter_servicer_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from hello_world.v1.greeter_rsm import Greeter, GreetResponse
from greeter_servicer import GreeterServicer
from hello_world.v1.greeter_rsm import Greeter, GreetResponse
from resemble.aio.tests import Resemble
from resemble.aio.workflows import Workflow

Expand Down

0 comments on commit ca4fcc2

Please sign in to comment.