Fixed loading of plugins. (#1096)

This commit is contained in:
afourney 2025-03-05 22:24:08 -08:00 committed by GitHub
parent 784c293579
commit 9380112892
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 6 deletions

View file

@ -24,7 +24,7 @@ classifiers = [
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"markitdown>=0.2.0a1",
"markitdown>=0.2.0a2",
"striprtf",
]

View file

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2024-present Adam Fourney <adamfo@microsoft.com>
#
# SPDX-License-Identifier: MIT
__version__ = "0.2.0a1"
__version__ = "0.2.0a2"

View file

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2024-present Adam Fourney <adamfo@microsoft.com>
#
# SPDX-License-Identifier: MIT
__version__ = "0.2.0a1"
__version__ = "0.2.0a2"

View file

@ -58,10 +58,10 @@ PRIORITY_GENERIC_FILE_FORMAT = (
)
_plugins: List[Any] = []
_plugins: Union[None, List[Any]] = None # If None, plugins have not been loaded yet.
def _load_plugins() -> List[Any]:
def _load_plugins() -> Union[None, List[Any]]:
"""Lazy load plugins, exiting early if already loaded."""
global _plugins
@ -186,7 +186,9 @@ class MarkItDown:
"""
if not self._plugins_enabled:
# Load plugins
for plugin in _load_plugins():
plugins = _load_plugins()
assert plugins is not None
for plugin in plugins:
try:
plugin.register_converters(self, **kwargs)
except Exception: