Skip to content

chore(pre_commit): ⬆ pre_commit autoupdate#2248

Open
pre-commit-ci[bot] wants to merge 10 commits into
developfrom
pre-commit-ci-update-config
Open

chore(pre_commit): ⬆ pre_commit autoupdate#2248
pre-commit-ci[bot] wants to merge 10 commits into
developfrom
pre-commit-ci-update-config

Conversation

@pre-commit-ci
Copy link
Copy Markdown
Contributor

@pre-commit-ci pre-commit-ci Bot commented May 11, 2026

updates:
- [github.com/tox-dev/pyproject-fmt: v2.21.1 → v2.21.2](tox-dev/pyproject-fmt@v2.21.1...v2.21.2)
- [github.com/pre-commit/mirrors-mypy: v1.20.2 → v2.0.0](pre-commit/mirrors-mypy@v1.20.2...v2.0.0)
@pre-commit-ci pre-commit-ci Bot requested a review from SkalskiP as a code owner May 11, 2026 17:38
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78%. Comparing base (26ae68a) to head (e04e247).

Additional details and impacted files
@@           Coverage Diff           @@
##           develop   #2248   +/-   ##
=======================================
  Coverage       78%     78%           
=======================================
  Files           66      66           
  Lines         8347    8347           
=======================================
  Hits          6475    6475           
  Misses        1872    1872           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Borda and others added 5 commits May 13, 2026 17:58
Co-authored-by: OpenAI Codex <codex@openai.com>
- Remove redundant newlines in `src/deprecate/__init__.pyi`.
- Use `TypeAlias` for `ImageInput` typing in `inference_slicer.py`.
- Update mypy configuration to target Python 3.10 in `pyproject.toml`.
@Borda Borda requested a review from Copilot May 13, 2026 17:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the repository’s pre-commit tooling (notably mypy) and then performs a broad set of type- and dtype-related refactors across the codebase to satisfy stricter static checking (e.g., explicit np.float32/np.int32 arrays, additional cast() usage, and CompactMask handling in metrics/utilities).

Changes:

  • Bump pre-commit hooks (pyproject-fmt, mirrors-mypy) and adjust mypy configuration (python_version = 3.10).
  • Add a local stub for the deprecate module and update deprecated-decorator usage to avoid mypy errors.
  • Normalize/clarify array dtypes and typing across detections, metrics, dataset converters, and drawing utilities (including CompactMask → dense conversions in several places).

