pyvider-components
2026-03-23
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.pyMoved `import jq` from module level into execute_query() — deferred to first actual lens execution rather than component registrationlens_jq.pyReplaced runtime `from ..capabilities.lens import LensCapability` with TYPE_CHECKING guard; added from __future__ import annotationslens_jq.pyReplaced 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.pylens_jq.py