From 9817598c2ce94e8f765b580d09101a540d537330 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 31 Jan 2024 21:59:06 +0100 Subject: [PATCH 1/2] improved communication of deprecated features --- docs/changelog.md | 18 +++++++++--------- mkdocs.yml | 4 +++- supervision/detection/annotate.py | 5 +++++ supervision/detection/core.py | 7 ++++++- supervision/draw/color.py | 17 +++++++++++------ 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index df8492dbb..84a976504 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -54,18 +54,18 @@ ColorPalette(colors=[Color(r=68, g=1, b=84), Color(r=59, g=82, b=139), ...]) - Changed [#756](https://github.com/roboflow/supervision/pull/756): [`sv.Color`](https://supervision.roboflow.com/draw/color/#color)'s and [`sv.ColorPalette`](https://supervision.roboflow.com/draw/color/#colorpalette)'s method of accessing predefined colors, transitioning from a function-based approach (`sv.Color.red()`) to a more intuitive and conventional property-based method (`sv.Color.RED`). -!!! warning +!!! failure "Deprecated" - `sv.ColorPalette.default()` is deprecated and will be removed in `supervision-0.21.0`. Use `sv.ColorPalette.DEFAULT` instead. + `sv.ColorPalette.default()` is deprecated and will be removed in `supervision-0.22.0`. Use `sv.ColorPalette.DEFAULT` instead. - Changed [#769](https://github.com/roboflow/supervision/pull/769): [`sv.ColorPalette.DEFAULT`](https://supervision.roboflow.com/draw/color/#colorpalette) value, giving users a more extensive set of annotation colors. - Changed [#677](https://github.com/roboflow/supervision/pull/677): `sv.Detections.from_roboflow` to [`sv.Detections.from_inference`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_inference) streamlining its functionality to be compatible with both the both [inference](https://github.com/roboflow/inference) pip package and the Robloflow [hosted API](https://docs.roboflow.com/deploy/hosted-api). -!!! warning +!!! failure "Deprecated" - `Detections.from_roboflow()` is deprecated and will be removed in `supervision-0.21.0`. Use `Detections.from_inference` instead. + `Detections.from_roboflow()` is deprecated and will be removed in `supervision-0.22.0`. Use `Detections.from_inference` instead. - Fixed [#735](https://github.com/roboflow/supervision/pull/735): [`sv.LineZone`](https://supervision.roboflow.com/detection/tools/line_zone/#linezone) functionality to accurately update the counter when an object crosses a line from any direction, including from the side. This enhancement enables more precise tracking and analytics, such as calculating individual in/out counts for each lane on the road. @@ -162,7 +162,7 @@ ColorPalette(colors=[Color(r=68, g=1, b=84), Color(r=59, g=82, b=139), ...]) - Fixed [#430](https://github.com/roboflow/supervision/pull/430): [`sv.ByteTrack`](https://supervision.roboflow.com/trackers/#supervision.tracker.byte_tracker.core.ByteTrack) to return `np.array([], dtype=int)` when `svDetections` is empty. -!!! warning +!!! failure "Deprecated" `sv.Detections.from_yolov8` and `sv.Classifications.from_yolov8` as those are now replaced by [`sv.Detections.from_ultralytics`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_ultralytics) and [`sv.Classifications.from_ultralytics`](https://supervision.roboflow.com/classification/core/#supervision.classification.core.Classifications.from_ultralytics). @@ -231,9 +231,9 @@ ColorPalette(colors=[Color(r=68, g=1, b=84), Color(r=59, g=82, b=139), ...]) - Added [#281](https://github.com/roboflow/supervision/pull/281): [`sv.Classifications.from_ultralytics`](https://supervision.roboflow.com/classification/core/#supervision.classification.core.Classifications.from_ultralytics) to enable seamless integration with [Ultralytics](https://github.com/ultralytics/ultralytics) framework. This will enable you to use supervision with all [models](https://docs.ultralytics.com/models/) that Ultralytics supports. -!!! warning +!!! failure "Deprecated" - [sv.Detections.from_yolov8](https://roboflow.github.io/supervision/detection/core/#supervision.detection.core.Detections.from_yolov8) and [sv.Classifications.from_yolov8](https://supervision.roboflow.com/classification/core/#supervision.classification.core.Classifications.from_yolov8) are now deprecated and will be removed with supervision-0.16.0 release. + [sv.Detections.from_yolov8](https://roboflow.github.io/supervision/detection/core/#supervision.detection.core.Detections.from_yolov8) and [sv.Classifications.from_yolov8](https://supervision.roboflow.com/classification/core/#supervision.classification.core.Classifications.from_yolov8) are now deprecated and will be removed with `supervision-0.16.0` release. - Added [#341](https://github.com/roboflow/supervision/pull/341): First supervision usage example script showing how to detect and track objects on video using YOLOv8 + Supervision. @@ -269,7 +269,7 @@ ColorPalette(colors=[Color(r=68, g=1, b=84), Color(r=59, g=82, b=139), ...]) - Added [#222](https://github.com/roboflow/supervision/pull/222): [`sv.Detections.from_ultralytics`](https://roboflow.github.io/supervision/detection/core/#supervision.detection.core.Detections.from_ultralytics) to enable seamless integration with [Ultralytics](https://github.com/ultralytics/ultralytics) framework. This will enable you to use `supervision` with all [models](https://docs.ultralytics.com/models/) that Ultralytics supports. -!!! warning +!!! failure "Deprecated" [`sv.Detections.from_yolov8`](https://roboflow.github.io/supervision/detection/core/#supervision.detection.core.Detections.from_yolov8) is now deprecated and will be removed with `supervision-0.15.0` release. @@ -279,7 +279,7 @@ ColorPalette(colors=[Color(r=68, g=1, b=84), Color(r=59, g=82, b=139), ...]) ### 0.12.0 July 24, 2023 -!!! warning +!!! failure "Python 3.7. Support Terminated" With the `supervision-0.12.0` release, we are terminating official support for Python 3.7. diff --git a/mkdocs.yml b/mkdocs.yml index 0c4926c9d..b1070f6ea 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -57,7 +57,9 @@ nav: - Notebook: utils/notebook.md - File: utils/file.md - Assets: assets.md - - Changelog: changelog.md + - Changelog: + - Changelog: changelog.md + - Deprecated: deprecated.md theme: name: 'material' diff --git a/supervision/detection/annotate.py b/supervision/detection/annotate.py index ff8a3ca2b..f1a42797c 100644 --- a/supervision/detection/annotate.py +++ b/supervision/detection/annotate.py @@ -5,8 +5,13 @@ from supervision.detection.core import Detections from supervision.draw.color import Color, ColorPalette +from supervision.utils.internal import deprecated +@deprecated( + "`BoxAnnotator` is deprecated and will be removed in " + "`supervision-0.22.0`. Use `BoundingBoxAnnotator` and `LabelAnnotator` instead" +) class BoxAnnotator: """ A class for drawing bounding boxes on an image using detections provided. diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 38964052b..7b9249630 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -500,10 +500,15 @@ def from_inference(cls, roboflow_result: Union[dict, Any]) -> Detections: @classmethod @deprecated( "`Detections.from_roboflow` is deprecated and will be removed in " - "`supervision-0.21.0`. Use `Detections.from_inference` instead." + "`supervision-0.22.0`. Use `Detections.from_inference` instead." ) def from_roboflow(cls, roboflow_result: Union[dict, Any]) -> Detections: """ + !!! failure "Deprecated" + + `Detections.from_roboflow` is deprecated and will be removed in + `supervision-0.22.0`. Use `Detections.from_inference` instead. + Create a Detections object from the [Roboflow](https://roboflow.com/) API inference result or the [Inference](https://inference.roboflow.com/) package results. diff --git a/supervision/draw/color.py b/supervision/draw/color.py index b592e6609..491a23809 100644 --- a/supervision/draw/color.py +++ b/supervision/draw/color.py @@ -206,7 +206,7 @@ def ROBOFLOW(cls): @classmethod @deprecated( "`Color.white()` is deprecated and will be removed in " - "`supervision-0.20.0`. Use `Color.WHITE` instead." + "`supervision-0.22.0`. Use `Color.WHITE` instead." ) def white(cls) -> Color: return Color.from_hex(color_hex="#ffffff") @@ -214,7 +214,7 @@ def white(cls) -> Color: @classmethod @deprecated( "`Color.black()` is deprecated and will be removed in " - "`supervision-0.20.0`. Use `Color.BLACK` instead." + "`supervision-0.22.0`. Use `Color.BLACK` instead." ) def black(cls) -> Color: return Color.from_hex(color_hex="#000000") @@ -222,7 +222,7 @@ def black(cls) -> Color: @classmethod @deprecated( "`Color.red()` is deprecated and will be removed in " - "`supervision-0.20.0`. Use `Color.RED` instead." + "`supervision-0.22.0`. Use `Color.RED` instead." ) def red(cls) -> Color: return Color.from_hex(color_hex="#ff0000") @@ -230,7 +230,7 @@ def red(cls) -> Color: @classmethod @deprecated( "`Color.green()` is deprecated and will be removed in " - "`supervision-0.20.0`. Use `Color.GREEN` instead." + "`supervision-0.22.0`. Use `Color.GREEN` instead." ) def green(cls) -> Color: return Color.from_hex(color_hex="#00ff00") @@ -238,7 +238,7 @@ def green(cls) -> Color: @classmethod @deprecated( "`Color.blue()` is deprecated and will be removed in " - "`supervision-0.20.0`. Use `Color.BLUE` instead." + "`supervision-0.22.0`. Use `Color.BLUE` instead." ) def blue(cls) -> Color: return Color.from_hex(color_hex="#0000ff") @@ -297,10 +297,15 @@ def LEGACY(cls) -> ColorPalette: @classmethod @deprecated( "`ColorPalette.default()` is deprecated and will be removed in " - "`supervision-0.20.0`. Use `Color.DEFAULT` instead." + "`supervision-0.22.0`. Use `Color.DEFAULT` instead." ) def default(cls) -> ColorPalette: """ + !!! failure "Deprecated" + + `ColorPalette.default()` is deprecated and will be removed in + `supervision-0.22.0`. Use `Color.DEFAULT` instead. + Returns a default color palette. Returns: From 3d2530f3a6f77ff6e5e8f980df5fa180d9ed0f15 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 21:02:29 +0000 Subject: [PATCH 2/2] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto=20?= =?UTF-8?q?format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/draw/color.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/draw/color.py b/supervision/draw/color.py index 491a23809..635ef47fd 100644 --- a/supervision/draw/color.py +++ b/supervision/draw/color.py @@ -305,7 +305,7 @@ def default(cls) -> ColorPalette: `ColorPalette.default()` is deprecated and will be removed in `supervision-0.22.0`. Use `Color.DEFAULT` instead. - + Returns a default color palette. Returns: