mirror of
https://github.com/Klipper4FlashForge/firmware.git
synced 2026-10-21 12:52:16 -05:00
extras/stepper_resonance_tester.py opens with a bare `import numpy as np`; klippy.py:122 walks EVERY config section through a load_object whose importlib.import_module is not wrapped in except ImportError; printer.base.cfg includes FlashForge's printer.vibration.cfg, which declares [stepper_resonance_tester]. Since klippy moved to our own CPython 3.13 that has not been a printer missing resonance testing. It has been a klippy that never reaches ready. So this is not a scientific extra. anvil-klipper depends on anvil-python-numpy the way it depends on cffi, except that the others mean "klippy imports this" and this one means "klippy starts". It also gives back SHAPER_CALIBRATE and TEST_RESONANCES, dead since the same switch, and the VFA calibration behind STEPPER_RESONANCE_FACTORY_CALIBRATE that docs/notes/44-vfa-calibration.md traces end to end. WHAT WAS NOT OBVIOUS, in the order it bit. numpy 2.x builds with meson-python, and meson has never heard of _PYTHON_SYSCONFIGDATA_NAME -- the trick every other python-* recipe here leans on. pkg_mesoncross writes a real cross file instead, naming the $PKG_XW wrappers rather than the raw toolchain: the wrappers carry -EL -mnan=2008, and a cross file that reaches past them builds a tree that passes every gate which only reads symbols and is refused at exec() on the printer. pkg_pywheel grew a PKG_PY_PIP_ARGS branch to pass the file as --config-settings, which is the one thing PEP 517 does standardise. The cross file's `python =` is the BUILD python, and that is not a mistake: meson introspects an interpreter by running it and asking sysconfig, and pkg_pytarget has already made that sysconfig answer for mipsel. The old trick does reach meson, just not by its own mechanism. numpy's meson.build hard-errors below gcc 8.4 and ours is 7.2. The gate is the SciPy Toolchain Roadmap's support statement, not a requirement of the code: this toolchain compiles if constexpr, structured bindings, std::optional, std::string_view, and pocketfft_hdronly.h -- 3635 lines of the heaviest template C++ in the tree, and the half np.fft.rfft needs. Probed before the floor was lowered, and lowered rather than removed, behind a guard that fails loudly if upstream moves the check. 19 extension modules, every one at e_flags 0x70001405/0x70001407, 14MB shipped after pruning tests/, f2py/, stubs and static libs. meson-python is self-hosting, so pkg_buildpython runs meson and ninja just to install the backend -- hence ninja-build in the image and PYPKG_HOST_LIST in dependency order rather than alphabetical. And pip puts meson and cython in work/.py-host/bin, which nothing had ever looked in: without that on PATH the backend fails to install with `meson executable "meson" not found` while pip list shows it right there. THE GATE THAT WOULD HAVE CAUGHT ALL OF IT is qa/replica/test_klippy_extras_import.py: walk the real /usr/data/config include graph, map every section to its extra, import each on the printer's own interpreter. It needs no MCU, because config load happens before klippy:mcu_identify. Nothing asked that question before, which is how two comments in this repo came to assert the module guarded its own import. test_numpy.py asks for numeric answers rather than a module object -- linalg.lstsq specifically, because -Dallow-noblas selects the bundled lapack_lite and _r2_sinusoidal_fit calls it every calibration round. And test_install.py's include check read only ff-*.cfg, so FlashForge's four -- printer.vibration.cfg among them -- were never asked about at all. ff-toolchange.cfg wraps the two search commands in _FF_SHAPER_PREP, as SHAPER_CALIBRATE already was. STEPPER_RESONANCE_FACTORY_CALIBRATE is deliberately NOT wrapped: it is a gcode_macro, not a registered command, and same-named sections merge under RawConfigParser(strict=False) -- a wrapper would not wrap it, it would BE it, with rename_existing pointing at itself. It needs none, since its body is two calls to a command that is wrapped. No SAVE_CONFIG in any macro either; it restarts klippy and stays the operator's. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EJr2x7aDaY889qwSxbdLt8
37 lines
1.9 KiB
Plaintext
37 lines
1.9 KiB
Plaintext
# anvil-python-numpy -- numpy for the printer's CPython, into its
|
|
# site-packages.
|
|
#
|
|
# THIS IS NOT AN OPTIONAL SCIENTIFIC EXTRA. It is the package klippy cannot
|
|
# start without. extras/stepper_resonance_tester.py opens with a bare
|
|
# `import numpy as np`; klippy.py:122 walks EVERY config section through a
|
|
# load_object that does not catch ImportError; and printer.base.cfg includes
|
|
# FlashForge's printer.vibration.cfg, which declares [stepper_resonance_tester].
|
|
# So on a numpy-less install klippy never reaches ready -- it does not merely
|
|
# lose a feature. anvil-klipper names this package in its Depends for that
|
|
# reason. docs/notes/44-vfa-calibration.md has the whole chain.
|
|
#
|
|
# WHAT IT BUYS BACK, beyond the boot: the VFA (motor torque-ripple) calibration
|
|
# behind STEPPER_RESONANCE_FACTORY_CALIBRATE, and SHAPER_CALIBRATE /
|
|
# TEST_RESONANCES, which have been dead for exactly the same reason since
|
|
# klippy moved to our own CPython 3.13.
|
|
PKG_NAME=anvil-python-numpy
|
|
|
|
# ARCHITECTURE IS THE DEFAULT, mipsel_xburst2, and it is not a formality here
|
|
# any more than it is for anvil-klipper: this package is mostly compiled code.
|
|
# An `all` would let it install on a machine whose kernel refuses every .so in
|
|
# it, and the failure would arrive as an ImportError halfway through a boot.
|
|
PKG_VERSION="$(pypkg_version numpy)"
|
|
PKG_RELEASE=1
|
|
PKG_SECTION=python
|
|
PKG_EXCLUDE=".version"
|
|
|
|
PKG_DEPENDS="anvil-python"
|
|
|
|
# python ALONE, and no BLAS: -Dallow-noblas=true below picks numpy's bundled
|
|
# lapack_lite instead. That is not a corner cut for size -- there is no BLAS in
|
|
# this feed to link against, and lapack_lite is enough for the one linalg call
|
|
# the calibration makes (np.linalg.lstsq, in _r2_sinusoidal_fit).
|
|
PKG_BUILD_DEPENDS="python"
|
|
|
|
PKG_DESCRIPTION="numpy for klippy -- the FFT, least-squares and polynomial fitting that extras/stepper_resonance_tester.py and shaper_calibrate.py are written against. Built with meson-python against a cross file, without BLAS."
|