diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index ff62366..ee76b87 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -47,12 +47,10 @@ body: multiple: true options: - I don't know (part:❓) + - Code (part:code) - Documentation (part:docs) - Unit, integration and performance tests (part:tests) - Build script, CI, dependencies, etc. (part:tooling) - # TODO(cookiecutter): Add other parts - # Please have in mind that that the part:xxx labels need to - # be created in the GitHub repository. validations: required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 39f96ef..df6a949 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -5,6 +5,4 @@ blank_issues_enabled: true contact_links: - name: Ask a question ❓ url: https://github.com/frequenz-floss/frequenz-client-base-python/discussions/new?category=support - # TODO(cookiecutter): Make sure the GitHub repository has a discussion category "Support" - # Rename the "Q&A" category to "Support" and change the emoji to 🆘 (SOS) about: Use this if you are not sure how to do something, have installation problems, etc. diff --git a/.github/keylabeler.yml b/.github/keylabeler.yml index e5abffe..d3530fd 100644 --- a/.github/keylabeler.yml +++ b/.github/keylabeler.yml @@ -12,10 +12,8 @@ caseSensitive: true # Explicit keyword mappings to labels. Form of match:label. Required. labelMappings: + "part:code": "part:code" "part:docs": "part:docs" "part:tests": "part:tests" "part:tooling": "part:tooling" "part:❓": "part:❓" - # TODO(cookiecutter): Add other parts - # Please have in mind that that the part:xxx labels need to - # be created in the GitHub repository. diff --git a/.github/labeler.yml b/.github/labeler.yml index 598ebbd..80e2e5a 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -60,3 +60,12 @@ - CODEOWNERS - MANIFEST.in - noxfile.py + +"part:code": + - all: + - changed-files: + - any-glob-to-any-file: + - "src/*.py" + - "src/**/*.py" + - all-globs-to-all-files: + - "!src/**/conftest.py" diff --git a/.github/workflows/release-notes-check.yml b/.github/workflows/release-notes-check.yml index cb39183..e0b00ac 100644 --- a/.github/workflows/release-notes-check.yml +++ b/.github/workflows/release-notes-check.yml @@ -22,8 +22,6 @@ jobs: if: github.event_name == 'pull_request' uses: brettcannon/check-for-changed-files@4170644959a21843b31f1181f2a1761d65ef4791 # v1.2.0 with: - # TODO(cookiecutter): Uncomment the following line for private repositories, otherwise remove it and remove it - # token: ${{ secrets.github_token }} file-pattern: "RELEASE_NOTES.md" prereq-pattern: "src/**" skip-label: "cmd:skip-release-notes" diff --git a/CODEOWNERS b/CODEOWNERS index f9a1da0..7b6d428 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -4,5 +4,4 @@ # Fallback owner. # These are the default owners for everything in the repo, unless a later match # takes precedence. -# TODO(cookiecutter): Add more specific code-owners, check if the default is correct * @frequenz-floss/python-sdk-team diff --git a/docs/_scripts/macros.py b/docs/_scripts/macros.py index f84712e..6cc4cc9 100644 --- a/docs/_scripts/macros.py +++ b/docs/_scripts/macros.py @@ -74,7 +74,5 @@ def define_env(env: macros.MacrosPlugin) -> None: # https://squidfunk.github.io/mkdocs-material/reference/code-blocks/#adding-annotations env.variables["code_annotation_marker"] = _CODE_ANNOTATION_MARKER - # TODO(cookiecutter): Add any other macros, variables and filters here. - # This hook needs to be done at the end of the `define_env` function. _hook_macros_plugin(env) diff --git a/mkdocs.yml b/mkdocs.yml index a93b6ca..5a458fb 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -8,15 +8,12 @@ site_author: "Frequenz Energy-as-a-Service GmbH" copyright: "Copyright © 2023 Frequenz Energy-as-a-Service GmbH" repo_name: "frequenz-client-base-python" repo_url: "https://github.com/frequenz-floss/frequenz-client-base-python" -# TODO(cookiecutter): "main" is the GitHub repo default branch, you might want to update it -# if the project uses a different default branch. -edit_uri: "edit/main/docs/" +edit_uri: "edit/v0.x.x/docs/" strict: true # Treat warnings as errors # Build directories theme: name: "material" - # TODO(cookiecutter): You might want to change the logo, the file is located in "docs/" logo: _img/logo.png favicon: _img/logo.png language: en @@ -51,7 +48,6 @@ theme: name: Switch to light mode extra: - # TODO(cookiecutter): You probably want to update the social links social: - icon: fontawesome/brands/github link: https://github.com/frequenz-floss diff --git a/pyproject.toml b/pyproject.toml index 9d517d5..e0d4c03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,6 @@ description = "Utilities for writing Frequenz API clients" readme = "README.md" license = { text = "MIT" } keywords = ["frequenz", "python", "lib", "library", "client-base"] -# TODO(cookiecutter): Remove and add more classifiers if appropriate classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -26,7 +25,6 @@ classifiers = [ "Typing :: Typed", ] requires-python = ">= 3.11, < 4" -# TODO(cookiecutter): Remove and add more dependencies if appropriate dependencies = [ "frequenz-channels >= v1.0.0-rc1, < 2", "grpcio >= 1.54.2, < 2", @@ -39,7 +37,6 @@ dynamic = ["version"] name = "Frequenz Energy-as-a-Service GmbH" email = "floss@frequenz.com" -# TODO(cookiecutter): Remove and add more optional dependencies if appropriate [project.optional-dependencies] dev-flake8 = [ "flake8 == 7.0.0", diff --git a/src/frequenz/client/base/streaming.py b/src/frequenz/client/base/streaming.py index ba0451a..1bcd263 100644 --- a/src/frequenz/client/base/streaming.py +++ b/src/frequenz/client/base/streaming.py @@ -82,29 +82,30 @@ async def _run(self) -> None: sender = self._channel.new_sender() while True: - _logger.debug("Making call to grpc streaming method: %s", self._stream_name) - + error: Exception | None = None + _logger.info("%s: starting to stream", self._stream_name) try: call = self._stream_method() async for msg in call: await sender.send(self._transform(msg)) - except grpc.aio.AioRpcError: - _logger.exception( - "Error in grpc streaming method: %s", self._stream_name - ) + except grpc.aio.AioRpcError as err: + error = err + error_str = f"Error: {error}" if error else "Stream exhausted" if interval := self._retry_strategy.next_interval(): _logger.warning( - "`%s`, connection ended, retrying %s in %0.3f seconds.", + "%s: connection ended, retrying %s in %0.3f seconds. %s.", self._stream_name, self._retry_strategy.get_progress(), interval, + error_str, ) await asyncio.sleep(interval) else: - _logger.warning( - "`%s`, connection ended, retry limit exceeded %s.", + _logger.error( + "%s: connection ended, retry limit exceeded (%s), giving up. %s.", self._stream_name, self._retry_strategy.get_progress(), + error_str, ) await self._channel.close() break