Reviewed changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/supervision/validators/init.py Import ordering/type-ignore cleanup for deprecated decorators.
src/supervision/utils/video.py Add typing casts and make fourcc lookup more type-checker-friendly.
src/supervision/utils/notebook.py Normalize image inputs to np.uint8 arrays for plotting helpers.
src/supervision/utils/image.py Tighten dtypes/typing around crop/resize/letterbox/overlay/grayscale utilities.
src/supervision/utils/conversion.py Adjust wrapper typings; strengthen image conversion helpers’ typing/dtypes.
src/supervision/tracker/byte_tracker/single_object_track.py Improve typing/dtypes for Kalman multi-predict inputs/outputs.
src/supervision/tracker/byte_tracker/matching.py Add casts, handle empty inputs explicitly, and normalize float32 math.
src/supervision/tracker/byte_tracker/kalman_filter.py Normalize motion covariance construction to float32 arrays.
src/supervision/tracker/byte_tracker/core.py Import reordering for deprecated_class.
src/supervision/metrics/utils/object_size.py Tighten NDArray typing with explicit Any.
src/supervision/metrics/recall.py Normalize empty-array dtypes; add CompactMask → dense handling; pandas export fix.
src/supervision/metrics/precision.py Normalize empty-array dtypes; add CompactMask handling; pandas export fix.
src/supervision/metrics/mean_average_recall.py pandas export fix; normalize class arrays/dtypes; CompactMask handling.
src/supervision/metrics/mean_average_precision.py pandas export fix; add casts/dtypes for returned arrays.
src/supervision/metrics/f1_score.py Normalize empty-array dtypes; add CompactMask → dense handling; pandas export fix.
src/supervision/metrics/detection.py Confusion matrix dtype normalization and plotting numeric conversions.
src/supervision/key_points/core.py Add optional-array equality helper; tighten typing for class_id/data and indexing.
src/supervision/key_points/annotators.py Normalize anchor arrays and box generation dtypes.
src/supervision/draw/utils.py Improve image loading error handling; adjust blending implementation.
src/supervision/detection/vlm.py Normalize parsing outputs’ dtypes and array construction.
src/supervision/detection/utils/polygons.py Ensure OpenCV polygon ops receive float32 arrays; simplify return typing.
src/supervision/detection/utils/masks.py Normalize centroid/CC-stats numeric types and connected-components outputs.
src/supervision/detection/utils/iou_and_nms.py Normalize np.eye dtype and broaden typing for masks grouping.
src/supervision/detection/utils/internal.py Normalize Roboflow-result parsing dtypes; generalize data/metadata typing.
src/supervision/detection/utils/converters.py Normalize converter outputs to float32/int32; simplify/adjust return typing.
src/supervision/detection/utils/boxes.py Normalize outputs to float32 and adjust typing for box utilities.
src/supervision/detection/tools/smoother.py Handle confidence=None safely when averaging tracks; normalize float32 outputs.
src/supervision/detection/tools/polygon_zone.py Minor typing cleanup; avoid redundant .astype(bool) return.
src/supervision/detection/tools/inference_slicer.py Introduce a PIL/ndarray image input alias and adjust callback typing/casts.
src/supervision/detection/line_zone.py Normalize intermediate array dtypes and remove unnecessary casts.
src/supervision/detection/core.py Tighten Detections field dtypes/typing; add helpers for optional equality and dense masks.
src/supervision/detection/compact_mask.py Minor typing/casting cleanups in iteration/sum and internal resizing.
src/supervision/dataset/utils.py Improve typing around deprecated wrappers and class-id remapping.
src/supervision/dataset/formats/yolo.py Tighten typing/dtypes for parsing/serialization and image_shape handling.
src/supervision/dataset/formats/pascal_voc.py Normalize bbox/polygon types and broaden accepted image_shape tuples.
src/supervision/dataset/formats/coco.py Tighten typing for masks/data and ensure boolean masks on export.
src/supervision/dataset/core.py Add casts for cv2.imread return type and broaden image_shape typing for exports.
src/supervision/annotators/utils.py Normalize dtype handling in snap_boxes and add explicit Trace array typings.
src/supervision/annotators/core.py Normalize mask handling for CompactMask and ensure OpenCV outputs are np.uint8.
src/deprecate/init.pyi Add local typing stub for deprecate APIs used throughout the codebase.
pyproject.toml Update mypy python_version to 3.10.
.pre-commit-config.yaml Bump pyproject-fmt and mirrors-mypy hook revisions.

(1 - alpha_float[..., np.newaxis]) * scene_roi
+ alpha_float[..., np.newaxis] * image[:, :, :3]
)
+ alpha_float[..., np.newaxis] * image_np[:, :, :3],
Comment on lines 412 to +416
if self._metric_target == MetricTarget.MASKS:
if isinstance(detections.mask, CompactMask):
return detections.mask.to_dense()
if isinstance(detections.mask, CompactMask):
return detections.mask.to_dense()
Comment on lines 12 to 26
@@ -22,7 +22,7 @@ def xyxy_to_polygons(box: npt.NDArray[np.number]) -> npt.NDArray[np.number]:
An array of polygons (N, 4, 2), where each polygon is
represented as a list of four coordinates in the format `(x, y)`.
"""
polygon = np.zeros((box.shape[0], 4, 2), dtype=box.dtype)
polygon = np.zeros((box.shape[0], 4, 2), dtype=np.float32)
polygon[:, :, 0] = box[:, [0, 2, 2, 0]]

if hasattr(ultralytics_results, "boxes") and ultralytics_results.boxes is None:
masks = extract_ultralytics_masks(ultralytics_results)
assert masks is not None
Comment thread pyproject.toml

[tool.mypy]
python_version = "3.9"
python_version = "3.10"
Borda and others added 2 commits May 13, 2026 20:28
- Replace custom `warn_deprecated` and `deprecated_parameter` with `warnings.warn(..., FutureWarning)` and `deprecate` package
- Add `src/deprecate.pyi` type stub (pydeprecated 0.7.0 ships no stubs)
- Remove `warn_deprecated`, `deprecated_parameter` from `supervision.utils.internal`
- Update test to expect `FutureWarning` instead of `SupervisionWarnings`

---
Co-authored-by: Claude Code <noreply@anthropic.com>
@Borda Borda force-pushed the pre-commit-ci-update-config branch from a6567ba to 38f6bb8 Compare May 13, 2026 18:33
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