Fixes from typechecker - #56
Merged
Merged
Conversation
…ble to the static type checker. To fix that we need to declare them separatly.
…nd add Optional typing
…ever been called and the timer has not been cancelled (but still the is_running method would have returned False)
…error-code call-arg), move mypy config to pyproject.toml
flofeurstein
requested review from
phettberg
and
a lite review from Copilot
September 10, 2026 12:12
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The functional fix is covered by new tests and the remaining feedback is limited to small documentation wording/typos.
Pull request overview
This PR tightens type-checking across broqer while fixing a concrete runtime bug in Timer.end_early(), and updates project metadata/docs/CI to reflect the current supported Python/tooling.
Changes:
- Fix
Timer.end_early()to properly cancel the pending handle and reliably invoke the callback, plus add a comprehensive async test suite forTimer. - Extend/clean up typing annotations (notably
Optionalusage and callable signatures) and simplify CI mypy invocation viapyproject.toml. - Refresh repository docs and packaging metadata (supported Python versions, lint tooling, CI references) to remove stale release-era artifacts.
File summaries
| File | Description |
|---|---|
| tests/test_timer.py | Adds async tests covering timer lifecycle, argument passing, cancellation, and end_early() regression scenarios. |
| broqer/timer.py | Fixes end_early() logic and improves callback typing / argument handling defaults. |
| broqer/publisher.py | Improves type annotations (optional params, overloads) and adds TYPE_CHECKING-only operator method declarations. |
| broqer/value.py | Makes who explicitly optional for emit() to satisfy type-checking. |
| broqer/coro_queue.py | Refines coroutine callable typing to better match actual async usage. |
| broqer/publishers/poll.py | Makes type_ explicitly optional for clearer typing. |
| broqer/subscribers/sink.py | Makes decorator/function arguments explicitly optional and avoids truthiness checks for callables. |
| broqer/op/map_.py | Broadens callable typing and makes decorator hooks optional for mypy correctness. |
| broqer/op/filter_.py | Makes optional publisher/predicate parameters explicit for type-checking. |
| broqer/op/combine_latest.py | Makes map_ optional explicitly and updates typing imports accordingly. |
| pyproject.toml | Adds mypy configuration and adjusts ruff config formatting. |
| .github/workflows/build.yml | Simplifies CI type-check invocation to mypy broqer (relying on config). |
| setup.py | Updates supported Python classifiers and sets python_requires>=3.10. |
| requirements_dev.txt | Removes tox from dev requirements. |
| README.rst | Updates supported Python versions and switches lint tool reference to ruff. |
| CONTRIBUTING.rst | Updates contributor workflow steps to ruff/pytest/mypy and modernizes CI/deploy references. |
| CHANGELOG.md | Adds 3.3.0 entry describing the timer bug fix and typing improvements. |
Review details
- Files reviewed: 17/17 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
phettberg
reviewed
Sep 10, 2026
Collaborator
Author
|
@semiversus do you want to review too, or can I merge this PR? |
Owner
|
Looks fine. I'll merge it. For future reference, you or Patrick can merge it yourself. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While introducing
tytypechecker in our app, I discovered some inconsistencies in thepython-broqerlibrary and decided to extend themypytypechecking with this pull request.Additionally, a bug in the
timer.pymodule was discovered and fixed.CONTRIBUTING.rst,README.rstandsetup.pycontained some artifacts from earlier releases (supported python versions, tools (e.g. flake, tox) and Travis as CI pipeline). I removed that too.@semiversus or/and @phettberg could you please review the changes? Should we consider migrating to uv?