def install_aria_extensions(strict=True):
"""
Loads all Python packages with names beginning with ``aria_extension_`` and calls their
``aria_extension`` initialization entry points if they have them.
:param strict: if ``True`` tries to load extensions while taking into account the versions
of their dependencies, otherwise ignores versions
:type strict: bool
"""
for loader, module_name, _ in iter_modules():
if module_name.startswith('aria_extension_'):
loader.find_module(module_name).load_module(module_name)
for entry_point in pkg_resources.iter_entry_points(group='aria_extension'):
# It should be possible to enable non strict loading - use the package that is already
# installed inside the environment, and forgo the version demand
if strict:
entry_point.load()
else:
entry_point.resolve()
extension.init()
评论列表
文章目录