Skip to content

Commit 7efa083

Browse files
committed
Fix cookiecutter TODOS
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 2c78326 commit 7efa083

File tree

16 files changed

+57
-42
lines changed

16 files changed

+57
-42
lines changed

.cookiecutter-replay.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"license": "MIT",
1111
"author_name": "Frequenz Energy-as-a-Service GmbH",
1212
"author_email": "[email protected]",
13-
"python_package": "frequenz.actor.dispatch",
14-
"pypi_package_name": "frequenz-actor-dispatch",
13+
"python_package": "frequenz.dispatch.actor",
14+
"pypi_package_name": "frequenz-dispatch-actor",
1515
"github_repo_name": "frequenz-dispatch-python",
1616
"default_codeowners": "@frequenz-floss/api-dispatch-team",
1717
"_template": "gh:frequenz-floss/frequenz-repo-config-python",

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ body:
5050
- Documentation (part:docs)
5151
- Unit, integration and performance tests (part:tests)
5252
- Build script, CI, dependencies, etc. (part:tooling)
53-
# TODO(cookiecutter): Add other parts
54-
# Please have in mind that that the part:xxx labels need to
55-
# be created in the GitHub repository.
53+
- Actor (part:actor)
5654
validations:
5755
required: true
5856
- type: textarea

.github/keylabeler.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,4 @@ labelMappings:
1616
"part:tests": "part:tests"
1717
"part:tooling": "part:tooling"
1818
"part:❓": "part:❓"
19-
# TODO(cookiecutter): Add other parts
20-
# Please have in mind that that the part:xxx labels need to
21-
# be created in the GitHub repository.
19+
"part:actor": "part:actor"

.github/labeler.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,8 @@
6161
- CODEOWNERS
6262
- MANIFEST.in
6363
- noxfile.py
64+
65+
"part:actor":
66+
- changed-files:
67+
- any-glob-to-any-file:
68+
- "src/frequenz/dispatch/actor/**"

.github/workflows/ci.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
submodules: true
5151

5252
- name: Set up Python
53-
uses: actions/setup-python@v4
53+
uses: actions/setup-python@v5
5454
with:
5555
python-version: ${{ matrix.python }}
5656
cache: 'pip'
@@ -133,7 +133,7 @@ jobs:
133133
# https://github.com/docker/build-push-action/issues/252
134134
# https://github.com/moby/buildkit/issues/1896
135135
- name: Cache container layers
136-
uses: actions/cache@v3
136+
uses: actions/cache@v4
137137
with:
138138
path: /tmp/.buildx-cache
139139
key: ${{ runner.os }}-buildx-nox-${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.python }}
@@ -158,7 +158,7 @@ jobs:
158158
159159
# Cache pip downloads
160160
- name: Cache pip downloads
161-
uses: actions/cache@v3
161+
uses: actions/cache@v4
162162
with:
163163
path: /tmp/pip-cache
164164
key: nox-${{ matrix.nox-session }}-${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('**/pyproject.toml') }}
@@ -217,7 +217,7 @@ jobs:
217217
submodules: true
218218

219219
- name: Set up Python
220-
uses: actions/setup-python@v4
220+
uses: actions/setup-python@v5
221221
with:
222222
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
223223
cache: 'pip'
@@ -232,7 +232,7 @@ jobs:
232232
run: python -m build
233233

234234
- name: Upload distribution files
235-
uses: actions/upload-artifact@v3
235+
uses: actions/upload-artifact@v4
236236
with:
237237
name: dist-packages
238238
path: dist/
@@ -246,7 +246,7 @@ jobs:
246246
- name: Fetch sources
247247
uses: actions/checkout@v4
248248
- name: Download package
249-
uses: actions/download-artifact@v3
249+
uses: actions/download-artifact@v4
250250
with:
251251
name: dist-packages
252252
path: dist
@@ -277,7 +277,7 @@ jobs:
277277
uses: frequenz-floss/setup-git-user@v2
278278

279279
- name: Set up Python
280-
uses: actions/setup-python@v4
280+
uses: actions/setup-python@v5
281281
with:
282282
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
283283
cache: 'pip'
@@ -296,7 +296,7 @@ jobs:
296296
mike set-default $MIKE_VERSION
297297
298298
- name: Upload site
299-
uses: actions/upload-artifact@v3
299+
uses: actions/upload-artifact@v4
300300
with:
301301
name: docs-site
302302
path: site/
@@ -319,7 +319,7 @@ jobs:
319319
uses: frequenz-floss/setup-git-user@v2
320320

