git: fe5e0f172c76 - main - textproc/py-docling-core: add missing chunking and other dependencies

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Thu, 01 Oct 2026 05:07:42 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fe5e0f172c76f02308495f40e5b3cdfd923c0b4d

commit fe5e0f172c76f02308495f40e5b3cdfd923c0b4d
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-10-01 04:59:21 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-10-01 05:07:40 +0000

    textproc/py-docling-core: add missing chunking and other dependencies
    
    PR:             298561
    Reported by:    cedric <cedric@precidata.com>
---
 textproc/py-docling-core/Makefile                  | 46 +++++++++++-
 textproc/py-docling-core/distinfo                  |  6 +-
 .../py-docling-core/files/patch-pyproject.toml     |  4 +-
 .../files/patch-tests_doclang__validation.py       | 86 ++++++++++++++++++++++
 4 files changed, 134 insertions(+), 8 deletions(-)

diff --git a/textproc/py-docling-core/Makefile b/textproc/py-docling-core/Makefile
index 072fee1b8d0b..0000e372902a 100644
--- a/textproc/py-docling-core/Makefile
+++ b/textproc/py-docling-core/Makefile
@@ -1,9 +1,10 @@
 PORTNAME=	docling-core
+DISTVERSIONPREFIX=	v
 DISTVERSION=	2.95.0
+PORTREVISION=	1
 CATEGORIES=	textproc python
-MASTER_SITES=	PYPI
+#MASTER_SITES=	PYPI # no tests
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
-DISTNAME=	${PORTNAME:S/-/_/}-${DISTVERSION}
 
 MAINTAINER=	yuri@FreeBSD.org
 COMMENT=	Library to define and validate data types in Docling
@@ -27,10 +28,49 @@ RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}defusedxml>=0.7.1:devel/py-defusedxml@${PY_F
 		${PYTHON_PKGNAMEPREFIX}tabulate>=0.9.0:devel/py-tabulate@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}typer>=0.12.5:devel/py-typer@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}typing-extensions>=4.12.2:devel/py-typing-extensions@${PY_FLAVOR}
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}gitpython>=0:devel/py-gitpython@${PY_FLAVOR}
+		#${PYTHON_PKGNAMEPREFIX}universal-pathlib>=0.3.10:filesystems/py-universal-pathlib@${PY_FLAVOR} # missing
+
+# optional dependencies are used during normal use of this library
+DCLQ_DEPENDS=	\
+		${PYTHON_PKGNAMEPREFIX}click>=8.0.0:devel/py-click@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}doclang>=0.7:textproc/py-doclang@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}lxml>=6.0.2:devel/py-lxml@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}typer>=0.15.1:devel/py-typer@${PY_FLAVOR}
+CHUNKING_DEPENDS=	\
+		${PYTHON_PKGNAMEPREFIX}semchunk>=2.2.0:textproc/py-semchunk@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}transformers>=4.42.0:misc/py-transformers@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tree-sitter-c>=0.23.4:devel/py-tree-sitter-c@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tree-sitter-javascript>=0.23.1:devel/py-tree-sitter-javascript@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tree-sitter-python>=0.23.6:devel/py-tree-sitter-python@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tree-sitter-typescript>=0.23.2:devel/py-tree-sitter-typescript@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tree-sitter>=0.25.0:devel/py-tree-sitter@${PY_FLAVOR}
+CHUNKING_OPENAI_DEPENDS=	\
+		${PYTHON_PKGNAMEPREFIX}semchunk>=2.2.0:textproc/py-semchunk@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tiktoken>=0.9.0:textproc/py-tiktoken@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tree-sitter-c>=0.23.4:devel/py-tree-sitter-c@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tree-sitter-javascript>=0.23.1:devel/py-tree-sitter-javascript@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tree-sitter-python>=0.23.6:devel/py-tree-sitter-python@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tree-sitter-typescript>=0.23.2:devel/py-tree-sitter-typescript@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tree-sitter>=0.25.0:devel/py-tree-sitter@${PY_FLAVOR}
+RUN_DEPENDS+=	${DCLQ_DEPENDS} \
+		${CHUNKING_DEPENDS} \
+		${CHUNKING_OPENAI_DEPENDS}
 
 USES=		python
