summaryrefslogtreecommitdiff
path: root/keras.spec
blob: d940011b59407acca705d1afa307e4234f638807 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
%global pypi_name keras
# Pure-Python, architecture-independent package
%global debug_package %{nil}

Name:           python-Keras
Version:        3.12.0
Release:        1%{?dist}
Summary:        Multi-backend deep learning framework for humans
License:        Apache-2.0
URL:            https://keras.io/
Source0:        https://github.com/keras-team/keras/archive/refs/tags/v%{version}/keras-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3-pip
BuildRequires:  python3-setuptools
BuildRequires:  python3-wheel

%description
Keras is a multi-backend, high-level neural networks API written in Python.
It is capable of running on top of TensorFlow, JAX, PyTorch, and other
frameworks, and focuses on enabling fast experimentation.

Read the documentation at: https://keras.io/

%package -n python3-Keras
Summary:        Multi-backend deep learning framework for humans
Provides:       python-Keras = %{version}-%{release}
Provides:       python3dist(keras) = %{version}
Requires:       python3-absl-py
Requires:       python3-numpy
Requires:       python3-rich
Requires:       python3-namex
Requires:       python3-h5py
Requires:       python3-optree
Requires:       python3-ml-dtypes
Requires:       python3-packaging

%description -n python3-Keras
Keras is a multi-backend, high-level neural networks API written in Python.
It is capable of running on top of TensorFlow, JAX, PyTorch, and other
frameworks, and focuses on enabling fast experimentation.

Read the documentation at: https://keras.io/

%package help
Summary:        Development documents and examples for Keras
Requires:       python3-Keras = %{version}-%{release}
Provides:       python3-Keras-doc
%description help
Keras is a multi-backend, high-level neural networks API written in Python.
This package provides the development guides and examples shipped with Keras.

%prep
%autosetup -n keras-%{version}
# Upstream derives the version from a dynamic setuptools attr
# (keras.src.version.__version__). Combined with the package-dir remapping
# that attr cannot be resolved by the distribution setuptools, so pin the
# version statically where it is already known.
sed -i 's/^dynamic = \["version"\]$/version = "%{version}"/' pyproject.toml
# Drop the upstream test modules from the released wheel, matching what the
# upstream pip_build.py produces.
find keras -name '*_test.py' -delete

%build
# Make sure the wheel/setuptools build backend is importable even when the
# distribution ships them under a non-standard prefix (e.g. /usr/local),
# which rpmbuild does not place on sys.path by default.
for d in /usr/local/lib64/python*/site-packages /usr/local/lib/python*/site-packages; do
  [ -d "$d" ] && export PYTHONPATH="$d${PYTHONPATH:+:$PYTHONPATH}"
done
pip3 wheel --no-build-isolation --no-deps --wheel-dir %{_builddir}/wheels .

%install
mkdir -p %{buildroot}%{python3_sitelib}
wheel=$(ls %{_builddir}/wheels/keras-%{version}-*.whl)
%{__python3} -m zipfile -e "$wheel" %{buildroot}%{python3_sitelib}

install -d -m755 %{buildroot}%{_pkgdocdir}
for d in guides examples; do
  if [ -d "$d" ]; then cp -arf "$d" %{buildroot}%{_pkgdocdir}/; fi
done

%files -n python3-Keras
%license LICENSE
%{python3_sitelib}/keras/
%{python3_sitelib}/keras-%{version}*.dist-info/

%files help
%license LICENSE
%{_pkgdocdir}

%changelog
* Wed Dec 02 2026 Python_Bot <Python_Bot@openeuler.org> - 3.12.0-1
- Upgrade to 3.12.0 (multi-backend Keras 3)