Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

feat: remove async context manager for PDF handling and simplify locking mechanism

myhloli6c52a44143ab
diff --git a/mineru/utils/pdfium_guard.py b/mineru/utils/pdfium_guard.py
index d2883724..6cd36c51 100644
--- a/mineru/utils/pdfium_guard.py
+++ b/mineru/utils/pdfium_guard.py
@@ -1,6 +1,5 @@
-import asyncio
import threading
-from contextlib import asynccontextmanager, contextmanager
+from contextlib import contextmanager
from typing import Any, Callable, TypeVar
@@ -15,15 +14,6 @@ def pdfium_guard():
yield
-@asynccontextmanager
-async def aio_pdfium_guard():
- await asyncio.to_thread(_pdfium_lock.acquire)
- try:
- yield
- finally:
- _pdfium_lock.release()
-
-
def open_pdfium_document(
opener: Callable[..., T],
*args: Any,