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

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Fri, 09 Aug 2024 20:11:46 UTC
The branch main has been updated by yuri:

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

commit cdddefd5823b91e24a08577a7e3f1622765c72bd
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-08-09 18:55:38 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-08-09 20:11:43 +0000

    misc/py-ollama: New port: Official Python client for Ollama
---
 misc/Makefile            |  1 +
 misc/py-ollama/Makefile  | 35 +++++++++++++++++++++++++++++++++++
 misc/py-ollama/distinfo  |  3 +++
 misc/py-ollama/pkg-descr |  2 ++
 4 files changed, 41 insertions(+)

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/misc/py-ollama/pkg-descr b/misc/py-ollama/pkg-descr
new file mode 100644
index 000000000000..742400d1cb6b
--- /dev/null
+++ b/misc/py-ollama/pkg-descr
@@ -0,0 +1,2 @@
+The Ollama Python library provides the easiest way to integrate Python
+projects with Ollama.