From 09f660c673ff9968a298a89ca35671b301da3810 Mon Sep 17 00:00:00 2001 From: "Mathias L. Baumann" Date: Thu, 9 Oct 2025 10:44:41 +0200 Subject: [PATCH] feat: enhance README.md with Quick Start section and improved installation instructions - Add dedicated Quick Start section for faster onboarding - Expand Installation section with multiple installation methods - Improve code examples and documentation structure Closes: #182 Signed-off-by: Mathias L. Baumann --- README.md | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 28a30c6f..acf256e4 100644 --- a/README.md +++ b/README.md @@ -12,31 +12,58 @@ If you're a developer who needs direct access to the [Dispatch API](https://gith ## 📦 Installation +### Using pip + Install the library via pip: ```bash pip install frequenz-client-dispatch ``` -## 🛠️ Usage +### Using Poetry + +If you're using Poetry for dependency management: + +```bash +poetry add frequenz-client-dispatch +``` + +### From Source + +To install from source: + +```bash +git clone https://github.com/frequenz-floss/frequenz-client-dispatch-python.git +cd frequenz-client-dispatch-python +pip install -e . +``` + +## 🚀 Quick Start -Here's a quick example to get you started: +Get up and running in minutes with this simple example: ```python from frequenz.client.dispatch import DispatchApiClient import asyncio -async def print_dispatches(): - # Initialize the client - client = DispatchApiClient(key="your_api_key", server_url="grpc://dispatch.url.goes.here.example.com") +async def main(): + # Initialize the client with your API credentials + client = DispatchApiClient( + auth_key="your_auth_key_here", + sign_secret="your_sign_secret_here", + server_url="grpc://dispatch.url.goes.here.example.com" + ) - # List all dispatches for a specific microgrid + # List all dispatches for microgrid ID 1 async for page in client.list(microgrid_id=1): for dispatch in page: - print(dispatch) + print(f"Dispatch ID: {dispatch.id}") + print(f"Type: {dispatch.type}") + print(f"Start Time: {dispatch.start_time}") + print("---") -# Run the Example -asyncio.run(print_dispatches()) +# Run the example +asyncio.run(main()) ``` For detailed usage and advanced features, check out the [client documentation](https://frequenz-floss.github.io/frequenz-client-dispatch-python/latest/reference/frequenz/client/dispatch/#frequenz.client.dispatch.ApiDispatchClient).