I can't to get shopping_cart.py or ./tck.sh running out of the box on macOS with a fresh cloned repository, but found a way to do it.
I setup a virtual environment to get not interfered with potential earlier dependencies installed.
What I did
This is my command history in a fresh directory:
> python shoppingcart/shopping_cart.py
Traceback (most recent call last):
File "shoppingcart/shopping_cart.py", line 2, in <module>
from shoppingcart.shopping_cart_entity import entity as shopping_cart_entity
File "/Users/lanzm/tmp/python-support/shoppingcart/shopping_cart_entity.py", line 9, in <module>
from shoppingcart.shoppingcart_pb2 import (Cart, LineItem, AddLineItem, RemoveLineItem)
File "/Users/lanzm/tmp/python-support/shoppingcart/shoppingcart_pb2.py", line 18, in <module>
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
ModuleNotFoundError: No module named 'google.api'
>
> pip install googleapis-common-protos
Successfully installed googleapis-common-protos-1.51.0
>
> python shoppingcart/shopping_cart.py
Traceback (most recent call last):
File "shoppingcart/shopping_cart.py", line 7, in <module>
CloudState().register_event_sourced_entity(shopping_cart_entity).serve()
AttributeError: 'CloudState' object has no attribute 'serve'
Then replace `.serve()
if __name__ == '__main__':
logging.basicConfig()
CloudState().register_event_sourced_entity(shopping_cart_entity).serve()
> python shoppingcart/shopping_cart.py
'Starting Cloudstate on 127.0.0.1:8080'
Suggested Fix
add googleapis-common-protos as a dependency
call start() instead of server() in shopping_cart.py
The module error ModuleNotFoundError: No module named 'google.api' shows that the *pb2.py file we have under python-support/google/api/ can't be found, but perhaps we even should not distribute by ourselfs so I installed them a a dependency with pip install googleapis-common-protos. We can add this dependency in general in setup.cfg I think.
I can't to get shopping_cart.py or
./tck.sh
running out of the box on macOS with a fresh cloned repository, but found a way to do it. I setup a virtual environment to get not interfered with potential earlier dependencies installed.What I did This is my command history in a fresh directory:
then I try to start the shopping cart:
Then replace `.serve()
with
.start()
:and this gets me the shopping cart started:
Suggested Fix
start()
instead ofserver()
inshopping_cart.py
The module error
ModuleNotFoundError: No module named 'google.api'
shows that the *pb2.py file we have underpython-support/google/api/
can't be found, but perhaps we even should not distribute by ourselfs so I installed them a a dependency withpip install googleapis-common-protos
. We can add this dependency in general insetup.cfg
I think.