321321
- name: Set up Python
322-
uses: actions/setup-python@v4
322+
uses: actions/setup-python@v5
323323
with:
324324
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
325325
cache: 'pip'
@@ -386,7 +386,7 @@ jobs:
386386
runs-on: ubuntu-20.04
387387
steps:
388388
- name: Download distribution files
389-
uses: actions/download-artifact@v3
389+
uses: actions/download-artifact@v4
390390
with:
391391
name: dist-packages
392392
path: dist
@@ -432,7 +432,7 @@ jobs:
432432
id-token: write
433433
steps:
434434
- name: Download distribution files
435-
uses: actions/download-artifact@v3
435+
uses: actions/download-artifact@v4
436436
with:
437437
name: dist-packages
438438
path: dist

.github/workflows/release-notes-check.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ jobs:
2222
if: github.event_name == 'pull_request'
2323
uses: brettcannon/check-for-changed-files@4170644959a21843b31f1181f2a1761d65ef4791 # v1.2.0
2424
with:
25-
# TODO(cookiecutter): Uncomment the following line for private repositories, otherwise remove it and remove it
26-
# token: ${{ secrets.github_token }}
2725
file-pattern: "RELEASE_NOTES.md"
2826
prereq-pattern: "src/**"
2927
skip-label: "cmd:skip-release-notes"

CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
# Fallback owner.
55
# These are the default owners for everything in the repo, unless a later match
66
# takes precedence.
7-
# TODO(cookiecutter): Add more specific code-owners, check if the default is correct
87
* @frequenz-floss/api-dispatch-team

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ These are the steps to create a new release:
141141
a [GitHub
142142
Release](https://github.com/frequenz-floss/frequenz-dispatch-python/releases),
143143
and upload a new package to
144-
[PyPI](https://pypi.org/project/frequenz-actor-dispatch/)
144+
[PyPI](https://pypi.org/project/frequenz-dispatch-actor/)
145145
automatically.
146146

147147
6. Once this is done, reset the `RELEASE_NOTES.md` with the template:

README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
11
# Dispatch Highlevel Interface
22

33
[![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)
4-
[![PyPI Package](https://img.shields.io/pypi/v/frequenz-actor-dispatch)](https://pypi.org/project/frequenz-actor-dispatch/)
4+
[![PyPI Package](https://img.shields.io/pypi/v/frequenz-dispatch-actor)](https://pypi.org/project/frequenz-dispatch-actor/)
55
[![Docs](https://img.shields.io/badge/docs-latest-informational)](https://frequenz-floss.github.io/frequenz-dispatch-python/)
66

77
## Introduction
88

9-
A highlevel interface for the dispatch API
10-
11-
TODO(cookiecutter): Improve the README file
9+
A highlevel interface for the dispatch API.
10+
The interface is made of the dispatch actor which should run once per microgrid.
11+
It provides two channels for clients:
12+
- "new_dispatches" for newly created dispatches
13+
- "ready_dispatches" for dispatches that are ready to be executed
14+
15+
## Example Usage
16+
17+
```python
18+
async def run():
19+
# dispatch helper sends out dispatches when they are due
20+
dispatch_arrived = dispatch_helper.new_dispatches().new_receiver()
21+
dispatch_ready = dispatch_helper.ready_dispatches().new_receiver()
22+
23+
async for selected in select(dispatch_ready, dispatch_arrived):
24+
if selected_from(selected, dispatch_arrived):
25+
dispatch = selected.value
26+
match dispatch.type:
27+
case DISPATCH_TYPE_BATTERY_CHARGE:
28+
battery_pool = microgrid.battery_pool(dispatch.battery_set, task_id)
29+
battery_pool.set_charge(dispatch.power)
30+
...
31+
if selected_from(selected, dispatch_ready):
32+
dispatch = selected.value
33+
log.info("New dispatch arrived %s", dispatch)
34+
```
1235

1336
## Supported Platforms
1437

docs/_scripts/macros.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,5 @@ def define_env(env: macros.MacrosPlugin) -> None:
7777
# https://squidfunk.github.io/mkdocs-material/reference/code-blocks/#adding-annotations
7878
env.variables["code_annotation_marker"] = _CODE_ANNOTATION_MARKER
7979

80-
# TODO(cookiecutter): Add any other macros, variables and filters here.
81-
8280
# This hook needs to be done at the end of the `define_env` function.
8381
_hook_macros_plugin(env)

mkdocs.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@ site_author: "Frequenz Energy-as-a-Service GmbH"
88
copyright: "Copyright © 2024 Frequenz Energy-as-a-Service GmbH"
99
repo_name: "frequenz-dispatch-python"
1010
repo_url: "https://github.com/frequenz-floss/frequenz-dispatch-python"
11-
# TODO(cookiecutter): "main" is the GitHub repo default branch, you might want to update it
12-
# if the project uses a different default branch.
13-
edit_uri: "edit/main/docs/"
11+
edit_uri: "edit/v0.x.x/docs/"
1412
strict: true # Treat warnings as errors
1513

1614
# Build directories
1715
theme:
1816
name: "material"
19-
# TODO(cookiecutter): You might want to change the logo, the file is located in "docs/"
2017
logo: _img/logo.png
2118
favicon: _img/logo.png
2219
language: en
@@ -51,7 +48,6 @@ theme:
5148
name: Switch to light mode
5249

5350
extra:
54-
# TODO(cookiecutter): You probably want to update the social links
5551
social:
5652
- icon: fontawesome/brands/github
5753
link: https://github.com/frequenz-floss
@@ -116,12 +112,12 @@ plugins:
116112
show_source: true
117113
signature_crossrefs: true
118114
import:
119-
# TODO(cookiecutter): You might want to add other external references here
120115
# See https://mkdocstrings.github.io/python/usage/#import for details
121116
- https://docs.python.org/3/objects.inv
122117
- https://frequenz-floss.github.io/frequenz-channels-python/v0.16/objects.inv
123118
- https://frequenz-floss.github.io/frequenz-sdk-python/v0.25/objects.inv
124119
- https://typing-extensions.readthedocs.io/en/stable/objects.inv
120+
- https://frequenz-floss.github.io/frequenz-client-dispatch-python/v0.1/objects.inv
125121
# Note this plugin must be loaded after mkdocstrings to be able to use macros
126122
# inside docstrings. See the comment in `docs/_scripts/macros.py` for more
127123
# details

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ requires = [
1010
build-backend = "setuptools.build_meta"
1111

1212
[project]
13-
name = "frequenz-actor-dispatch"
13+
name = "frequenz-dispatch-actor"
1414
description = "A highlevel interface for the dispatch API"
1515
readme = "README.md"
1616
license = { text = "MIT" }
@@ -65,7 +65,7 @@ dev-mypy = [
6565
"mypy == 1.5.1",
6666
"types-Markdown == 3.4.2.10",
6767
# For checking the noxfile, docs/ script, and tests
68-
"frequenz-actor-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]",
68+
"frequenz-dispatch-actor[dev-mkdocs,dev-noxfile,dev-pytest]",
6969
]
7070
dev-noxfile = [
7171
"nox == 2023.4.22",
@@ -74,7 +74,7 @@ dev-noxfile = [
7474
dev-pylint = [
7575
"pylint == 3.0.2",
7676
# For checking the noxfile, docs/ script, and tests
77-
"frequenz-actor-dispatch[dev-mkdocs,dev-noxfile,dev-pytest]",
77+
"frequenz-dispatch-actor[dev-mkdocs,dev-noxfile,dev-pytest]",
7878
]
7979
dev-pytest = [
8080
"pytest == 8.0.0",
@@ -84,7 +84,7 @@ dev-pytest = [
8484
"async-solipsism == 0.5",
8585
]
8686
dev = [
87-
"frequenz-actor-dispatch[dev-mkdocs,dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]",
87+
"frequenz-dispatch-actor[dev-mkdocs,dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]",
8888
]
8989

9090
[project.urls]
@@ -159,7 +159,7 @@ namespace_packages = true
159159
# used but getting the original ignored error when removing the type: ignore.
160160
# See for example: https://github.com/python/mypy/issues/2960
161161
#no_incremental = true
162-
packages = ["frequenz.actor.dispatch"]
162+
packages = ["frequenz.dispatch.actor"]
163163
strict = true
164164

165165
[[tool.mypy.overrides]]

tests/test_frequenz_dispatch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# License: MIT
22
# Copyright © 2024 Frequenz Energy-as-a-Service GmbH
33

4-
"""Tests for the frequenz.actor.dispatch package."""
4+
"""Tests for the frequenz.dispatch.actor package."""
55
import pytest
66

7-
from frequenz.actor.dispatch import delete_me
7+
from frequenz.dispatch.actor import delete_me
88

99

1010
def test_frequenz_dispatch_succeeds() -> None: # TODO(cookiecutter): Remove

0 commit comments

Comments
 (0)