git: 1c1b40ac246e - main - misc/py-ollama: New port: Official Python client for Ollama

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sat, 10 Aug 2024 07:25:14 UTC
The branch main has been updated by yuri:

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

commit 1c1b40ac246eee9ba50835a5f34da6c205780f68
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-08-10 07:08:23 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-08-10 07:23:35 +0000

    misc/py-ollama: New port: Official Python client for Ollama
    
    This reverts commit 5f8c92831aae9f9783923dcb6c29ba6287d2f576.
    
    Requested by:   nivit@FreeBSD.org (maintainer of devel/py-ollama; via e-mail)
---
 MOVED                               |  1 +
 devel/Makefile                      |  1 -
 devel/py-ollama/Makefile            | 28 ----------------------------
 devel/py-ollama/distinfo            |  3 ---
 misc/Makefile                       |  1 +
 misc/py-ollama/Makefile             | 35 +++++++++++++++++++++++++++++++++++
 misc/py-ollama/distinfo             |  3 +++
 {devel => misc}/py-ollama/pkg-descr |  2 +-
 misc/py-oterm/Makefile              |  3 ++-
 9 files changed, 43 insertions(+), 34 deletions(-)

diff --git a/MOVED b/MOVED
index f8355d114ad3..a11513dd72bf 100644
--- a/MOVED
+++ b/MOVED
@@ -3428,3 +3428,4 @@ devel/py-jsonschema417|devel/py-jsonschema|2024-08-04|Remove obsoleted port. Use
 net/ns3||2024-08-07|Has expired: Outdated and unmaintained for years
 games/manaplus||2024-08-07|Has expired: Fails to build with libxml2 2.13.2 (PR 279705)
 dns/knot3-lib|dns/knot3|2024-08-09|Superseded by knot3 which provides the libraries
+devel/py-ollama|misc/py-ollama|2024-08-10|Deduplicate
diff --git a/devel/Makefile b/devel/Makefile
index 638f987dcca4..4670fe0a5d1a 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -5208,7 +5208,6 @@
     SUBDIR += py-offtrac
     SUBDIR += py-olefile
     SUBDIR += py-oletools
-    SUBDIR += py-ollama
     SUBDIR += py-omnijson
     SUBDIR += py-omniorb
     SUBDIR += py-onigurumacffi
diff --git a/devel/py-ollama/Makefile b/devel/py-ollama/Makefile
deleted file mode 100644
index 0a3716a3f24e..000000000000
--- a/devel/py-ollama/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-PORTNAME=	ollama
-DISTVERSION=	0.3.1
-CATEGORIES=	devel python
-MASTER_SITES=	PYPI
-PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
-
-MAINTAINER=	nivit@FreeBSD.org
-COMMENT=	Ollama Python library
-WWW=		https://github.com/ollama/ollama-python
-
-LICENSE=	MIT
-LICENSE_FILE=	${WRKSRC}/LICENSE
-
-BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}poetry-core>=1.9.0:devel/py-poetry-core@${PY_FLAVOR}
-RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}anyio>=4.3.0:devel/py-anyio@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}certifi>=2024.2.2:security/py-certifi@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}exceptiongroup>=1.2.0:devel/py-exceptiongroup@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}h11>=0.14.0:net/py-h11@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}httpcore>=1.0.4:www/py-httpcore@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}httpx>=0.27.0:www/py-httpx@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}idna>=3.6:dns/py-idna@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}sniffio>=1.3.1:devel/py-sniffio@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}typing-extensions>=4.10.0:devel/py-typing-extensions@${PY_FLAVOR}
-
-USES=		python
-USE_PYTHON=	autoplist pep517
-
-.include <bsd.port.mk>
diff --git a/devel/py-ollama/distinfo b/devel/py-ollama/distinfo
deleted file mode 100644
index 61e2a9cf7d97..000000000000
--- a/devel/py-ollama/distinfo
+++ /dev/null
@@ -1,3 +0,0 @@
-TIMESTAMP = 1723110519
-SHA256 (ollama-0.3.1.tar.gz) = 032572fb494a4fba200c65013fe937a65382c846b5f358d9e8918ecbc9ac44b5
-SIZE (ollama-0.3.1.tar.gz) = 10033
diff --git a/misc/Makefile b/misc/Makefile
index 22b7c0d472bc..7fb74f1ef16b 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -463,6 +463,7 @@
     SUBDIR += py-natten
     SUBDIR += py-npTDMS
     SUBDIR += py-numcodecs
