File python-safetensors.changes of Package failed_python-safetensors

Summary of repair for failed_python-safetensors

Root cause:
- During wheel build, PyO3 (Rust crate used by safetensors) detected the configured Python interpreter version 3.13 is newer than PyO3's maximum supported version (3.12). The PyO3 build script fails with:
  "error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported version (3.12)"
- This caused maturin/pip to fail building the Rust extension and the RPM %build stage to exit with error.

Minimal fix applied:
- Allow building against a newer Python by enabling PyO3's ABI3 forward compatibility. This suppresses the PyO3 version check and builds using the stable ABI.

Files modified (all paths relative to temp_workspace/failed_python-safetensors):
- python-safetensors.spec
  - Inserted a single-line environment export in %build and %install sections:
    export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
  - The export lines were placed immediately before entering the bindings/python directory in each section (minimal change to ensure the environment is set for both build and install phases).

Full new content of python-safetensors.spec (replacement of entire file):

#
# spec file for package python-safetensors
#
# 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/
#

%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%{?sle15_python_module_pythons}
Name:           python-safetensors
Version:        0.4.3
Release:        0
Summary:        Safetensors is a simple format for storing tensors safely
License:        Apache-2.0
URL:            https://github.com/huggingface/safetensors
Source:         https://github.com/huggingface/safetensors/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.gz
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module maturin}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  cargo-packaging
%python_subpackages

%description
This repository implements a new simple format for storing tensors safely (as
opposed to pickle) and that is still fast (zero-copy).

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

%build
# New: set PyO3 abi3 forward compatibility to allow building against Python
# versions newer than PyO3's maximum supported version. This suppresses
# the PyO3 version check and uses the stable ABI.
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
cd bindings/python
tar xzf %{S:1}
%pyproject_wheel

%install
# Ensure the same environment variable is present during install as well
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
cd bindings/python
%pyproject_install
%python_expand %fdupes %{buildroot}/%{$python_sitearch}/*

%files %{python_files}
%license LICENSE
%doc README.md
%{python_sitearch}/safetensors*

%changelog

OBS upload:
- The repaired package directory was uploaded to OBS. Upload tool returned: Success: File temp_workspace/failed_python-safetensors uploaded to OBS failed_python-safetensors successfully.

Notes and rationale:
- This change is intentionally minimal: it only sets a documented PyO3 environment variable to permit building against the newer system Python. The alternative would be to update the PyO3 dependency in the package sources (upstream/library), but that is a larger change that touches package contents.
- Setting PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 is recommended by PyO3 as a way to build with newer Python when the crate hasn't yet updated its explicit compatibility check. It uses the stable ABI and is a safe, minimal approach for packaging.

If build still fails after this change, next steps:
- Re-run the build to confirm. If a different error appears, gather the next failing log section and iterate.
- If ABI3 forward compatibility is insufficient (rare), consider pinning to a Python version supported by upstream or patching the pyproject to update PyO3.
openSUSE Build Service is sponsored by