peal.global_utils.find_subclasses¶
- peal.global_utils.find_subclasses(base_class, directory)[source]¶
Import every module under
directoryand collect subclasses.Used by the config machinery to find, for example, all
ExplainerConfigsubclasses so that a config file can be mapped onto its pydantic model by name. Every.pyfile belowdirectoryis imported as a module relative to the project root; anything under adependenciesdirectory is skipped, since the vendored third-party code is expensive and often not importable. Import errors are printed and the module is skipped. Afterwards, top-level packages whose name starts withdirectoryare imported as well.