deprecate_submodule
- glotaran.deprecation.deprecation_utils.deprecate_submodule(*, deprecated_module_name: str, new_module_name: str, to_be_removed_in_version: str) module [source]
Create a module at runtime which retrieves attributes from new module.
When moving a module, create a variable with the modules name in the parent packages
__init__.py
, so imports will be redirected to the new module location and a deprecation warning will be given, to help the user adjust the outdated code. Each time an attribute is retrieved there will be a deprecation warning.- Parameters
- Returns
Module containing
- Return type
ModuleType
- Raises
OverDueDeprecation – If the current version is greater or equal to
to_be_removed_in_version
.
See also
Examples
When moving the module
result
fromglotaran.analysis.result
toglotaran.project.result
the following code was added to the old parent packages (glotaran.analysis
)__init__.py
.from glotaran.deprecation.deprecation_utils import deprecate_submodule result = deprecate_submodule( deprecated_module_name="glotaran.analysis.result", new_module_name="glotaran.project.result", to_be_removed_in_version="0.6.0", )