Skip to content

Add scipy and dependencies for Kalico hx711s-new tap filtering#201

Open
pdscomp wants to merge 15 commits into
james/hx711sfrom
paul/hx711s
Open

Add scipy and dependencies for Kalico hx711s-new tap filtering#201
pdscomp wants to merge 15 commits into
james/hx711sfrom
paul/hx711s

Conversation

@pdscomp

@pdscomp pdscomp commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

This PR adds the scipy scientific computing stack and its dependencies needed for the Kalico hx711s-new branch tap filtering module.

Changes

  • python3-scipy 1.14.1 — scientific computing library (uses scipy.signal for Butterworth filter design)
  • python3-pythran 0.16.1 — scipy's C++ code generator
  • python3-beniget 0.4.2.post1 — pythran dependency
  • openblas 0.3.28 — optimized BLAS/LAPACK (lapack enabled, openmp disabled for ARM)
  • xsimd 13.0.0 — C++ SIMD library
  • python3-pybind11 bbappend — bump to 2.12.0 (required by scipy)
  • lapack bbappend — enable lapacke config
  • cosmos.conf — add Fortran compiler settings for cross-compilation
  • kalico recipe — add python3-scipy to RDEPENDS
  • README — document all python packages in recipes-python/

Build verification

Full image build completed successfully (5977 tasks).
Confirmed in rootfs manifest: openblas, python3-numpy, python3-scipy.

Why not meta-python-ai?

Cherry-picked only the needed recipes from meta-python-ai (scarthgap) to avoid pulling in LLVM and 100+ AI/ML packages we don't need.

@pdscomp pdscomp requested a deployment to approval-needed June 7, 2026 21:34 — with GitHub Actions Waiting
@pdscomp pdscomp requested a review from jamesturton June 7, 2026 21:40
@pdscomp pdscomp temporarily deployed to approval-needed June 8, 2026 15:52 — with GitHub Actions Inactive
@pdscomp pdscomp temporarily deployed to approval-needed June 8, 2026 20:43 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

✅ Build Artifacts

Branch: paul/hx711s
Build: 339f701 (merge into james/hx711s)

Artifact Size
CC1 Firmware 134.07 MB

View workflow run

pdscomp added 4 commits June 9, 2026 09:09
Drops ~30% off numpy/scipy footprint by stripping debug info from
all .so files under ${PYTHON_SITEPACKAGES_DIR} using both
${HOST_PREFIX}strip and ${TARGET_PREFIX}strip to handle
cross-compiled artifacts.
Adds 'inherit strip-python-sos' so .so files under site-packages
are stripped during do_install. Also prunes unused numpy submodules
(Track B audit) and adds INSANE_SKIP for already-stripped.
Adds 'find ${D} -name '*.so' -type f -exec ${TARGET_PREFIX}strip --strip-unneeded {} \;'
to kalico do_install to strip debug info from the cross-compiled
c_helper.so and any other shared objects. Also adds INSANE_SKIP
'already-stripped' to suppress QA warnings.
…Kalico hx711s tap filter

Drop-in replacement: 'import scipy.signal' works without any Kalico source changes.
Only 4 scipy.signal functions needed by Kalico's sos_filter.py:
  - butter(N, Wn, btype, fs, output='sos')
  - iirnotch(w0, Q, fs)
  - tf2sos(b, a)
  - sosfilt_zi(sos)
All 41 validation tests pass (atol=1e-9 vs real scipy 1.17.1).
@pdscomp pdscomp temporarily deployed to approval-needed June 9, 2026 14:47 — with GitHub Actions Inactive
The hx711s tap filter now uses scipy-shim instead. python3-scipy
and its openblas dependency are no longer needed. Kalico's
'import scipy.signal' continues to work unchanged.
@pdscomp pdscomp temporarily deployed to approval-needed June 9, 2026 17:42 — with GitHub Actions Inactive
@pdscomp pdscomp temporarily deployed to approval-needed June 9, 2026 18:58 — with GitHub Actions Inactive
@pdscomp pdscomp temporarily deployed to approval-needed June 9, 2026 21:41 — with GitHub Actions Inactive
@pdscomp pdscomp temporarily deployed to approval-needed June 10, 2026 12:14 — with GitHub Actions Inactive
@pdscomp pdscomp temporarily deployed to approval-needed June 11, 2026 00:40 — with GitHub Actions Inactive
- Remove numpy 2.0 stub layer (numpy/_core) — not used at runtime
- Remove _typing stubs — only needed at type-check time, not runtime
- Remove all test directories (core/tests, lib/tests, linalg/tests, fft/tests)
- Remove build-time artifacts: conftest.py, setup.py, matlib.py, __pycache__
- Replace numpy/lib/ with a minimal version:
  - __init__.py (only imports function_base)
  - function_base.py (real file — kaiser, interp)
  - twodim_base.py (real file — diag used by function_base.py)
  - _utils.py (minimal stub — set_module decorator)
  - _version.py (minimal stub)
- All other lib/ submodules (index_tricks, histograms, npyio,
  type_check, nanfunctions, shape_base, stride_tricks, ufunclike,
  arraysetops, arraypad, arrayterator, format, scimath, recfunctions,
  mixins) are never used by kalico and removed

Result: numpy installed size 19.0 MB → 8.7 MB (-10.3 MB, ~55% reduction).
All 5638 tasks pass, image builds clean.
@github-actions

Copy link
Copy Markdown

✅ Build Artifacts

Branch: paul/hx711s
Build: 51e2a82 (merge into james/hx711s)

Artifact Size
CC1 Firmware 83.87 MB

View workflow run

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