Defer jq import and add TYPE_CHECKING guards in lens JQ components
3 files · 11+ · 6-

Defer jq import and use TYPE_CHECKING for LensCapability

3 files changed
  • lens.py Moved `import jq` from module level into execute_query() — deferred to first actual lens execution rather than component registration
  • lens_jq.py Replaced runtime `from ..capabilities.lens import LensCapability` with TYPE_CHECKING guard; added from __future__ import annotations
  • lens_jq.py Replaced runtime LensCapability import with TYPE_CHECKING guard; added from __future__ import annotations
  • jq is now imported lazily inside execute_query() rather than at the module top level. During component discovery, pyvider imports every registered module — a top-level jq import would force jq resolution at discovery time even if no lens query is ever executed. Deferring to the call site avoids this overhead. decouple behavioral
    1 file
    • lens.py
  • LensCapability imports in lens_jq.py and functions/lens_jq.py moved to TYPE_CHECKING blocks, breaking the circular discovery-time import while retaining full type annotations for type checkers. decouple behavioral
    2 files
    • lens_jq.py
    • lens_jq.py