git: a16fdc4f3769 - main - misc/py-spandrel: New port: Library for loading and running pre-trained PyTorch models

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Wed, 18 Mar 2026 03:00:44 UTC
The branch main has been updated by yuri:

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

commit a16fdc4f3769ed0b61681c1a89291a5f4163f222
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-03-18 02:45:44 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-03-18 03:00:37 +0000

    misc/py-spandrel: New port: Library for loading and running pre-trained PyTorch models
---
 misc/Makefile              |  1 +
 misc/py-spandrel/Makefile  | 27 +++++++++++++++++++++++++++
 misc/py-spandrel/distinfo  |  3 +++
 misc/py-spandrel/pkg-descr |  6 ++++++
 4 files changed, 37 insertions(+)

diff --git a/misc/Makefile b/misc/Makefile
index c2cf927b0975..2ca0287a1317 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -581,6 +581,7 @@
     SUBDIR += py-sigopt
     SUBDIR += py-smdebug-rulesconfig
     SUBDIR += py-soapy_power
+    SUBDIR += py-spandrel
     SUBDIR += py-spdx-tools
     SUBDIR += py-spinners
     SUBDIR += py-synced-collections
diff --git a/misc/py-spandrel/Makefile b/misc/py-spandrel/Makefile
new file mode 100644
index 000000000000..3aca7157dcff
--- /dev/null
+++ b/misc/py-spandrel/Makefile
@@ -0,0 +1,27 @@
+PORTNAME=	spandrel
+DISTVERSION=	0.4.2
+CATEGORIES=	misc python # machine-learning
+MASTER_SITES=	PYPI
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Library for loading and running pre-trained PyTorch models
+WWW=		https://github.com/chaiNNer-org/spandrel
+
+LICENSE=	MIT
+
+BUILD_DEPENDS=	${PY_SETUPTOOLS} \
+		${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR}
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}einops>0:misc/py-einops@${PY_FLAVOR} \
+		${PYNUMPY} \
+		${PYTHON_PKGNAMEPREFIX}pytorch>0:misc/py-pytorch@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}safetensors>0:misc/py-safetensors@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}torchvision>0:misc/py-torchvision@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}typing-extensions>0:devel/py-typing-extensions@${PY_FLAVOR}
+
+USES=		python
+USE_PYTHON=	pep517 autoplist
+
+NO_ARCH=	yes
+
+.include <bsd.port.mk>
diff --git a/misc/py-spandrel/distinfo b/misc/py-spandrel/distinfo
new file mode 100644
index 000000000000..7e86da4dc176
--- /dev/null
+++ b/misc/py-spandrel/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1773766004
+SHA256 (spandrel-0.4.2.tar.gz) = fefa4ea966c6a5b7721dcf24f3e2062a5a96a395c8bedcb570fb55971fdcbccb
+SIZE (spandrel-0.4.2.tar.gz) = 247544
diff --git a/misc/py-spandrel/pkg-descr b/misc/py-spandrel/pkg-descr
new file mode 100644
index 000000000000..0115c252d3a1
--- /dev/null
+++ b/misc/py-spandrel/pkg-descr
@@ -0,0 +1,6 @@
+Spandrel is a library for loading and running pre-trained PyTorch models.
+
+It automatically detects the model architecture and hyperparameters from model
+files, and provides a unified interface for running models. This is particularly
+useful for super resolution models (ESRGAN, SwinIR, HAT, etc.) and other image
+processing models.