Skip to content

Python Sample application for Chief Of State

Notifications You must be signed in to change notification settings

chief-of-state/cos-python-sample

Repository files navigation

COS Python Sample App

Sample gRPC python application using Chief of State.

Overview

This sample application uses Chief of State to build a Bank Account service that tracks debit/credit events to derive the current balance.

code
├── banking_app             # generated gRPC service code
├── banking_app_impl        # implements the banking service
├── chief_of_state          # generated COS code
├── read_handler_impl       # implements the COS read side handler
├── shared                  # shared helpers
├── test_client             # test client for sample traffic
└── write_handler_impl      # implements the COS write side handler

Quickstart

# update submodules
git submodule update --init

# download earth
brew install earthly

# updates submodules, generates protobufs
earthly +all

# starts all containers
docker-compose up -d

# create sample traffic
docker-compose exec test-client python -m test_client

# OTHER HELPFUL COMMANDS

# only generate protobufs locally
earthly +protogen

# supervise app logs
docker-compose logs -f --tail="all" api write-handler read-handler

# cos logs
docker-compose logs -f chiefofstate

installing dependencies for local dev in an IDE

# configure virtual env
python -m venv .venv

# activate it
. .venv/bin/activate

# install dependencies
pip install -r requirements.txt

About

Python Sample application for Chief Of State

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages