%global pypi_name tensordict
%global pypi_version 0.3.1
# torch toolchain
%global toolchain gcc
Name: python-%{pypi_name}
Version: %{pypi_version}
Release: %autorelease
Summary: TensorDict is a PyTorch dedicated tensor container
License: MIT
URL: https://github.com/pytorch/%{pypi_name}
Source0: %{url}/archive/v%{version}.tar.gz#/%{pypi_name}-v%{version}.tar.gz
# Limit to these because that is what torch is on
ExclusiveArch: x86_64 aarch64
BuildRequires: clang
BuildRequires: ninja-build
BuildRequires: python3-devel
BuildRequires: python3-torch
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(pybind11)
Requires: python3dist(torch)
%description
TensorDict is a dictionary-like class that inherits properties from tensors,
such as indexing, shape operations, casting to device or point-to-point
communication in distributed settings.
The main purpose of TensorDict is to make code-bases more readable and
modular by abstracting away tailored operations.
%package -n python3-%{pypi_name}
Summary: TensorDict is a pytorch dedicated tensor container
%description -n python3-%{pypi_name}
TensorDict is a dictionary-like class that inherits properties from tensors,
such as indexing, shape operations, casting to device or point-to-point
communication in distributed settings.
The main purpose of TensorDict is to make code-bases more readable and
modular by abstracting away tailored operations.
%prep
%autosetup -p1 -n %{pypi_name}-%{version}
%generate_buildrequires
%pyproject_buildrequires
%build
# Building uses python3_sitearch/torch/utils/cpp_extension.py
# cpp_extension.py does a general linking with all the pytorch libs which
# leads warnings being reported by rpmlint.
%pyproject_wheel
%check
%pyproject_check_import
%install
%pyproject_install
%pyproject_save_files %{pypi_name}
%files -n python3-%{pypi_name} -f %{pyproject_files}
%license LICENSE
%doc README.md
%changelog
%autochangelog