Name:           tinygrad
Version:        0.7.0
Release:        1%{?dist}
Summary:        You like pytorch? You like micrograd? You love tinygrad! 

License:        MIT
URL:            https://github.com/tinygrad/tinygrad
Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz

BuildRequires:  python3-devel
# Needed for test
BuildRequires:  python3dist(pytest)
BuildArch: noarch

%global common_description %{expand:
tinygrad: For something between PyTorch and karpathy/micrograd. Maintained
by tiny corp.

This may not be the best deep learning framework, but it is a deep learning
framework.

Due to its extreme simplicity, it aims to be the easiest framework to add new
accelerators to, with support for both inference and training. If XLA is CISC,
tinygrad is RISC.}

%description %{common_description}


%prep
%autosetup

%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files tinygrad


%check
# Run CPU tests that do not need dependencies not in Fedora
# Modified from
# https://github.com/tinygrad/tinygrad/blob/master/.github/workflows/test.yml
%global test_list test_allocators.py test_assign.py test_conv.py test_conv_shapetracker.py test_gc.py test_helpers.py test_jit.py test_lazybuffer.py test_linearizer.py test_specific_conv.py test_symbolic_jit.py test_symbolic_ops.py test_symbolic_shapetracker.py test_uops.py
for test_prog in %{test_list}
do
  %python3 -m pytest test/$test_prog
done

%files -f %{pyproject_files}



%changelog
* Mon Oct 02 2023 Benson Muite <benson_muite@emailplus.org> - 0.7.0-1
- Initial package