Skip to content

Drop the scipy dependency to shrink the bundle #29

Description

@LiukDiihMieu

Targeted for before npyquick exits beta — not a current priority (tracking only). If in the future npyquick uses scipy much more, then we no longer need to drop scipy.

Idea

scipy is the single biggest reducible chunk of the packaged app (~70 MB in the AppImage, including a vendored OpenBLAS), yet it's used in exactly one place: core/profile.py calls scipy.ndimage.map_coordinates(..., order=1) to sample the cross-section profile. order=1 is plain bilinear interpolation and can be reimplemented in ~15 lines of NumPy, after which scipy can be dropped from the dependencies entirely.

Why full removal, not partial

Pruning unused scipy submodules from the bundle was tried and is not viable: scipy.ndimage eagerly imports scipy.special, which imports scipy.linalg (→ OpenBLAS), via scipy's array-API / alternative-backend delegation layer (scipy#21150, rolled out in 1.15 and expanded since). That coupling is version-dependent and only growing, so cherry-picking submodules is fragile — it's all-or-nothing.

Acceptance

  • profile.py no longer imports scipy (NumPy-only bilinear sampling, 2D + RGB).
  • scipy removed from pyproject.toml dependencies.
  • Tests pass; cross-section profile behaves identically.
  • Bundle (AppImage/exe) shrinks ~70 MB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    deferredIntentionally postponed; not a current priorityenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions