# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{12..14} )
DISTUTILS_SINGLE_IMPL=1

inherit distutils-r1

DESCRIPTION="Sentence/image embeddings, retrieval, and reranking via Transformers"
HOMEPAGE="
	https://www.SBERT.net
	https://github.com/huggingface/sentence-transformers
	https://pypi.org/project/sentence-transformers/
"
SRC_URI="https://github.com/huggingface/${PN}/archive/refs/tags/v${PV}.tar.gz
	-> ${P}.gh.tar.gz"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~arm64"

# Full integration tests require network-fetched Hugging Face models.
# Offline utility tests are not yet integrated into the ebuild.
RESTRICT="test"

RDEPEND="
	>=sci-ml/transformers-4.41.0[${PYTHON_SINGLE_USEDEP}]
	<sci-ml/transformers-6
	>=sci-ml/huggingface_hub-0.23.0[${PYTHON_SINGLE_USEDEP}]
	$(python_gen_cond_dep '
		>=dev-python/numpy-1.20.0[${PYTHON_USEDEP}]
		>=dev-python/tqdm-4.0.0[${PYTHON_USEDEP}]
		>=dev-python/typing-extensions-4.5.0[${PYTHON_USEDEP}]
		>=dev-python/scipy-1.0.0[${PYTHON_USEDEP}]
		>=dev-python/scikit-learn-0.22.0[${PYTHON_USEDEP}]
	')
	>=sci-ml/pytorch-1.11.0[${PYTHON_SINGLE_USEDEP}]
	>=sci-ml/tokenizers-0.19[${PYTHON_SINGLE_USEDEP}]
"
DEPEND="${RDEPEND}"
BDEPEND="$(python_gen_cond_dep '>=dev-python/setuptools-77.0.3[${PYTHON_USEDEP}]')"