+    SUBDIR += py-ollama
     SUBDIR += py-onnx
     SUBDIR += py-onnx-tf
     SUBDIR += py-openai
diff --git a/misc/py-ollama/Makefile b/misc/py-ollama/Makefile
new file mode 100644
index 000000000000..01511c08556d
--- /dev/null
+++ b/misc/py-ollama/Makefile
@@ -0,0 +1,35 @@
+PORTNAME=	ollama
+DISTVERSIONPREFIX=	v
+DISTVERSION=	0.3.1
+CATEGORIES=	misc # machine-learning
+#MASTER_SITES=	PYPI # no tests
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Official Python client for Ollama
+WWW=		https://ollama.com/
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}poetry-core>0:devel/py-poetry-core@${PY_FLAVOR}
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}httpx>=0.27.0<1:www/py-httpx@${PY_FLAVOR}
+TEST_DEPENDS=	${PY_PILLOW} \
+		${PYTHON_PKGNAMEPREFIX}pytest-asyncio>=0.23.2:devel/py-pytest-asyncio@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-cov>=4.1:devel/py-pytest-cov@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-httpserver>=0:devel/py-pytest-httpserver@${PY_FLAVOR}
+
+USES=		python
+USE_PYTHON=	pep517 concurrent autoplist pytest # tests fail because api_key needs to be set
+
+USE_GITHUB=	yes
+GH_PROJECT=	ollama-python
+
+TEST_ENV=	${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+
+NO_ARCH=	yes
+
+post-patch: # workaround for https://github.com/ollama/ollama-python/issues/249
+	@${REINPLACE_CMD} -e 's|version = "0.0.0"|version = "${PORTVERSION}"|' ${WRKSRC}/pyproject.toml
+
+.include <bsd.port.mk>
diff --git a/misc/py-ollama/distinfo b/misc/py-ollama/distinfo
new file mode 100644
index 000000000000..bc02a3ccda1b
--- /dev/null
+++ b/misc/py-ollama/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1723226455
+SHA256 (ollama-ollama-python-v0.3.1_GH0.tar.gz) = 7422a9b7aded3ee7227d2ede38ccee98538be37f7947adc8f3083cd23dfeb3c9
+SIZE (ollama-ollama-python-v0.3.1_GH0.tar.gz) = 31971
diff --git a/devel/py-ollama/pkg-descr b/misc/py-ollama/pkg-descr
similarity index 87%
rename from devel/py-ollama/pkg-descr
rename to misc/py-ollama/pkg-descr
index 3f0373c3941e..742400d1cb6b 100644
--- a/devel/py-ollama/pkg-descr
+++ b/misc/py-ollama/pkg-descr
@@ -1,2 +1,2 @@
-The Ollama Python library provides the easiest way to integrate Python 3.8+
+The Ollama Python library provides the easiest way to integrate Python
 projects with Ollama.
diff --git a/misc/py-oterm/Makefile b/misc/py-oterm/Makefile
index 35b5ee875c97..c21bc8a05dc8 100644
--- a/misc/py-oterm/Makefile
+++ b/misc/py-oterm/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	oterm
 DISTVERSION=	0.2.10
+PORTREVISION=	1
 CATEGORIES=	misc python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -16,7 +17,7 @@ RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}aiosql>=10.1:databases/py-aiosql@${PY_FLAVOR
 		${PYTHON_PKGNAMEPREFIX}aiosqlite>=0.19.0:databases/py-aiosqlite@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}linkify-it-py>=2.0.3:textproc/py-linkify-it-py@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}mdit-py-plugins>=0.4.1:textproc/py-mdit-py-plugins@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}ollama>=0.2.0:devel/py-ollama@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}ollama>=0.2.0:misc/py-ollama@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}packaging>=24.1:devel/py-packaging@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pillow>=10.3.0:graphics/py-pillow@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pyperclip>=1.7.0:devel/py-pyperclip@${PY_FLAVOR} \