Skip to content

refactor: deprecate ByteTrack class in favor of ByteTrackTracker#2215

Merged
Borda merged 2 commits intodevelopfrom
depercate-trackers
Apr 16, 2026
Merged

refactor: deprecate ByteTrack class in favor of ByteTrackTracker#2215
Borda merged 2 commits intodevelopfrom
depercate-trackers

Conversation

@Borda
Copy link
Copy Markdown
Member

@Borda Borda commented Apr 16, 2026

This pull request updates deprecation handling in the codebase to use the new deprecated_class decorator and removes workarounds related to the previous deprecation implementation. Additionally, it updates the pydeprecate dependency to a newer compatible version.

Deprecation handling improvements:

  • Replaced usage of the @deprecated decorator with @deprecated_class for class deprecations in both MeanAveragePrecision and ByteTrack, ensuring more accurate deprecation warnings and future compatibility. [1] [2]
  • Removed the workaround that manually rebound static methods for deprecated classes, as this is no longer necessary with the updated deprecation approach.

Dependency updates:

  • Updated the pydeprecate dependency version in pyproject.toml to >=0.7,<0.8 to support the new deprecation features.

Code consistency:

  • Updated import statements to use deprecated_class instead of deprecated where appropriate. [1] [2]

Deprecation notice improvements:

  • Added detailed deprecation notice to the ByteTrack class docstring, guiding users to migrate to ByteTrackTracker from the trackers package.

closes #2202
closes #1985
closes #1367
closes #1355
closes #1320
closes #594
closes #2206
closes #2009
closes #1404
closes #782
closes #2193
closes #1381
closes #1318

- Mark `ByteTrack` as deprecated using `@deprecated_class`.
- Add deprecation details and alternatives in the class docstring.
- Update version annotations for deprecation (`deprecated_in="0.28.0"`, `remove_in="0.30.0"`).
Copilot AI review requested due to automatic review settings April 16, 2026 14:24
@Borda Borda requested a review from SkalskiP as a code owner April 16, 2026 14:24
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 refactors class deprecation handling to use deprecated_class (instead of deprecated) and removes now-unnecessary workaround code related to deprecated-class wrapping behavior, while also updating the pydeprecate dependency requirement to support the new decorator.

Changes:

  • Switched MeanAveragePrecision and ByteTrack to @deprecated_class(...) for class deprecations.
  • Removed the manual staticmethod rebinding workaround previously needed for deprecated classes on Python 3.9.
  • Updated pydeprecate version constraint in pyproject.toml.

Reviewed changes

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

File Description
src/supervision/tracker/byte_tracker/core.py Deprecates ByteTrack via deprecated_class and adds a migration note in the docstring.
src/supervision/metrics/detection.py Uses deprecated_class for MeanAveragePrecision and removes the deprecated-wrapper staticmethod workaround.
pyproject.toml Bumps pydeprecate dependency range to support deprecated_class.

Comment thread pyproject.toml
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77%. Comparing base (c61fbf6) to head (4b97074).
⚠️ Report is 1 commits behind head on develop.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants