in optimum/exporters/executorch/recipe_registry.py [0:0]
def discover_recipes():
"""
Dynamically discovers and imports all recipe modules within the `optimum.exporters.executorch.recipes` package.
Ensures recipes under `./recipes` directory are dynamically loaded without requiring manual imports.
Notes:
New recipes **must** be added to the `./recipes` directory to be discovered and used by `main_export`.
Failure to do so will prevent dynamic discovery and registration. Recipes must also use the
`@register_recipe` decorator to be properly registered in the `recipe_registry`.
"""
package = importlib.import_module(package_name)
package_path = package.__path__
for _, module_name, _ in pkgutil.iter_modules(package_path):
logger.info(f"Importing {package_name}.{module_name}")
importlib.import_module(f"{package_name}.{module_name}")