From f28874c0c2aa0bd3c4c16b37fa1f30cc80424bf3 Mon Sep 17 00:00:00 2001 From: jirka <6035284+Borda@users.noreply.github.com> Date: Wed, 15 Apr 2026 14:35:30 +0200 Subject: [PATCH] fix: move keypoint shims to src/ and use warn_deprecated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move supervision/keypoint/ → src/supervision/keypoint/ so shims are included in built wheels (project uses src layout) - Replace raw DeprecationWarning with warn_deprecated (SupervisionWarnings) in all three shim files for consistent warning behaviour - Fix wrong import path (supervision.utils.deprecation → .internal) and remove unsupported stacklevel arg from warn_deprecated call [resolve #7] Review comment by @copilot (PR #2214): "This warning uses the standard DeprecationWarning..." [resolve #8] Review comment by @copilot (PR #2214): "These deprecation shim modules are added under the top-level supervision/..." --- Co-authored-by: Claude Code --- .../supervision}/keypoint/__init__.py | 5 ++--- src/supervision/keypoint/annotators.py | 13 +++++++++++++ src/supervision/keypoint/core.py | 8 ++++++++ supervision/keypoint/annotators.py | 15 --------------- supervision/keypoint/core.py | 10 ---------- 5 files changed, 23 insertions(+), 28 deletions(-) rename {supervision => src/supervision}/keypoint/__init__.py (66%) create mode 100644 src/supervision/keypoint/annotators.py create mode 100644 src/supervision/keypoint/core.py delete mode 100644 supervision/keypoint/annotators.py delete mode 100644 supervision/keypoint/core.py diff --git a/supervision/keypoint/__init__.py b/src/supervision/keypoint/__init__.py similarity index 66% rename from supervision/keypoint/__init__.py rename to src/supervision/keypoint/__init__.py index e379f317..ca7ff825 100644 --- a/supervision/keypoint/__init__.py +++ b/src/supervision/keypoint/__init__.py @@ -1,9 +1,8 @@ -from supervision.utils.deprecation import warn_deprecated +from supervision.utils.internal import warn_deprecated warn_deprecated( "The 'supervision.keypoint' module is deprecated in `0.27.0` and will be removed " - "in `0.30.0`. Please use 'supervision.key_points' instead.", - stacklevel=2, + "in `0.30.0`. Please use 'supervision.key_points' instead." ) from supervision.key_points.annotators import ( diff --git a/src/supervision/keypoint/annotators.py b/src/supervision/keypoint/annotators.py new file mode 100644 index 00000000..574d3420 --- /dev/null +++ b/src/supervision/keypoint/annotators.py @@ -0,0 +1,13 @@ +from supervision.utils.internal import warn_deprecated + +warn_deprecated( + "The 'supervision.keypoint' module is deprecated in `0.27.0` and will be removed " + "in `0.30.0`. Please use 'supervision.key_points' instead." +) + +from supervision.key_points.annotators import ( # noqa: E402, F401 + BaseKeyPointAnnotator, + EdgeAnnotator, + VertexAnnotator, + VertexLabelAnnotator, +) diff --git a/src/supervision/keypoint/core.py b/src/supervision/keypoint/core.py new file mode 100644 index 00000000..89206006 --- /dev/null +++ b/src/supervision/keypoint/core.py @@ -0,0 +1,8 @@ +from supervision.utils.internal import warn_deprecated + +warn_deprecated( + "The 'supervision.keypoint' module is deprecated in `0.27.0` and will be removed " + "in `0.30.0`. Please use 'supervision.key_points' instead." +) + +from supervision.key_points.core import KeyPoints # noqa: E402, F401 diff --git a/supervision/keypoint/annotators.py b/supervision/keypoint/annotators.py deleted file mode 100644 index ce95caed..00000000 --- a/supervision/keypoint/annotators.py +++ /dev/null @@ -1,15 +0,0 @@ -import warnings - -warnings.warn( - "The 'supervision.keypoint' module is deprecated in `0.27.0` and will be removed " - "in `0.30.0`. Please use 'supervision.key_points' instead.", - DeprecationWarning, - stacklevel=2, -) - -from supervision.key_points.annotators import ( # noqa: F401, E402 - BaseKeyPointAnnotator, - EdgeAnnotator, - VertexAnnotator, - VertexLabelAnnotator, -) diff --git a/supervision/keypoint/core.py b/supervision/keypoint/core.py deleted file mode 100644 index 470b02b2..00000000 --- a/supervision/keypoint/core.py +++ /dev/null @@ -1,10 +0,0 @@ -import warnings - -warnings.warn( - "The 'supervision.keypoint' module is deprecated in `0.27.0` and will be removed " - "in `0.30.0`. Please use 'supervision.key_points' instead.", - DeprecationWarning, - stacklevel=2, -) - -from supervision.key_points.core import KeyPoints # noqa: F401, E402