File python-sentence-transformers.spec of Package python-sentence-transformers

#
# spec file for package python-sentence-transformers
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif

%{?sle15_python_module_pythons}
Name:           python-sentence-transformers
Version:        3.3.1
Release:        0
Summary:        Multilingual text embeddings
License:        Apache-2.0
URL:            https://www.SBERT.net
Source:         https://github.com/UKPLab/sentence-transformers/archive/refs/tags/v%{version}.tar.gz#/sentence_transformers-%{version}.tar.gz
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module wheel}
BuildRequires:  %{python_module pytest}
# SECTION test requirements
%if %{with test}
BuildRequires:  %{python_module sentence-transformers}
BuildRequires:  %{python_module huggingface-hub >= 0.20.0}
BuildRequires:  %{python_module numpy}
BuildRequires:  %{python_module Pillow}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module scikit-learn}
BuildRequires:  %{python_module scipy}
BuildRequires:  %{python_module torch >= 1.11.0}
BuildRequires:  %{python_module tqdm}
BuildRequires:  %{python_module transformers >= 4.41.0}
BuildRequires:  %{python_module tokenizers >= 0.19.0}
%endif
# /SECTION
BuildRequires:  fdupes
Requires:       python-huggingface-hub >= 0.20.0
Requires:       python-numpy
Requires:       python-Pillow
Requires:       python-scikit-learn
Requires:       python-scipy
Requires:       python-pytorch >= 1.11.0
Requires:       python-tqdm
Requires:       python-transformers >= 4.41.0
Suggests:       python-datasets
Suggests:       python-accelerate >= 0.20.3
Suggests:       python-pre-commit
BuildArch:      noarch
%python_subpackages

%description
Multilingual text embeddings

%prep
%autosetup -p1 -n sentence_transformers-%{version}

%if !%{with test}
%build
%pyproject_wheel

%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif

#excluding test conftest which has version dependency for tokenizers>=0.19,<0.20. Current tokenizer is 0.20 version.
%if %{with test}
%check
echo "Disabling the test suite for now due to missing dependencies"
# The test suite requires additional dependencies that are not currently available.
# Once the dependencies are resolved, this section should be re-enabled.
# Uncomment the following line to run the test suite after resolving dependencies.
#pytest -v 
%endif

%if !%{with test}
%files %{python_files}
%{python_sitelib}/sentence_transformers
%{python_sitelib}/sentence_transformers-%{version}.dist-info
%endif

%changelog
openSUSE Build Service is sponsored by