Discover plugins Args: requirement_path: The file path of requirement
(requirement_path=None)
| 109 | |
| 110 | |
| 111 | def discover_plugins(requirement_path=None) -> Iterable[str]: |
| 112 | """ |
| 113 | Discover plugins |
| 114 | |
| 115 | Args: |
| 116 | requirement_path: The file path of requirement |
| 117 | |
| 118 | """ |
| 119 | plugins: Set[str] = set() |
| 120 | if requirement_path is None: |
| 121 | if os.path.isfile(LOCAL_PLUGINS_FILENAME): |
| 122 | with push_python_path('.'): |
| 123 | for plugin in discover_file_plugins(LOCAL_PLUGINS_FILENAME): |
| 124 | if plugin in plugins: |
| 125 | continue |
| 126 | yield plugin |
| 127 | plugins.add(plugin) |
| 128 | if os.path.isfile(GLOBAL_PLUGINS_FILENAME): |
| 129 | for plugin in discover_file_plugins(GLOBAL_PLUGINS_FILENAME): |
| 130 | if plugin in plugins: |
| 131 | continue |
| 132 | yield plugin |
| 133 | plugins.add(plugin) |
| 134 | else: |
| 135 | if os.path.isfile(requirement_path): |
| 136 | for plugin in discover_file_plugins(requirement_path): |
| 137 | if plugin in plugins: |
| 138 | continue |
| 139 | yield plugin |
| 140 | plugins.add(plugin) |
| 141 | |
| 142 | |
| 143 | def import_all_plugins(plugins: List[str] = None) -> List[str]: |
searching dependent graphs…