{"id":21974274,"url":"https://github.com/frequenz-floss/frequenz-dispatch-python","last_synced_at":"2025-04-28T14:46:29.556Z","repository":{"id":224975311,"uuid":"761775736","full_name":"frequenz-floss/frequenz-dispatch-python","owner":"frequenz-floss","description":"High-level interface to dispatch API","archived":false,"fork":false,"pushed_at":"2025-04-15T07:58:49.000Z","size":3217,"stargazers_count":0,"open_issues_count":13,"forks_count":5,"subscribers_count":2,"default_branch":"v0.x.x","last_synced_at":"2025-04-15T08:36:40.093Z","etag":null,"topics":["dispatch","frequenz","lib","library","python"],"latest_commit_sha":null,"homepage":"https://frequenz-floss.github.io/frequenz-dispatch-python/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frequenz-floss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-22T13:23:09.000Z","updated_at":"2025-04-15T07:55:59.000Z","dependencies_parsed_at":"2024-02-28T17:48:51.466Z","dependency_job_id":"6c2d5fee-5d0c-402c-b60c-e510bfe8cc0f","html_url":"https://github.com/frequenz-floss/frequenz-dispatch-python","commit_stats":null,"previous_names":["frequenz-floss/frequenz-dispatch-python"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frequenz-floss%2Ffrequenz-dispatch-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frequenz-floss%2Ffrequenz-dispatch-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frequenz-floss%2Ffrequenz-dispatch-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frequenz-floss%2Ffrequenz-dispatch-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frequenz-floss","download_url":"https://codeload.github.com/frequenz-floss/frequenz-dispatch-python/tar.gz/refs/heads/v0.x.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251333134,"owners_count":21572755,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dispatch","frequenz","lib","library","python"],"created_at":"2024-11-29T15:40:33.440Z","updated_at":"2025-04-28T14:46:29.549Z","avatar_url":"https://github.com/frequenz-floss.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dispatch Highlevel Interface\n\n[![Build Status](https://github.com/frequenz-floss/frequenz-dispatch-python/actions/workflows/ci.yaml/badge.svg)](https://github.com/frequenz-floss/frequenz-dispatch-python/actions/workflows/ci.yaml)\n[![PyPI Package](https://img.shields.io/pypi/v/frequenz-dispatch)](https://pypi.org/project/frequenz-dispatch/)\n[![Docs](https://img.shields.io/badge/docs-latest-informational)](https://frequenz-floss.github.io/frequenz-dispatch-python/)\n\n## Introduction\n\nA highlevel interface for the dispatch API.\n\nSee [the documentation](https://frequenz-floss.github.io/frequenz-dispatch-python/v0.1/reference/frequenz/dispatch) for more information.\n\n## Usage\n\nThe [`Dispatcher` class](https://frequenz-floss.github.io/frequenz-dispatch-python/v0.1/reference/frequenz/dispatch/#frequenz.dispatch.Dispatcher), the main entry point for the API, provides two channels:\n\n* [Lifecycle events](https://frequenz-floss.github.io/frequenz-dispatch-python/v0.1/reference/frequenz/dispatch/#frequenz.dispatch.Dispatcher.lifecycle_events): A channel that sends a message whenever a [Dispatch][frequenz.dispatch.Dispatch] is created, updated or deleted.\n* [Running status change](https://frequenz-floss.github.io/frequenz-dispatch-python/v0.1/reference/frequenz/dispatch/#frequenz.dispatch.Dispatcher.running_status_change): Sends a dispatch message whenever a dispatch is ready to be executed according to the schedule or the running status of the dispatch changed in a way that could potentially require the actor to start, stop or reconfigure itself.\n\n### Example using the running status change channel\n\n```python\nimport os\nfrom unittest.mock import MagicMock\nfrom datetime import timedelta\n\nfrom frequenz.dispatch import Dispatcher, DispatchInfo, MergeByType\n\nasync def create_actor(dispatch: DispatchInfo, receiver: Receiver[DispatchInfo]) -\u003e Actor:\n    return MagicMock(dispatch=dispatch, receiver=receiver)\n\nasync def run():\n    url = os.getenv(\"DISPATCH_API_URL\", \"grpc://fz-0004.frequenz.io:50051\")\n    key  = os.getenv(\"DISPATCH_API_KEY\", \"some-key\")\n\n    microgrid_id = 1\n\n    async with Dispatcher(\n        microgrid_id=microgrid_id,\n        server_url=url,\n        key=key,\n    ) as dispatcher:\n        await dispatcher.start_managing(\n            dispatch_type=\"EXAMPLE_TYPE\",\n            actor_factory=create_actor,\n            merge_strategy=MergeByType(),\n            retry_interval=timedelta(seconds=10)\n        )\n\n        await dispatcher\n```\n\n## Supported Platforms\n\nThe following platforms are officially supported (tested):\n\n- **Python:** 3.11\n- **Operating System:** Ubuntu Linux 20.04\n- **Architectures:** amd64, arm64\n\n## Contributing\n\nIf you want to know how to build this project and contribute to it, please\ncheck out the [Contributing Guide](CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrequenz-floss%2Ffrequenz-dispatch-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrequenz-floss%2Ffrequenz-dispatch-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrequenz-floss%2Ffrequenz-dispatch-python/lists"}