Skip to content

fix: stop using scikit-build internals - #1274

Merged
asmorkalov merged 1 commit into
opencv:4.xfrom
henryiii:henryiii/fix/skbuild-internals
Nov 12, 2026
Merged

asmorkalov merged 1 commit into
opencv:4.xfrom
henryiii:henryiii/fix/skbuild-internals

Conversation

@henryiii

@henryiii henryiii commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

This is a minimal change just moving the parts that are monkey patched so scikit-build (classic) will work after the 1.0 release. Another option would be to move to sciit-build-core, but that changes a bit more (and I think builds on this pretty well).

🤖 AI text below 🤖

Fixes #1250.

setup.py monkeypatched skbuild.setuptools_wrap._classify_installed_files and used skbuild.cmaker.CMaker. scikit-build 1.0 (now based on scikit-build-core) removes both. This PR removes that dependency and keeps the wheel layout the same:

  • A CMake install step lays out the cv2 package under <prefix>/cv2, with the same rules as the old regexes. OpenCV's OPENCV_CMAKE_HOOKS_DIR (POST_FINALIZE hook) adds it, so the opencv submodule is not changed. Required files still fail the build if missing.
  • cmake_process_manifest_hook keeps only cv2/** from the install.
  • The Python include dir and library now come from sysconfig.

This works with scikit-build 0.x and 1.0. I built headless wheels locally on macOS arm64 (Python 3.12) with scikit-build 0.19.1 before and after the change, and with 1.0.0rc1 after. The file lists and contents match, except for the compiled module and the generated cv2/typing/__init__.py (the import order changes from build to build). I did not test Windows (ffmpeg DLL, python3XY.lib) or the Linux Qt plugins and fonts locally.

Build the cv2 package layout in a CMake install step, added through
OpenCV's OPENCV_CMAKE_HOOKS_DIR, and keep only those files with
cmake_process_manifest_hook. This replaces the monkeypatch of
skbuild.setuptools_wrap._classify_installed_files. Get the Python paths
from sysconfig instead of skbuild.cmaker.CMaker. Both are gone in
scikit-build 1.0.

Fixes opencv#1250.

Assisted-by: ClaudeCode:claude-opus-5-5
@asmorkalov asmorkalov self-assigned this Nov 11, 2026
@asmorkalov

Copy link
Copy Markdown
Collaborator

Checked linux and windows packages manually. Looks good.

@asmorkalov
asmorkalov merged commit 65678cc into opencv:4.x Nov 12, 2026
261 checks passed
@asmorkalov

Copy link
Copy Markdown
Collaborator

@henryiii Thanks a lot for the contribution! Could you submit similar PR to the 5.x branch too?

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.

Scikit-build (classic) 1.0 internals

2 participants