## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

# Not yet packaged: python3dist(pettingzoo)
%bcond gymnasium 0

%bcond torch 1

Name:           python-ratinabox
Version:        1.15.3
Release:        %autorelease
Summary:        A package for simulating motion and ephys data in continuous environments

# SPDX
License:        MIT
URL:            https://github.com/TomGeorge1234/RatInABox
# If we switched to the GitHub archive from the PyPI sdist, we could add a
# CITATION.bib file, a demos/ directory, and Sphinx-generated documentation;
# however, we consider this not worthwhile, especially since the demos are so
# large that it is doubtful whether it is worth packaging them.
Source:         %{pypi_source ratinabox}

# The package is arched so that the BR and weak dependency on python-torch can
# be conditionalized. It does not contain compiled machine code, so there are
# no debugging symbols.
%global debug_package %{nil}
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
# (Plus, python-scikit-learn has dropped i686.)
ExcludeArch:    %{ix86}

BuildRequires:  python3-devel

# Run tests in parallel (“-n auto”)
BuildRequires:  %{py3_dist pytest-xdist}
%if %{with torch}
BuildRequires:  (%{py3_dist torch} if (python3(x86-64) or python3(aarch-64)))
%endif

%global common_description %{expand:
RatInABox is a toolkit for generating locomotion trajectories and complementary
neural data for spatially and/or velocity selective cell types in complex
continuous environments.}

%description %{common_description}


%package -n     python3-ratinabox
Summary:        %{summary}

BuildArch:      noarch

Recommends:     (%{py3_dist torch} if (python3(x86-64) or python3(aarch-64)))

%description -n python3-ratinabox %{common_description}


%if %{with gymnasium}
%pyproject_extras_subpkg -n python3-ratinabox gymnasium
%endif


%prep
%autosetup -n ratinabox-%{version}


%generate_buildrequires
%pyproject_buildrequires -x test%{?with_gymnasium:,gymnasium}


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files -l ratinabox


%check
# Let’s do this in addition to running the tests, so we can be aware of any
# issues in contribs that may not be tested.
%if %{with torch}
%ifarch %{x86_64} %{arm64}
%global can_test_torch 1
%endif
%endif
%{pyproject_check_import \
    %{?!can_test_torch:-e '*.contribs.NeuralNetworkNeurons'} \
    %{?!with_gymnasium:-e '*.contribs.TaskEnvironment'} }

%if %{without gymnasium}
# Indirectly (via ratinabox/contribs/TaskEnvironment.py) requires pettingzoo:
ignore="${ignore-} --ignore=tests/test_taskenv.py"
%endif
%pytest ${ignore-} -v -n auto


%files -n python3-ratinabox -f %{pyproject_files}
%doc README.md


%changelog
## START: Generated by rpmautospec
* Wed Mar 05 2025 Benjamin A. Beasley <code@musicinmybrain.net> - 1.15.3-2
- Use %%{x86_64} %%{arm64} macros in arch. conditionals

* Tue Feb 25 2025 Packit <hello@packit.dev> - 1.15.3-1
- Update to 1.15.3 upstream release
- Resolves: rhbz#2347457

* Sat Jan 18 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.15.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild

* Tue Dec 17 2024 Packit <hello@packit.dev> - 1.15.2-1
- Update to 1.15.2 upstream release
- Resolves: rhbz#2332846

* Fri Nov 01 2024 Packit <hello@packit.dev> - 1.15.1-1
- Update to 1.15.1 upstream release
- Resolves: rhbz#2323161

* Tue Aug 20 2024 Packit <hello@packit.dev> - 1.14.1-1
- Update to 1.14.1 upstream release
- Resolves: rhbz#2306087

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.14.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Tue Jul 16 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.14.0-1
- Update to 1.14.0 (close RHBZ#2298240)

* Tue Jul 16 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.13.0-2
- Revert "Temporarily do without PyTorch on F41"

* Fri Jun 21 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.13.0-1
- Update to 1.13.0 (close RHBZ#2293646)

* Sat Jun 08 2024 Python Maint <python-maint@redhat.com> - 1.12.6-3
- Rebuilt for Python 3.13

* Thu Mar 28 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.12.6-1
- [packit] 1.12.6 upstream release
- Resolves rhbz#2272053

* Thu Mar 14 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.12.5-2
- Use rich dependencies to make python3-ratinabox noarch again

* Thu Mar 14 2024 Packit <hello@packit.dev> - 1.12.5-1
- [packit] 1.12.5 upstream release
- Resolves rhbz#2269528

* Thu Mar 14 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.12.4-2
- F40+: Drop i686 support

* Thu Mar 14 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.12.4-1
- Update to 1.12.4 (close RHBZ#2269521)

* Thu Mar 14 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.12.3-2
- Add an rpmlintrc file

* Wed Mar 13 2024 Packit <hello@packit.dev> - 1.12.3-1
- [packit] 1.12.3 upstream release
- Resolves rhbz#2269162

* Wed Mar 13 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.12.1-2
- Temporarily do without PyTorch on F41

* Mon Feb 19 2024 Packit <hello@packit.dev> - 1.12.1-1
- [packit] 1.12.1 upstream release
- Resolves rhbz#2264992

* Fri Feb 02 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.12.0-2
- Conditionalize python-torch dependencies on architecture
- The package is therefore no longer noarch.

* Fri Feb 02 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.12.0-1
- Update to 1.12.0 (close RHBZ#2262438)

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.11.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.11.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Dec 17 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.11.4-3
- Assert that %%pyproject_files contains a license file

* Sun Dec 17 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.11.4-2
- F40+: Enable BR and weak dependency on PyTorch

* Thu Dec 07 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.11.4-1
- Update to 1.11.4 (close RHBZ#2253380)

* Tue Dec 05 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.11.2-1
- Update to 1.11.2 (close RHBZ#2253008)

* Tue Nov 21 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.11.1-1
- Update to 1.11.1 (close RHBZ#2250734)

* Mon Nov 13 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.11.0-1
- Update to 1.11.0 (close RHBZ#2249382)

* Sun Oct 22 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.10.2-1
- Update to 1.10.2 (close RHBZ#2245423)

* Thu Oct 12 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.10.0-1
- Update to 1.10.0 (close RHBZ#2243563)

* Mon Sep 18 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.9.3-1
- Update to 1.9.3 (close RHBZ#2239469)

* Fri Sep 08 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.9.2-1
- Update to 1.9.2 (close RHBZ#2238000)

* Wed Aug 30 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.9.1-1
- Update to 1.9.1 (close RHBZ#2236083)

* Wed Aug 23 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.9.0-2
- Run an import-only “smoke test” *in addition to* the test suite

* Wed Aug 23 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.9.0-1
- Update to 1.9.0 (close RHBZ#2233318)

* Tue Aug 15 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.8.0-1
- Update to 1.8.0 (close RHBZ#2232115)

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Tue Jul 04 2023 Python Maint <python-maint@redhat.com> - 1.7.1-2
- Rebuilt for Python 3.12

* Fri Jun 16 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.7.1-1
- Update to 1.7.1 (close RHBZ#2213014)

* Mon May 29 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.6.3-1
- Initial package (close RHBZ#2209193)
## END: Generated by rpmautospec