Package root¶
Responsibility¶
Public surface:
mllm_shap/__init__.pyre-exports what a user needs for a run; the full list is Public API.Command line:
cli.pyis themllm-shapconsole script ([project.scripts]).Logging:
_logging.pykeeps the package quiet on import and lets users opt in.Errors:
errors.pyholds the typed error hierarchy.
Public surface¶
__all__: 71 names, listed in Public API: domain types, every built-in plugin class, the pipeline entry points, plugin machinery, every error,ObservabilitySink,InMemoryObservabilitySink,CoalitionProgress,configure_loggingand__version__.render_attribution,render_attribution_html,display_attribution_html: resolved lazily through module__getattr__(listed by__dir__), soimport mllm_shapworks without thevizextra.cli.main(argv): subcommandsexplain(JSON result, optional PNG chart),reanalyze [--strict],pluginsandconfig --example | --check.--strictraisesReanalyzeMismatchErrorfor runs scored with backend embeddings instead of logging a warning.Exit codes:
EXIT_OK0,EXIT_INVALID2 (arguments,--log-leveloutsideLOG_LEVELS, configuration, snapshot, archive),EXIT_BACKEND_UNAVAILABLE3 (BackendUnavailableError,ConnectionError); other exceptions propagate.EXAMPLE_CONFIGis the commented YAML printed byconfig --example.
bootstrap_logging(): runs once at import; applies[tool.logging]from the file named byMLLM_SHAP_LOGGING_CONFIG, otherwise installs only aNullHandler.configure_logging(config_path=None, level=None, json=False): TOML configuration, or withlevel/jsona single stderr handler (JsonLogFormatterfor one JSON object per line) andpropagate=False;jsonwithconfig_pathraisesValueError.Errors (13 classes), each also subclassing the matching builtin (
LookupError,ValueError,RuntimeError,FileExistsError,FileNotFoundError,ImportError):MllmShapErrorroot;PluginNotFoundError,PluginConflictError,PluginLoadError(entry_point_name),ConfigError,BackendUnavailableErrorand its subclassLogprobsUnavailableError(a record without the logprobslogprobneeds; command-line exit code 3).ArchiveExistsError,ArchiveIncompleteError,ArchiveNotFoundError(no manifest or SQLite database),ArchiveCorruptError(unreadable archive or manifest),ManifestVersionError,ReanalyzeMismatchError.
Data flow¶
Importing
mllm_shapimports domain, estimation, masking, pipeline, plugins, runtime, value and the backend classes (their heavy dependencies are imported lazily), then callsbootstrap_logging().cli.mainreads YAML (explain_config_from_yaml) and snapshot JSON (ConversationSnapshot.from_json, audio paths relative to the snapshot file), runsExplainRunner.explain_syncorreanalyze, and writesExplainRunOutput.to_dict()as JSON;--pngrenders through viz.__version__comes from installed package metadata (0.0.0+unknownwhen not installed).
Invariants¶
Exported names import without optional extras and without touching the host’s logging configuration.
Every error raised on purpose is an
MllmShapErrorand still matches the builtin exception callers caught before 0.1.18.The CLI never prints a traceback for invalid input or an unavailable backend.
Known issues¶
None open. The logging-at-import problem from the audit was fixed in 0.1.18.