Repository navigation
Improve inline type annotations - #664
Merged
mergify[bot] merged 3 commits intoAug 5, 2026
Merged
Conversation
Port the accepted annotation-only completeness improvements from Tenacity 8.1.0 while adapting them to current main. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the existing public annotations for RetryCallState arguments and results rather than narrowing them to object-based container types. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep only constructor return annotations and the non-trivial regex field union; remove declarations already evident from literals, conversions, typed parameters, varargs, and singleton constructors. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
jd
force-pushed
the
heejaechang-port-inline-annotations
branch
from
August 5, 2026 11:46
50543f4 to
25de3f6
Compare
jd
approved these changes
Aug 5, 2026
Contributor
Merge Queue Status
This pull request spent 7 seconds in the queue, including 1 second running CI. Required conditions to merge
|
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.
Summary
-> Noneannotations toAttemptManager.__init__andBaseRetrying.__init__.re.Pattern[str] | Noneshape ofretry_if_exception_message.match.Anyannotations.Annotation audit
The accepted Tenacity 8.1.0 benchmark patch was re-audited against current
main. Inline field declarations were removed when their type was already evident from:NAME,REPR_FIELDS)float(...)and_utils.to_seconds(...)Those declarations improved VerifyTypes scoring but did not add an independent API contract or checker guarantee. The retained
matchannotation documents and checks a conditional public field union that is not represented by one simple assignment source.Validation
uv run poe all— lint, strict mypy, 172 tests, doctests, and HTML docs passeduv run --with pyright --with-editable . pyright --verifytypes tenacity --ignoreexternal— 63.3% (210/332 known exports), measured as informational evidence rather than an optimization targetmain— executable AST unchangedPort decisions
The Tornado
sleepannotation andRetryCallState.__repr__return type are already present onmain. ExistingAnyannotations remain unchanged. The benchmark'sget_callback_name(object),Future.construct(..., object, ...), and broadCallable[..., bool]changes are omitted because current upstream typing is stricter or more precise.