Skip to content

chore: postpone annotations in src typing#2356

Merged
Borda merged 10 commits into
developfrom
typing/src
Jun 27, 2026
Merged

chore: postpone annotations in src typing#2356
Borda merged 10 commits into
developfrom
typing/src

Conversation

@Borda

@Borda Borda commented Jun 26, 2026

Copy link
Copy Markdown
Member

Add postponed annotation evaluation to remaining source modules that already use modern annotation syntax.

Keep the change limited to typing syntax cleanup for Python 3.10 compatibility.

Part of #2260

Add postponed annotation evaluation to remaining source modules that already use modern annotation syntax.

Keep the change limited to typing syntax cleanup for Python 3.10 compatibility.

Co-authored-by: Codex <codex@openai.com>
@Borda Borda requested a review from SkalskiP as a code owner June 26, 2026 19:52
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.69014% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 82%. Comparing base (4b867f2) to head (8f88530).

Additional details and impacted files
@@           Coverage Diff           @@
##           develop   #2356   +/-   ##
=======================================
- Coverage       82%     82%   -0%     
=======================================
  Files           68      68           
  Lines         9507    9523   +16     
=======================================
+ Hits          7811    7823   +12     
- Misses        1696    1700    +4     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Borda and others added 2 commits June 26, 2026 22:25
Port docstring-preserving Python 3.10 typing improvements under src/.

Keep changes limited to typing syntax, untyped deprecate import boundaries, and a safe icon image cast.

Co-authored-by: Codex <codex@openai.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes typing syntax across remaining modules as part of the Python 3.10 baseline work (referenced by #2260), primarily by enabling postponed annotation evaluation and migrating legacy typing constructs (e.g., Optional/Union) to modern syntax.

Changes:

  • Added from __future__ import annotations to additional modules to postpone annotation evaluation consistently.
  • Replaced Optional[...] / Union[...] usage with T | None / A | B where applicable.
  • Added # type: ignore[import-untyped] on deprecate imports to keep type checking clean.

Assessment (n/5):

  • Code quality: 3/5
  • Testing: 3/5
  • Documentation: 3/5

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/supervision/validators/init.py Add postponed annotations and modernize optional dict typing; mark deprecate as untyped import.
src/supervision/utils/iterables.py Add postponed annotation evaluation import.
src/supervision/utils/image.py Mark deprecate import as untyped.
src/supervision/utils/conversion.py Add postponed annotations and mark deprecate import as untyped.
src/supervision/tracker/byte_tracker/core.py Mark deprecate import as untyped.
src/supervision/metrics/detection.py Reformat deprecate imports and mark as untyped.
src/supervision/key_points/skeletons.py Add postponed annotation evaluation import.
src/supervision/key_points/core.py Replace Union[...] aliases with `
src/supervision/geometry/utils.py Add postponed annotation evaluation import.
src/supervision/draw/base.py Add postponed annotation evaluation import.
src/supervision/detection/utils/internal.py Replace Union[...] in cast with `
src/supervision/detection/utils/boxes.py Mark deprecate import as untyped.
src/supervision/detection/tools/inference_slicer.py Switch TypeGuard import to stdlib typing (Py3.10+) and simplify typing imports.
src/supervision/dataset/utils.py Mark deprecate import as untyped.
src/supervision/dataset/formats/coco.py Add postponed annotations; replace Union[...] with `
src/supervision/assets/list.py Add postponed annotations and use unquoted Assets return annotation.
src/supervision/annotators/core.py Refactor _load_icon typing around letterbox_image call.

Comment thread src/supervision/annotators/core.py Outdated
@Borda Borda merged commit f34a940 into develop Jun 27, 2026
29 checks passed
@Borda Borda deleted the typing/src branch June 27, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants