Skip to content

feat(cv2): remove OpenCV dependency - #2443

Open
Borda wants to merge 19 commits into
developfrom
cv2/8-9
Open

feat(cv2): remove OpenCV dependency#2443
Borda wants to merge 19 commits into
developfrom
cv2/8-9

Conversation

@Borda

@Borda Borda commented Jul 17, 2026

Copy link
Copy Markdown
Member

This pull request removes OpenCV as a runtime dependency and extra from Supervision, making the package rely on its included fallback backend by default. It introduces new release-contract checks, updates documentation to guide users through the migration, and adds CI validation to ensure the wheel works in environments without OpenCV.

Dependency and Packaging Changes

  • Removed OpenCV from the dependencies list in pyproject.toml, so Supervision no longer installs or requires any OpenCV distribution by default.

Continuous Integration and Release Checks

  • Added a clean-wheel CI job to build, install, and validate the Supervision wheel in an isolated environment without OpenCV, using a new .github/scripts/verify_clean_wheel.py script and a fallback manifest for explicit checks. [1] [2] [3]
  • Introduced tests/cv2/test_release.py to assert that OpenCV is not listed as a dependency and that migration documentation is present and up-to-date.

Documentation Updates

  • Added a migration guide (docs/how_to/opencv_migration.md) explaining how to use Supervision with or without OpenCV, backend selection, and best practices for different application types.
  • Updated the changelog to announce the OpenCV removal, clarify the new backend behavior, and reference the migration guide. [1] [2]
  • Updated the FAQ to state that Supervision does not install OpenCV and to link to the migration guide.
  • Added the migration guide to the documentation navigation.

cc: @robmarkcole
closes #2114

BREAKING CHANGE: Supervision no longer installs OpenCV. Install one ambient OpenCV wheel family when native behavior is required.

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 removes OpenCV (opencv-python) as a runtime dependency of Supervision so the package defaults to its bundled fallback backend, and adds release/CI guardrails + documentation to ensure the wheel remains usable in environments where cv2 is not installed.

Changes:

  • Dropped opencv-python from pyproject.toml (and corresponding lockfile metadata).
  • Added a new “clean wheel” CI job plus a wheel verification script + manifest to validate installs in an environment without OpenCV.
  • Added/updated documentation (migration guide, FAQ, changelog) and a release-contract test to keep the migration discoverable and prevent OpenCV from reappearing as a dependency/extra.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
uv.lock Removes OpenCV from the lock; updates Requires-Dist metadata to match updated deps.
pyproject.toml Removes opencv-python from runtime dependencies.
tests/cv2/test_release.py Adds release-contract checks to ensure no OpenCV dependency/extra and that migration docs exist.
tests/cv2/installed_wheel_fallback_manifest.txt Declares the exact smoke-check contract used by the clean-wheel verifier.
.github/workflows/ci-tests.yml Adds clean-wheel matrix job and gates the guardian job on it.
.github/scripts/verify_clean_wheel.py Implements wheel metadata checks + installed-environment smoke probe for fallback behavior.
docs/how_to/opencv_migration.md New migration guide describing how to run with fallback or an explicitly installed OpenCV wheel.
docs/faq.md Updates FAQ to state OpenCV is not installed and links the migration guide.
docs/changelog.md Documents the breaking change and aligns wording/requirements with the new backend behavior.
mkdocs.yml Adds the migration guide to documentation navigation.

Comment thread tests/cv2/test_release.py Outdated
Comment thread tests/cv2/test_release.py Outdated
Comment thread .github/scripts/verify_clean_wheel.py
Borda and others added 4 commits July 17, 2026 20:09
- Keep the fallback suite on supported Python versions.
- Exercise full and headless OpenCV wheels on Python 3.14 across all CI platforms.

---

Co-authored-by: Codex <codex@openai.com>
- Match addWeighted keyword arguments and keep doctests cv2-free.
- Update pywin32 lock data for Windows CPython 3.14.

---

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

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87%. Comparing base (5212af7) to head (75002b3).

Additional details and impacted files
@@           Coverage Diff           @@
##           develop   #2443   +/-   ##
=======================================
+ Coverage       87%     87%   +1%     
=======================================
  Files           85      85           
  Lines        11933   11935    +2     
=======================================
+ Hits         10342   10429   +87     
+ Misses        1591    1506   -85     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Borda Borda added the enhancement New feature or request label Jul 17, 2026
Borda and others added 5 commits July 17, 2026 21:55
- Assert stable Douglas-Peucker invariants across OpenCV major versions.
- Print installed CI packages to diagnose matrix-specific failures.

---

Co-authored-by: Codex <codex@openai.com>
[resolve #1] Review by @Copilot (PR #2443):
"This test asserts that the substring 'opencv' is absent anywhere in pypr..."
Challenge: evidence=VALID suggestion=VALID resolution=as-suggested

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
[resolve #2] Review by @Copilot (PR #2443):
"These documentation assertions are case/formatting sensitive, which make..."
Challenge: evidence=VALID suggestion=REJECT resolution=self-resolved

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
[resolve #3] Review by @Copilot (PR #2443):
"_validate_manifest() treats a line as a comment only if it starts with '..."
Challenge: evidence=VALID suggestion=VALID resolution=as-suggested

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: opencv-python dependency of supervision overrides opencv-contrib-python dependency

2 participants