-USE_PYTHON=	autoplist concurrent pep517
+USE_PYTHON=	autoplist concurrent pep517 pytest
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	docling-project
+GH_PROJECT=	docling-core
+
+TEST_ENV=	${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+TEST_ARGS=	--disable-plugin-autoload --ignore=packages/dclq \
+		--ignore=tests/test_code_chunker.py \
+		--ignore=tests/test_code_chunking_strategy.py
 
 NO_ARCH=	yes
 
+# tests as of 2.95.0: 588 passed, 113 skipped, 85 warnings
+
 .include <bsd.port.mk>
diff --git a/textproc/py-docling-core/distinfo b/textproc/py-docling-core/distinfo
index cd8ca1f197bc..d9f1fc834bbc 100644
--- a/textproc/py-docling-core/distinfo
+++ b/textproc/py-docling-core/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1788718655
-SHA256 (docling_core-2.95.0.tar.gz) = dd79a3db6d08a6d5f674fa66987aaf5c0f2705233cb329c2f19cd9472518796d
-SIZE (docling_core-2.95.0.tar.gz) = 371729
+TIMESTAMP = 1790828150
+SHA256 (docling-project-docling-core-v2.95.0_GH0.tar.gz) = f461b3b4ac20e913ecb4585b1ba79b0defec6022733f56549e03f5ca0685175c
+SIZE (docling-project-docling-core-v2.95.0_GH0.tar.gz) = 90186530
diff --git a/textproc/py-docling-core/files/patch-pyproject.toml b/textproc/py-docling-core/files/patch-pyproject.toml
index c1715ebd9a5d..284b11a553a2 100644
--- a/textproc/py-docling-core/files/patch-pyproject.toml
+++ b/textproc/py-docling-core/files/patch-pyproject.toml
@@ -1,9 +1,9 @@
 -- Fix license declaration format for PEP 621 compatibility and remove license-files path not present in distfile.
---- pyproject.toml.orig	2026-07-09 20:28:22 UTC
+--- pyproject.toml.orig	2026-09-04 15:16:51 UTC
 +++ pyproject.toml
 @@ -2,8 +2,7 @@ description = "A python library to define and validate
  name = "docling-core"
- version = "2.85.0"  # DO NOT EDIT, updated automatically
+ version = "2.95.0"  # DO NOT EDIT, updated automatically
  description = "A python library to define and validate data types in Docling."
 -license = "MIT"
 -license-files = ["LICENSE"]
diff --git a/textproc/py-docling-core/files/patch-tests_doclang__validation.py b/textproc/py-docling-core/files/patch-tests_doclang__validation.py
new file mode 100644
index 000000000000..b30ab853d398
--- /dev/null
+++ b/textproc/py-docling-core/files/patch-tests_doclang__validation.py
@@ -0,0 +1,86 @@
+-- Make DocLang XML validation a no-op/skip when the optional saxonche schematron
+-- backend is not available. This backend is not packaged for FreeBSD yet.
+--- tests/doclang_validation.py.orig	2026-10-01 04:16:39 UTC
++++ tests/doclang_validation.py
+@@ -16,15 +16,25 @@ except ImportError:
+     doclang_validate = None  # type: ignore[assignment,misc]
+     ValidationError = Exception  # type: ignore[misc,assignment]
+ 
++try:
++    import saxonche
++except ImportError:
++    saxonche = None  # type: ignore[assignment,misc]
+ 
++try:
++    from doclang.schematron import SchematronBackendNotFound
++except ImportError:
++    SchematronBackendNotFound = None  # type: ignore[assignment,misc]
++
++
+ def doclang_validator_available() -> bool:
+-    """Return True when the reference ``doclang`` package is importable."""
+-    return doclang_validate is not None
++    """Return True when doclang and its schematron backend are available."""
++    return doclang_validate is not None and saxonche is not None
+ 
+ 
+ doclang_validator = pytest.mark.skipif(
+     not doclang_validator_available(),
+-    reason="reference doclang package not installed (uv sync --extra doclang-validation)",
++    reason="doclang/schematron-saxon backend not installed (uv sync --extra doclang-validation)",
+ )
+ 
+ xfail_invalid_dclg_xml = pytest.mark.xfail(
+@@ -52,18 +62,31 @@ def assert_valid_dclg_xml(
+         path = tmp.name
+     try:
+         doclang_validate(path, allow_empty_namespace=allow_empty_namespace)
++    except Exception as exc:
++        if SchematronBackendNotFound is not None and isinstance(
++            exc, SchematronBackendNotFound
++        ):
++            return
++        raise
+     finally:
+         os.unlink(path)
+ 
+ 
++def _skip_if_backend_missing() -> None:
++    """Skip the current test when the doclang schematron backend is unavailable."""
++    if doclang_validate is None:
++        pytest.skip("reference doclang package not installed")
++    if saxonche is None:
++        pytest.skip("doclang/schematron-saxon backend not installed")
++
++
+ def validate_dclg_xml(
+     xml_text: str,
+     *,
+     allow_empty_namespace: bool = True,
+ ) -> None:
+     """Validate DocLang XML text; raises on failure when validator is available."""
+-    if doclang_validate is None:
+-        pytest.skip("reference doclang package not installed")
++    _skip_if_backend_missing()
+ 
+     with tempfile.NamedTemporaryFile(
+         mode="w",
+@@ -86,8 +109,7 @@ def validate_dclg_file(
+     allow_empty_namespace: bool = True,
+ ) -> None:
+     """Validate a DocLang XML file path."""
+-    if doclang_validate is None:
+-        pytest.skip("reference doclang package not installed")
++    _skip_if_backend_missing()
+     doclang_validate(Path(path), allow_empty_namespace=allow_empty_namespace)
+ 
+ 
+@@ -97,7 +119,6 @@ def assert_invalid_dclg_xml(
+     allow_empty_namespace: bool = True,
+ ) -> None:
+     """Assert DocLang XML is rejected by the reference validator (known bad output)."""
+-    if doclang_validate is None:
+-        pytest.skip("reference doclang package not installed")
++    _skip_if_backend_missing()
+     with pytest.raises(ValidationError):
+         validate_dclg_xml(xml_text, allow_empty_namespace=allow_empty_namespace)