%global srcname jiter
%global _description %{summary}.

Name:           python-%{srcname}
Version:        0.5.0
Release:        %autorelease
Summary:        Fast iterable JSON parser

License:        MIT
URL:            https://github.com/pydantic/jiter/
Source:         %{pypi_source %{srcname}}

BuildRequires:  python3-devel

BuildRequires:  rust-packaging >= 21

BuildRequires:  rust-pyo3-devel
BuildRequires:  rust-bencher-devel
BuildRequires:  rust-codspeed-bencher-compat-devel
BuildRequires:  rust-indexmap-devel
BuildRequires:  rust-paste-devel

BuildRequires:  python3dist(dirty-equals)
BuildRequires:  python3dist(pytest)

%description
%{_description}

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

%description -n python3-%{srcname}
%{_description}


%prep
%autosetup -p1 -n %{srcname}-%{version}
cp crates/jiter/LICENSE LICENSE
%cargo_prep


%generate_buildrequires
%pyproject_buildrequires
%cargo_generate_buildrequires


%build
%pyproject_wheel

%cargo_license_summary
%{cargo_license} > LICENSE.dependencies


%install
%pyproject_install
%pyproject_save_files %{srcname}


%check
%pyproject_check_import
%pytest


%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE LICENSE.dependencies
%doc README.md

%changelog
%autochangelog