Skip to content

fix: remove SciPy from core runtime#233

Merged
abrichr merged 1 commit into
mainfrom
agent/remove-scipy-runtime
Jul 23, 2026
Merged

fix: remove SciPy from core runtime#233
abrichr merged 1 commit into
mainfrom
agent/remove-scipy-runtime

Conversation

@abrichr

@abrichr abrichr commented Jul 23, 2026

Copy link
Copy Markdown
Member

What changed

  • replace ImageHash with an internal Pillow/NumPy/OpenCV pHash, dHash, and
    hexadecimal Hamming-distance implementation
  • preserve the existing public phash_png / phash_distance contract and the
    recorder's settle behavior
  • remove imagehash and pywavelets from the lock and keep SciPy out of the
    core runtime dependency closure
  • route the pixel-identity measurement probe through the same implementation
  • preserve Capture's video-first boundary: its public
    CaptureSession.get_frame_at API abstracts externally provisioned FFmpeg
    video
  • add fixed ImageHash 4.3.2 compatibility vectors and a core-closure regression
    gate

Why

openadapt-flow -> ImageHash -> SciPy pulled SciPy, libquadmath,
libgfortran, and libgcc into the native Desktop sidecar even though Flow
only needs pHash and dHash. The new implementation uses dependencies already in
the validated core and removes that compiled closure without weakening visual
verification.

Compatibility

The serialized hexadecimal format and Hamming-distance behavior are unchanged.
The OpenCV DCT is rescaled to SciPy fftpack's unnormalized DCT-II convention.
Differential validation matched ImageHash exactly on all 306 tracked PNGs both
raw and after REGION_STABLE edge preprocessing (612/612 exact), plus fixed
constant, geometric, 16x16, and seeded-random vectors.

SciPy remains available only through the opt-in dev (scikit-image) and
service-mlx research extras; it is absent from the core export and clean
wheel install.

Validation

  • 57 passed focused recorder/vision/pixel-identity tests
  • 12 passed fixed hash and dependency-closure regressions
  • 3053 passed, 16 skipped across the full non-E2E suite
  • Ruff check and format gates pass for the package and changed tests
  • clean Python 3.12 wheel install: 32 packages; ImageHash, PyWavelets, and SciPy
    absent; hash smoke passed
  • actual wheel and sdist pass check_release_consistency.py --validate-dist-dir
  • wheel core Requires-Dist contains no ImageHash, PyWavelets, or SciPy
  • final artifact SHA-256:
    • wheel: 1b057d8425ddc88d0700e25b76c42b4a592cec2f07ea6d8287386bc47064224b
    • sdist: da93d55ce4770080c1aebcd604893fafe881729cb1377b0723b597c271f4bd97
  • protected CI remains authoritative

@abrichr
abrichr force-pushed the agent/remove-scipy-runtime branch from cbb01af to efeced3 Compare July 23, 2026 23:00
@abrichr
abrichr marked this pull request as ready for review July 23, 2026 23:06
@abrichr
abrichr merged commit 09a9004 into main Jul 23, 2026
17 checks passed
@abrichr
abrichr deleted the agent/remove-scipy-runtime branch July 23, 2026 23:28
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.

1 participant