git: 5c2606d85f13 - main - misc/oterm: Add new port

From: Nicola Vitale <nivit_at_FreeBSD.org>
Date: Thu, 08 Aug 2024 15:38:47 UTC
The branch main has been updated by nivit:

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

commit 5c2606d85f13cdb4b1401985a54446ce5d474c0f
Author:     Nicola Vitale <nivit@FreeBSD.org>
AuthorDate: 2024-08-08 15:37:29 +0000
Commit:     Nicola Vitale <nivit@FreeBSD.org>
CommitDate: 2024-08-08 15:38:37 +0000

    misc/oterm: Add new port
    
    Oterm is a text-based terminal client for Ollama.
    
    Features
    
      - intuitive and simple terminal UI, no need to run servers, frontends, just
        type oterm in your terminal.
      - multiple persistent chat sessions, stored together with the context
        embeddings and system prompt customizations in sqlite.
      - can use any of the models you have pulled in Ollama, or your own custom
        models.
      - allows for easy customization of the model's system prompt and parameters.
    
    https://github.com/ggozad/oterm
---
 misc/Makefile                            |  1 +
 misc/py-oterm/Makefile                   | 32 ++++++++++++++++++++++++++++++++
 misc/py-oterm/distinfo                   |  3 +++
 misc/py-oterm/files/patch-oterm_utils.py | 26 ++++++++++++++++++++++++++
 misc/py-oterm/pkg-descr                  | 11 +++++++++++
 5 files changed, 73 insertions(+)

diff --git a/misc/Makefile b/misc/Makefile
index 246769ca9f23..22b7c0d472bc 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -476,6 +476,7 @@
     SUBDIR += py-orange3-educational
     SUBDIR += py-orange3-network
     SUBDIR += py-orange3-timeseries
+    SUBDIR += py-oterm
     SUBDIR += py-palettable
     SUBDIR += py-papermill
     SUBDIR += py-pexpect
diff --git a/misc/py-oterm/Makefile b/misc/py-oterm/Makefile
new file mode 100644
index 000000000000..844590d4d1ff
--- /dev/null
+++ b/misc/py-oterm/Makefile
@@ -0,0 +1,32 @@
+PORTNAME=	oterm
+DISTVERSION=	0.2.9
+CATEGORIES=	misc python
+MASTER_SITES=	PYPI
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	nivit@FreeBSD.org
+COMMENT=	Text-based terminal client for Ollama
+WWW=		https://github.com/ggozad/oterm
+
+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}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}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} \
+		${PYTHON_PKGNAMEPREFIX}python-dotenv>=1.0.1:www/py-python-dotenv@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}rich-pixels>=3.0.1:graphics/py-rich-pixels@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}textual>=0.59.0:textproc/py-textual@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}typer>=0.12.3:devel/py-typer@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}uc-micro-py>=1.0.3:textproc/py-uc-micro-py@${PY_FLAVOR}
+
+USES=		python:3.10+
+USE_PYTHON=	autoplist pep517
+
+.include <bsd.port.mk>
diff --git a/misc/py-oterm/distinfo b/misc/py-oterm/distinfo
new file mode 100644
index 000000000000..7902e93a3e1d
--- /dev/null
+++ b/misc/py-oterm/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1723108230
+SHA256 (oterm-0.2.9.tar.gz) = 776aa5c87ce09e2c5ef3384e13e3ef31a9fa22a2b8a1b15e3a2ef5a89bb0bf67
+SIZE (oterm-0.2.9.tar.gz) = 20019
diff --git a/misc/py-oterm/files/patch-oterm_utils.py b/misc/py-oterm/files/patch-oterm_utils.py
new file mode 100644
index 000000000000..6df624e298c6
--- /dev/null
+++ b/misc/py-oterm/files/patch-oterm_utils.py
@@ -0,0 +1,26 @@
+--- oterm/utils.py.orig	2024-05-15 16:35:57 UTC
++++ oterm/utils.py
+@@ -1,4 +1,4 @@
+-import sys
++import platform
+ from pathlib import Path
+ 
+ 
+@@ -16,12 +16,13 @@ def get_default_data_dir() -> Path:
+     home = Path.home()
+ 
+     system_paths = {
+-        "win32": home / "AppData/Roaming/oterm",
+-        "linux": home / ".local/share/oterm",
+-        "darwin": home / "Library/Application Support/oterm",
++        "Darwin": home / "Library/Application Support/oterm",
++        "FreeBSD": home / ".local/share/oterm",
++        "Linux": home / ".local/share/oterm",
++        "Windows": home / "AppData/Roaming/oterm",
+     }
+ 
+-    data_path = system_paths[sys.platform]
++    data_path = system_paths[platform.system()]
+     return data_path
+ 
+ 
diff --git a/misc/py-oterm/pkg-descr b/misc/py-oterm/pkg-descr
new file mode 100644
index 000000000000..b1759d017fa4
--- /dev/null
+++ b/misc/py-oterm/pkg-descr
@@ -0,0 +1,11 @@
+Oterm is a text-based terminal client for Ollama.
+
+Features
+
+  - intuitive and simple terminal UI, no need to run servers, frontends, just
+    type oterm in your terminal.
+  - multiple persistent chat sessions, stored together with the context
+    embeddings and system prompt customizations in sqlite.
+  - can use any of the models you have pulled in Ollama, or your own custom
+    models.
+  - allows for easy customization of the model's system prompt and parameters.