diff --git a/metaflow/__init__.py b/metaflow/__init__.py index de527614236..e87860727b1 100644 --- a/metaflow/__init__.py +++ b/metaflow/__init__.py @@ -119,12 +119,11 @@ class and related decorators. # Decorators from .decorators import step, _import_plugin_decorators -# Config parsers -from .plugins.pypi.parsers import ( - requirements_txt_parser, - pyproject_toml_parser, - conda_environment_yml_parser, -) + +# Parsers (for configs) for now +from .plugins import _import_tl_plugins + +_import_tl_plugins(globals()) # this auto-generates decorator functions from Decorator objects # in the top-level metaflow namespace diff --git a/metaflow/extension_support/plugins.py b/metaflow/extension_support/plugins.py index dcd151501a1..4cad3a9762d 100644 --- a/metaflow/extension_support/plugins.py +++ b/metaflow/extension_support/plugins.py @@ -198,6 +198,7 @@ def resolve_plugins(category, path_only=False): list(x.commands)[0] if len(x.commands) == 1 else "too many commands" ), "runner_cli": lambda x: x.name, + "tl_plugin": None, } diff --git a/metaflow/plugins/__init__.py b/metaflow/plugins/__init__.py index c10886b1708..de24940fd68 100644 --- a/metaflow/plugins/__init__.py +++ b/metaflow/plugins/__init__.py @@ -167,6 +167,12 @@ ), ] +TL_PLUGINS_DESC = [ + ("requirements_txt_parser", ".pypi.parsers.requirements_txt_parser"), + ("pyproject_toml_parser", ".pypi.parsers.pyproject_toml_parser"), + ("conda_environment_yml_parser", ".pypi.parsers.conda_environment_yml_parser"), +] + process_plugins(globals()) @@ -207,6 +213,8 @@ def get_runner_cli_path(): if sys.version_info >= (3, 7): DEPLOYER_IMPL_PROVIDERS = resolve_plugins("deployer_impl_provider") +TL_PLUGINS = resolve_plugins("tl_plugin") + from .cards.card_modules import MF_EXTERNAL_CARDS # Cards; due to the way cards were designed, it is harder to make them fit @@ -251,3 +259,9 @@ def get_runner_cli_path(): TestRefreshComponentCard, ] merge_lists(CARDS, MF_EXTERNAL_CARDS, "type") + + +def _import_tl_plugins(globals_dict): + + for name, p in TL_PLUGINS.items(): + globals_dict[name] = p