load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

oncall("executorch")

runtime.python_library(
    name = "inspector",
    srcs = [
        "_inspector.py",
    ],
    deps = [
        "fbsource//third-party/pypi/ipython:ipython",
        "fbsource//third-party/pypi/numpy:numpy",
        "fbsource//third-party/pypi/pandas:pandas",
        "fbsource//third-party/pypi/tabulate:tabulate",
        ":inspector_utils",
        "//executorch/devtools/debug_format:et_schema",
        "//executorch/devtools/etdump:schema_flatcc",
        "//executorch/devtools/etrecord:etrecord",
        "//executorch/exir:lib",
        "//executorch/devtools/inspector:intermediate_output_capturer",
        "//executorch/devtools/inspector/numerical_comparator:lib",
    ],
)

python_binary(
    name = "inspector_cli",
    main_function = ".inspector_cli.main",
    main_src = "inspector_cli.py",
    deps = [
        "//executorch/devtools:lib",
        "//executorch/devtools/inspector:lib",
    ],
)

runtime.python_library(
    name = "inspector_utils",
    srcs = [
        "_inspector_utils.py",
    ],
    deps = [
        "fbsource//third-party/pypi/matplotlib:matplotlib",
        "fbsource//third-party/pypi/numpy:numpy",
        "//caffe2:torch",
        "//executorch/devtools/debug_format:base_schema",
        "//executorch/devtools/debug_format:et_schema",
        "//executorch/devtools/etdump:schema_flatcc",
        "//executorch/devtools/etdump:serialize",
        "//executorch/devtools/etrecord:etrecord",
    ],
)

runtime.python_library(
    name = "intermediate_output_capturer",
    srcs = [
        "_intermediate_output_capturer.py",
    ],
    deps = [
        "//executorch/devtools/inspector:inspector_utils",
    ],
)

runtime.python_library(
    name = "lib",
    srcs = ["__init__.py"],
    deps = [
        ":inspector",
        ":inspector_utils",
    ],
)
