skbase.get_package_metadata#
- skbase.get_package_metadata(package_name: str, path: ~typing.Optional[str] = None, recursive: bool = True, exclude_non_public_items: bool = True, exclude_nonpublic_modules: bool = True, modules_to_ignore: ~typing.Union[~typing.List[str], ~typing.Tuple[str]] = ('tests',), package_base_classes: ~typing.Union[type, ~typing.Tuple[type, ...]] = (<class 'skbase._base.BaseObject'>,), class_filter: ~typing.Optional[~typing.Union[type, ~typing.Sequence[type]]] = None, tag_filter: ~typing.Optional[~typing.Union[str, ~typing.Sequence[str], ~typing.Mapping[str, ~typing.Any]]] = None, suppress_import_stdout: bool = True) Mapping[str, ModuleInfo][source]#
Return a dictionary mapping all package modules to their metadata.
- Parameters:
- package_namestr
The name of the package/module to return metadata for.
If path is not None, this should be the name of the package/module associated with the path. package_name (with “.” appended at end) will be used as prefix for any submodules/packages when walking the provided path.
If path is None, then package_name is assumed to be an importable package or module and the path to package_name will be determined from its import.
- pathstr, default=None
If provided, this should be the path that should be used as root to find any modules or submodules.
- recursivebool, default=True
Whether to recursively walk through submodules.
If True, then submodules of submodules and so on are found.
If False, then only first-level submodules of package are found.
- exclude_non_public_itemsbool, default=True
Whether to exclude nonpublic functions and classes (where name starts with a leading underscore).
- exclude_non_public_modulesbool, default=True
Whether to exclude nonpublic modules (modules where names start with a leading underscore).
- modules_to_ignorelist[str] or tuple[str], default=()
The modules that should be ignored when walking the package.
- package_base_classes: type or Sequence[type], default = (BaseObject,)
The base classes used to determine if any classes found in metadata descend from a base class.
- class_filterobjects or iterable of objects
Classes that klass is checked against.
- tag_filterstr, iterable of str or dict
Filter used to determine if klass has tag or expected tag values.
- Returns:
- module_info: dict
Mapping of string module name (key) to a dictionary of the module’s metadata. The metadata dictionary includes the following key:value pairs:
“path”: str path to the submodule.
“name”: str name of hte submodule.
“classes”: dictionary with submodule’s class names (keys) mapped to dictionaries with metadata about the class.
“functions”: dictionary with function names (keys) mapped to dictionary with metadata about each function.
“__all__”: list of string code artifact names that appear in the submodules __all__ attribute
“authors”: contents of the submodules __authors__ attribute
“is_package”: whether the submodule is a Python package
“contains_concrete_class_implementations”: whether any module classes inherit from
BaseObjectand are not package_base_classes.“contains_base_classes”: whether any module classes that are package_base_classes.
“contains_base_objects”: whether any module classes that inherit from
BaseObject.
- Other Parameters:
- suppress_import_stdoutbool, default=True
Whether to suppress stdout printout upon import.