git: 90643fe196f5 - main - misc/py-safetensors: New port: Simple, safe way to store and distribute tensors

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sat, 23 Dec 2023 01:34:14 UTC
The branch main has been updated by yuri:

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

commit 90643fe196f5722cb46e9de357e2a4f672008a48
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-12-22 23:52:57 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-12-23 01:34:06 +0000

    misc/py-safetensors: New port: Simple, safe way to store and distribute tensors
---
 misc/Makefile                 |  1 +
 misc/py-safetensors/Makefile  | 81 +++++++++++++++++++++++++++++++++++++++++++
 misc/py-safetensors/distinfo  | 81 +++++++++++++++++++++++++++++++++++++++++++
 misc/py-safetensors/pkg-descr |  2 ++
 4 files changed, 165 insertions(+)

diff --git a/misc/Makefile b/misc/Makefile
index 3d3aa8ba15b9..1189078ac219 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -470,6 +470,7 @@
     SUBDIR += py-pytorch-lightning
     SUBDIR += py-pyviz-comms
     SUBDIR += py-qiskit-machine-learning
+    SUBDIR += py-safetensors
     SUBDIR += py-scikit-fusion
     SUBDIR += py-scikit-quant
     SUBDIR += py-serverfiles
diff --git a/misc/py-safetensors/Makefile b/misc/py-safetensors/Makefile
new file mode 100644
index 000000000000..b4bfe586f335
--- /dev/null
+++ b/misc/py-safetensors/Makefile
@@ -0,0 +1,81 @@
+PORTNAME=	safetensors
+DISTVERSIONPREFIX=	v
+DISTVERSION=	0.4.1
+CATEGORIES=	misc python # machine-learning
+#MASTER_SITES=	PYPI
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Simple, safe way to store and distribute tensors
+WWW=		https://huggingface.co/docs/safetensors/index
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/../../LICENSE
+
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}setuptools-rust>0:devel/py-setuptools-rust@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}maturin>0:devel/py-maturin@${PY_FLAVOR}
+RUN_DEPENDS=	${PYNUMPY}
+
+USES=		cargo python
+USE_PYTHON=	pep517 autoplist pytest
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	huggingface
+
+WRKSRC_SUBDIR=	bindings/python
+
+CARGO_CRATES=	autocfg-1.1.0 \
+		bitflags-1.3.2 \
+		cfg-if-1.0.0 \
+		indoc-1.0.9 \
+		itoa-1.0.9 \
+		libc-0.2.150 \
+		lock_api-0.4.11 \
+		memmap2-0.5.10 \
+		memoffset-0.9.0 \
+		once_cell-1.18.0 \
+		parking_lot-0.12.1 \
+		parking_lot_core-0.9.9 \
+		proc-macro2-1.0.70 \
+		pyo3-0.19.2 \
+		pyo3-build-config-0.19.2 \
+		pyo3-ffi-0.19.2 \
+		pyo3-macros-0.19.2 \
+		pyo3-macros-backend-0.19.2 \
+		quote-1.0.33 \
+		redox_syscall-0.4.1 \
+		ryu-1.0.15 \
+		scopeguard-1.2.0 \
+		serde-1.0.193 \
+		serde_derive-1.0.193 \
+		serde_json-1.0.108 \
+		smallvec-1.11.2 \
+		syn-1.0.109 \
+		syn-2.0.39 \
+		target-lexicon-0.12.12 \
+		unicode-ident-1.0.12 \
+		unindent-0.1.11 \
+		windows-targets-0.48.5 \
+		windows_aarch64_gnullvm-0.48.5 \
+		windows_aarch64_msvc-0.48.5 \
+		windows_i686_gnu-0.48.5 \
+		windows_i686_msvc-0.48.5 \
+		windows_x86_64_gnu-0.48.5 \
+		windows_x86_64_gnullvm-0.48.5 \
+		windows_x86_64_msvc-0.48.5
+
+CARGO_BUILD=	no
+CARGO_INSTALL=	no
+CARGO_TEST=	no
+CARGO_TARGET_DIR=	${WRKSRC}/target
+
+MAKE_ENV=	${CARGO_ENV}
+TEST_ENV=	${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+TEST_WRKSRC=	${BUILD_WRKDIR}
+
+BINARY_ALIAS=	python3=${PYTHON_CMD}
+
+post-install:
+	@${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/safetensors/_safetensors_rust${PYTHON_EXT_SUFFIX}.so
+
+.include <bsd.port.mk>
diff --git a/misc/py-safetensors/distinfo b/misc/py-safetensors/distinfo
new file mode 100644
index 000000000000..e45bc4be1ee9
--- /dev/null
+++ b/misc/py-safetensors/distinfo
@@ -0,0 +1,81 @@
+TIMESTAMP = 1703272097
+SHA256 (rust/crates/autocfg-1.1.0.crate) = d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa
+SIZE (rust/crates/autocfg-1.1.0.crate) = 13272
+SHA256 (rust/crates/bitflags-1.3.2.crate) = bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a
+SIZE (rust/crates/bitflags-1.3.2.crate) = 23021
+SHA256 (rust/crates/cfg-if-1.0.0.crate) = baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd
+SIZE (rust/crates/cfg-if-1.0.0.crate) = 7934
+SHA256 (rust/crates/indoc-1.0.9.crate) = bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306
+SIZE (rust/crates/indoc-1.0.9.crate) = 13475
+SHA256 (rust/crates/itoa-1.0.9.crate) = af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38
+SIZE (rust/crates/itoa-1.0.9.crate) = 10492
+SHA256 (rust/crates/libc-0.2.150.crate) = 89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c
+SIZE (rust/crates/libc-0.2.150.crate) = 719359
+SHA256 (rust/crates/lock_api-0.4.11.crate) = 3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45
+SIZE (rust/crates/lock_api-0.4.11.crate) = 27487
+SHA256 (rust/crates/memmap2-0.5.10.crate) = 83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327
+SIZE (rust/crates/memmap2-0.5.10.crate) = 26847
+SHA256 (rust/crates/memoffset-0.9.0.crate) = 5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c
+SIZE (rust/crates/memoffset-0.9.0.crate) = 9033
+SHA256 (rust/crates/once_cell-1.18.0.crate) = dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d
+SIZE (rust/crates/once_cell-1.18.0.crate) = 32969
+SHA256 (rust/crates/parking_lot-0.12.1.crate) = 3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f
+SIZE (rust/crates/parking_lot-0.12.1.crate) = 40967
+SHA256 (rust/crates/parking_lot_core-0.9.9.crate) = 4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e
+SIZE (rust/crates/parking_lot_core-0.9.9.crate) = 32445
+SHA256 (rust/crates/proc-macro2-1.0.70.crate) = 39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b
+SIZE (rust/crates/proc-macro2-1.0.70.crate) = 44343
+SHA256 (rust/crates/pyo3-0.19.2.crate) = e681a6cfdc4adcc93b4d3cf993749a4552018ee0a9b65fc0ccfad74352c72a38
+SIZE (rust/crates/pyo3-0.19.2.crate) = 418228
+SHA256 (rust/crates/pyo3-build-config-0.19.2.crate) = 076c73d0bc438f7a4ef6fdd0c3bb4732149136abd952b110ac93e4edb13a6ba5
+SIZE (rust/crates/pyo3-build-config-0.19.2.crate) = 29206
+SHA256 (rust/crates/pyo3-ffi-0.19.2.crate) = e53cee42e77ebe256066ba8aa77eff722b3bb91f3419177cf4cd0f304d3284d9
+SIZE (rust/crates/pyo3-ffi-0.19.2.crate) = 66500
+SHA256 (rust/crates/pyo3-macros-0.19.2.crate) = dfeb4c99597e136528c6dd7d5e3de5434d1ceaf487436a3f03b2d56b6fc9efd1
+SIZE (rust/crates/pyo3-macros-0.19.2.crate) = 7173
+SHA256 (rust/crates/pyo3-macros-backend-0.19.2.crate) = 947dc12175c254889edc0c02e399476c2f652b4b9ebd123aa655c224de259536
+SIZE (rust/crates/pyo3-macros-backend-0.19.2.crate) = 49962
+SHA256 (rust/crates/quote-1.0.33.crate) = 5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae
+SIZE (rust/crates/quote-1.0.33.crate) = 28090
+SHA256 (rust/crates/redox_syscall-0.4.1.crate) = 4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa
+SIZE (rust/crates/redox_syscall-0.4.1.crate) = 24858
+SHA256 (rust/crates/ryu-1.0.15.crate) = 1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741
+SIZE (rust/crates/ryu-1.0.15.crate) = 46906
+SHA256 (rust/crates/scopeguard-1.2.0.crate) = 94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49
+SIZE (rust/crates/scopeguard-1.2.0.crate) = 11619
+SHA256 (rust/crates/serde-1.0.193.crate) = 25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89
+SIZE (rust/crates/serde-1.0.193.crate) = 76863
+SHA256 (rust/crates/serde_derive-1.0.193.crate) = 43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3
+SIZE (rust/crates/serde_derive-1.0.193.crate) = 55692
+SHA256 (rust/crates/serde_json-1.0.108.crate) = 3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b
+SIZE (rust/crates/serde_json-1.0.108.crate) = 146476
+SHA256 (rust/crates/smallvec-1.11.2.crate) = 4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970
+SIZE (rust/crates/smallvec-1.11.2.crate) = 34801
+SHA256 (rust/crates/syn-1.0.109.crate) = 72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237
+SIZE (rust/crates/syn-1.0.109.crate) = 237611
+SHA256 (rust/crates/syn-2.0.39.crate) = 23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a
+SIZE (rust/crates/syn-2.0.39.crate) = 244129
+SHA256 (rust/crates/target-lexicon-0.12.12.crate) = 14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a
+SIZE (rust/crates/target-lexicon-0.12.12.crate) = 25156
+SHA256 (rust/crates/unicode-ident-1.0.12.crate) = 3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b
+SIZE (rust/crates/unicode-ident-1.0.12.crate) = 42168
+SHA256 (rust/crates/unindent-0.1.11.crate) = e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c
+SIZE (rust/crates/unindent-0.1.11.crate) = 7700
+SHA256 (rust/crates/windows-targets-0.48.5.crate) = 9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c
+SIZE (rust/crates/windows-targets-0.48.5.crate) = 6904
+SHA256 (rust/crates/windows_aarch64_gnullvm-0.48.5.crate) = 2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8
+SIZE (rust/crates/windows_aarch64_gnullvm-0.48.5.crate) = 418492
+SHA256 (rust/crates/windows_aarch64_msvc-0.48.5.crate) = dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc
+SIZE (rust/crates/windows_aarch64_msvc-0.48.5.crate) = 798483
+SHA256 (rust/crates/windows_i686_gnu-0.48.5.crate) = a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e
+SIZE (rust/crates/windows_i686_gnu-0.48.5.crate) = 844891
+SHA256 (rust/crates/windows_i686_msvc-0.48.5.crate) = 8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406
+SIZE (rust/crates/windows_i686_msvc-0.48.5.crate) = 864300
+SHA256 (rust/crates/windows_x86_64_gnu-0.48.5.crate) = 53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e
+SIZE (rust/crates/windows_x86_64_gnu-0.48.5.crate) = 801619
+SHA256 (rust/crates/windows_x86_64_gnullvm-0.48.5.crate) = 0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc
+SIZE (rust/crates/windows_x86_64_gnullvm-0.48.5.crate) = 418486
+SHA256 (rust/crates/windows_x86_64_msvc-0.48.5.crate) = ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538
+SIZE (rust/crates/windows_x86_64_msvc-0.48.5.crate) = 798412
+SHA256 (huggingface-safetensors-v0.4.1_GH0.tar.gz) = b1fdfe7b5f6da1126e006511cd9448c2924bda6be9c44fddc8d933cd3f6cdc9a
+SIZE (huggingface-safetensors-v0.4.1_GH0.tar.gz) = 77124
diff --git a/misc/py-safetensors/pkg-descr b/misc/py-safetensors/pkg-descr
new file mode 100644
index 000000000000..ceee8afe77ec
--- /dev/null
+++ b/misc/py-safetensors/pkg-descr
@@ -0,0 +1,2 @@
+Safetensors is a new simple format for storing tensors safely (as opposed to
+pickle) and that is still fast (zero-copy).