git: 8852f79ac0d1 - main - graphics/py-rapidocr: Add New Port

From: Jochen Neumeister <joneum_at_FreeBSD.org>
Date: Fri, 18 Sep 2026 16:27:29 UTC
The branch main has been updated by joneum:

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

commit 8852f79ac0d14955f3516c0cd552be391207357b
Author:     Jochen Neumeister <joneum@FreeBSD.org>
AuthorDate: 2026-09-18 16:25:35 +0000
Commit:     Jochen Neumeister <joneum@FreeBSD.org>
CommitDate: 2026-09-18 16:26:52 +0000

    graphics/py-rapidocr: Add New Port
    
    RapidOCR provides the text detection and recognition models of PaddleOCR
    converted to ONNX, so they can be run without the PaddlePaddle framework.
    Detection locates the text boxes in an image, recognition reads the text
    inside them.
    
    cv2 comes from graphics/opencv rather than from the headless wheel, which
    conflicts with it and with misc/py-insightface.
    
    WWW: https://github.com/RapidAI/RapidOCR
    
    Sponsored by:   Netzkommune GmbH
---
 graphics/Makefile                               |  1 +
 graphics/py-rapidocr/Makefile                   | 45 +++++++++++++++++++++++++
 graphics/py-rapidocr/distinfo                   |  3 ++
 graphics/py-rapidocr/files/patch-pyproject.toml | 19 +++++++++++
 graphics/py-rapidocr/pkg-descr                  |  8 +++++
 5 files changed, 76 insertions(+)

diff --git a/graphics/Makefile b/graphics/Makefile
index 16cc1088d2d3..bd62510cc37c 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -1057,6 +1057,7 @@
     SUBDIR += py-qt6-3d
     SUBDIR += py-qudida
     SUBDIR += py-railroad-diagrams
+    SUBDIR += py-rapidocr
     SUBDIR += py-rasterio
     SUBDIR += py-rasterstats
     SUBDIR += py-rawkit
diff --git a/graphics/py-rapidocr/Makefile b/graphics/py-rapidocr/Makefile
new file mode 100644
index 000000000000..1dbefde2ca82
--- /dev/null
+++ b/graphics/py-rapidocr/Makefile
@@ -0,0 +1,45 @@
+PORTNAME=	rapidocr
+DISTVERSIONPREFIX=	v
+DISTVERSION=	3.9.2
+CATEGORIES=	graphics python
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	joneum@FreeBSD.org
+COMMENT=	OCR toolkit using PaddleOCR models with ONNX Runtime
+WWW=		https://github.com/RapidAI/RapidOCR
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC:H}/LICENSE
+
+BUILD_DEPENDS=	${PY_SETUPTOOLS} \
+		${PYTHON_PKGNAMEPREFIX}setuptools-scm>=8:devel/py-setuptools-scm@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}colorlog>0:devel/py-colorlog@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}numpy>=1.19.5:math/py-numpy@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}omegaconf>0:devel/py-omegaconf@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pillow>0:graphics/py-pillow@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pyclipper>=1.2.0:math/py-pyclipper@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pyyaml>0:devel/py-pyyaml@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}requests>0:www/py-requests@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}shapely>=1.7.1:devel/py-shapely@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}six>=1.15.0:devel/py-six@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tqdm>0:misc/py-tqdm@${PY_FLAVOR} \
+		${PYTHON_SITELIBDIR}/cv2/__init__.py:graphics/opencv
+# cv2 comes from graphics/opencv rather than from
+# graphics/py-opencv-python-headless, which conflicts with it: the other
+# consumer in this stack, misc/py-insightface, depends on graphics/opencv
+
+USES=		python
+USE_PYTHON=	autoplist pep517
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	RapidAI
+GH_PROJECT=	RapidOCR
+
+WRKSRC_SUBDIR=	python
+
+MAKE_ENV=	SETUPTOOLS_SCM_PRETEND_VERSION=${DISTVERSION}
+
+NO_ARCH=	yes
+
+.include <bsd.port.mk>
diff --git a/graphics/py-rapidocr/distinfo b/graphics/py-rapidocr/distinfo
new file mode 100644
index 000000000000..84c4d09c6497
--- /dev/null
+++ b/graphics/py-rapidocr/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1789650684
+SHA256 (RapidAI-RapidOCR-v3.9.2_GH0.tar.gz) = 0342bb616322661038eec54e6d14935a09e13fd0bcfecc7d8c3faf16e34fa805
+SIZE (RapidAI-RapidOCR-v3.9.2_GH0.tar.gz) = 2180973
diff --git a/graphics/py-rapidocr/files/patch-pyproject.toml b/graphics/py-rapidocr/files/patch-pyproject.toml
new file mode 100644
index 000000000000..329d89649b0f
--- /dev/null
+++ b/graphics/py-rapidocr/files/patch-pyproject.toml
@@ -0,0 +1,19 @@
+--- pyproject.toml.orig	2026-09-18 15:31:10 UTC
++++ pyproject.toml
+@@ -1,6 +1,6 @@ requires = [
+ [build-system]
+ requires = [
+-    "setuptools>=77",
++    "setuptools",
+     "wheel",
+     "setuptools-scm>=8",
+ ]
+@@ -12,7 +12,7 @@ requires-python = ">=3.8,<4"
+ description = "Awesome OCR Library"
+ readme = { file = "README.md", content-type = "text/markdown" }
+ requires-python = ">=3.8,<4"
+-license = "Apache-2.0"
++license = {text = "Apache-2.0"}
+ authors = [
+     { name = "SWHL", email = "liekkaskono@163.com" },
+ ]
diff --git a/graphics/py-rapidocr/pkg-descr b/graphics/py-rapidocr/pkg-descr
new file mode 100644
index 000000000000..2d7043a5ad9a
--- /dev/null
+++ b/graphics/py-rapidocr/pkg-descr
@@ -0,0 +1,8 @@
+RapidOCR provides the text detection and recognition models of PaddleOCR
+converted to ONNX, so they can be run without the PaddlePaddle framework.
+ONNX Runtime, OpenVINO, MNN, PaddlePaddle and PyTorch are supported as
+inference engines.
+
+Detection locates the text boxes in an image, recognition reads the text
+inside them.  Models for Chinese, English, Japanese, Korean and further
+languages are fetched on demand.