Skip to content

Commit

Permalink
Remove TODOs (#46)
Browse files Browse the repository at this point in the history
- **Add a new `part:code` label**
- **mkdocs: Fix the edit URI**
- **mkdocs: Add cross-reference to grpc**
- **Remove outdated TODOs**
  • Loading branch information
llucax committed May 7, 2024
2 parents 5f85d8b + 84219fb commit 7ace841
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 30 deletions.
4 changes: 1 addition & 3 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 1 addition & 3 deletions .github/keylabeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
9 changes: 9 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 0 additions & 2 deletions .github/workflows/release-notes-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions docs/_scripts/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 1 addition & 5 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
19 changes: 10 additions & 9 deletions src/frequenz/client/base/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7ace841

Please sign in to comment.