%global pypi_name einops %global pypi_version 0.8.0 # pips to test, use mock --enable-network %bcond_with test Name: python-%{pypi_name} Version: %{pypi_version} Release: %autorelease Summary: Deep learning operations reinvented License: MIT URL: https://github.com/arogozhnikov/einops Source0: %{url}/archive/v%{version}.tar.gz#/%{pypi_name}-%{pypi_version}.tar.gz BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3dist(numpy) BuildRequires: python3dist(nbformat) BuildRequires: python3dist(nbconvert) BuildRequires: python3dist(parameterized) BuildRequires: python3dist(pillow) BuildRequires: python3dist(pytest) BuildRequires: python3dist(torch) %description Flexible and powerful tensor operations for readable and reliable code. Supports numpy, pytorch, tensorflow, jax, and others. %package -n python3-%{pypi_name} Summary: Deep learning operations reinvented %description -n python3-%{pypi_name} Flexible and powerful tensor operations for readable and reliable code. Supports numpy, pytorch, tensorflow, jax, and others. %prep %autosetup -n %{pypi_name}-%{pypi_version} # Remove bundled egg-info rm -rf %{pypi_name}.egg-info # To prevent import errors, remove the frameworks we have no support for. rm einops/layers/chainer.py rm einops/layers/flax.py rm einops/layers/keras.py rm einops/layers/oneflow.py rm einops/layers/paddle.py rm einops/layers/tensorflow.py # Do not use a bare python in the test sed -i -e 's@python -m@%__python3 -m@' test.py # Remove some tests # if sys.version_info >= (3, 13): # > raise RuntimeError("Dynamo is not supported on Python 3.13+") # E RuntimeError: Dynamo is not supported on Python 3.13+ rm tests/test_other.py rm tests/test_ops.py rm tests/test_examples.py # def test_pack_unpack_array_api(): # from einops import array_api as AA #> import numpy.array_api as xp #E ModuleNotFoundError: No module named 'numpy.array_api' rm tests/test_packing.py rm tests/test_notebooks.py %generate_buildrequires %pyproject_buildrequires -t %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l %{pypi_name} %check %pyproject_check_import %if %{with test} export PYTHONPATH=$PYTHONPATH:%{buildroot}%{python3_sitelib}/%{pypi_name} %__python3 test.py torch %endif %files -n python3-%{pypi_name} -f %{pyproject_files} %doc README.md %changelog %autochangelog