"""Nova kyverno-json adapter package (v1.25, REQ-294).

The directory name ``kyverno-json`` has a hyphen, so it is not a valid
Python package name and cannot be imported via ``import
adapters.kyverno-json``. The ``PolicyEngineRegistry`` loads the engine
by file path (``importlib.util.spec_from_file_location``). This
``__init__`` is a convenience for direct-script use and for ``pip
install -e .`` style discovery if the package is ever renamed.
"""


def _load_engine():
    import importlib.util
    import os
    engine_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                               "kyverno_json_engine.py")
    spec = importlib.util.spec_from_file_location("kyverno_json_engine", engine_path)
    if spec is None or spec.loader is None:
        raise ImportError(f"could not load {engine_path}")
    mod = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(mod)
    return mod.KyvernoJsonEngine


KyvernoJsonEngine = _load_engine()

__all__ = ["KyvernoJsonEngine"]