Skip to main content

get_compat_module

Retrieves or creates a compatibility module for a given package and name by either importing an existing module or dynamically constructing one from a predefined attribute mapping.

def get_compat_module(
pkg: module,
name: string
) - > module

Retrieves or constructs a compatibility module for a given package, facilitating backward compatibility by mapping legacy module names to new implementations.

Parameters

NameTypeDescription
pkgmoduleThe parent package object where the compatibility module should be registered or associated.
namestringThe name of the compatibility module to retrieve or create within the package namespace.

Returns

TypeDescription
moduleA module object containing the mapped attributes or a proxy to the imported compatibility module.