Skip to content

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

test: align DocVortex integration with native-only 0.6

myhloli65ae44f833c8
diff --git a/.github/workflows/docvortex-boundary.yml b/.github/workflows/docvortex-boundary.yml
index 8a3af768..dc17c3fc 100644
--- a/.github/workflows/docvortex-boundary.yml
+++ b/.github/workflows/docvortex-boundary.yml
@@ -21,7 +21,6 @@ permissions:
env:
PYTHONUTF8: '1'
- DOCVORTEX_COMPUTE_BACKEND: rust
DOCVORTEX_PDF_RENDER_BACKEND: legacy
jobs:
@@ -87,8 +86,6 @@ jobs:
toolchain: ${{ steps.rust-version.outputs.toolchain }}
- name: Build the selected native wheel
if: ${{ inputs.docvortex-ref != '' }}
- env:
- DOCVORTEX_BUILD_NATIVE: '1'
run: |
uv build --wheel --python "$(python -c 'import sys; print(sys.executable)')" \
--out-dir "$GITHUB_WORKSPACE/.boundary/wheelhouse" .boundary/docvortex-src
diff --git a/pyproject.toml b/pyproject.toml
index b9db4ca1..aaf99f03 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -50,7 +50,7 @@ dependencies = [
"requests",
"httpx",
"pillow>=11.0.0",
- "pypdfium2>=5.10.1,<6",
+ "pypdfium2>=5.13.0,<6",
"PyYAML>=6.0.1,<7",
"packaging",
"modelscope>=1.26.0",
diff --git a/tests/unittest/test_opencv_boundaries.py b/tests/unittest/test_opencv_boundaries.py
index be348274..e1b6c1f2 100644
--- a/tests/unittest/test_opencv_boundaries.py
+++ b/tests/unittest/test_opencv_boundaries.py
@@ -245,28 +245,21 @@ def test_unet_input_tensor_keeps_inplace_channel_exchange() -> None:
@pytest.mark.parametrize("case", _REFERENCE["seal_cases"], ids=lambda case: case["name"] + "-" + case["interpolation"])
[email protected]("backend", ["python", "rust"])
-def test_seal_homography_keeps_frozen_pixels(case: dict[str, Any], backend: str, monkeypatch: pytest.MonkeyPatch) -> None:
- """两个后端验证横竖曲线、四边形、短多边形和退化回退的既有像素。"""
- from docvortex._compute_backend import get_native
+def test_seal_homography_keeps_frozen_pixels(case: dict[str, Any]) -> None:
+ """原生内核验证横竖曲线、四边形、短多边形和退化处理的既有像素。"""
from mineru.model.ocr.seal_det_warp import AutoRectifier
- monkeypatch.setenv("DOCVORTEX_COMPUTE_BACKEND", backend)
- get_native.cache_clear()
- try:
- image = np.random.default_rng(29).integers(0, 256, (96, 96, 3), dtype=np.uint8)
- original = image.copy()
- points = np.float32(case["points"])
- rectifier = AutoRectifier()
- actual = rectifier(image, points, interpolation=case["interpolation"])
- _assert_array_reference(actual, case["crop"])
- outputs, visual = rectifier.run(image, [points.reshape(-1).tolist()], interpolation=case["interpolation"])
- _assert_array_reference(outputs[0], case["crop"])
- _assert_array_reference(visual, case["visual"])
- np.testing.assert_array_equal(image, original)
- assert not np.shares_memory(actual, image)
- finally:
- get_native.cache_clear()
+ image = np.random.default_rng(29).integers(0, 256, (96, 96, 3), dtype=np.uint8)
+ original = image.copy()
+ points = np.float32(case["points"])
+ rectifier = AutoRectifier()
+ actual = rectifier(image, points, interpolation=case["interpolation"])
+ _assert_array_reference(actual, case["crop"])
+ outputs, visual = rectifier.run(image, [points.reshape(-1).tolist()], interpolation=case["interpolation"])
+ _assert_array_reference(outputs[0], case["crop"])
+ _assert_array_reference(visual, case["visual"])
+ np.testing.assert_array_equal(image, original)
+ assert not np.shares_memory(actual, image)
def test_default_seal_rectification_runs_without_opencv() -> None:
diff --git a/tests/unittest/test_seal_crop_degenerate.py b/tests/unittest/test_seal_crop_degenerate.py
index 4e7262e8..d5feefbe 100644
--- a/tests/unittest/test_seal_crop_degenerate.py
+++ b/tests/unittest/test_seal_crop_degenerate.py
@@ -19,13 +19,13 @@ from mineru.model.ocr.seal_crop import CropByPolys, SortPolyBoxes
_REFERENCE = json.loads((Path(__file__).parents[1] / "fixtures/seal_crop_degenerate.json").read_text())
[email protected](params=["python", "rust"])
-def image_backend(request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatch) -> Iterator[None]:
- """两种共享图像后端均检查无效轮廓和有效裁片的像素契约。"""
+def image_backend() -> Iterator[None]:
+ """共享原生图像内核检查无效轮廓和有效裁片的像素契约。"""
from docvortex._compute_backend import get_native
- monkeypatch.setenv("DOCVORTEX_COMPUTE_BACKEND", request.param)
get_native.cache_clear()
+ get_native()
try:
yield
finally: