## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    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

%bcond tests 1

Name:           python-pydantic
Version:        2.10.3
%global srcversion %{lua:return(rpm.expand("%{version}"):gsub("~",""))}
Release:        %autorelease
Summary:        Data validation using Python type hinting

# SPDX
License:        MIT
URL:            https://github.com/pydantic/pydantic
Source:         %{url}/archive/v%{srcversion}/pydantic-%{srcversion}.tar.gz

BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  tomcli
# For check phase
%if %{with tests}
BuildRequires:  %{py3_dist cloudpickle}
BuildRequires:  %{py3_dist dirty-equals}
BuildRequires:  %{py3_dist jsonschema}
BuildRequires:  %{py3_dist pytest}
BuildRequires:  %{py3_dist pytest-mock}
BuildRequires:  %{py3_dist pytz}
# Required for test_pretty_print
BuildRequires:  %{py3_dist rich}
%endif

%global _description %{expand:
Data validation and settings management using python type hinting.}

%description %{_description}


%package -n     python3-pydantic
Summary:        %{summary}
Recommends:     python3-pydantic+email
# The dotenv extra was removed in pydantic v2.
# Remove the Obsoletes in Fedora 43+
Obsoletes:      python3-pydantic+dotenv < 2~~

%description -n python3-pydantic %{_description}


%package        doc
Summary:        Documentaton for Pydantic

%description    doc
This package includes the documentation for Pydantic in Markdown format.


%prep
%autosetup -n pydantic-%{srcversion} -p1

# Delete pytest addopts. We don't care about benchmarking or coverage.
tomcli-set pyproject.toml del 'tool.pytest.ini_options.addopts'
# CPython 3.13 warns on FutureRef._evaluate/typing._eval_type not passing
# type_params
# https://github.com/pydantic/pydantic/issues/9613
#
#   DeprecationWarning: Failing to pass a value to the 'type_params' parameter
#   of 'typing._eval_type' is deprecated, as it leads to incorrect behaviour
#   when calling typing._eval_type on a stringified annotation that references
#   a PEP 695 type parameter. It will be disallowed in Python 3.15.
tomcli-set pyproject.toml append 'tool.pytest.ini_options.filterwarnings' \
    'ignore:Failing to pass a value.*PEP 695.*:DeprecationWarning:'


%generate_buildrequires
%pyproject_buildrequires -x email -x dotenv


%build
%pyproject_wheel


# Docs are in MarkDown, and should be added when mkdocs is packaged.

%install
%pyproject_install
%pyproject_save_files -l pydantic


%check
%pyproject_check_import -e pydantic.mypy -e pydantic.v1.mypy
%if %{with tests}
%if %{defined fc40}
# An error message has different text than the test expects, but the expected
# error occurs and the message is semantically equivalent, so we can safely
# skip this test.
# E       AssertionError: Regex pattern did not match.
# E        Regex: "Unable\\ to\\ evaluate\\ type\\ annotation\\ 'CustomType\\[int\\]'\\."
# E        Input: "type 'CustomType' is not subscriptable"
k="${k-}${k+ and }not test_invalid_forward_ref"
# This seems to be related to adaptations in the tests for pytest version 8;
# Fedora 40 still has pytest version 7. See
# https://github.com/pydantic/pydantic/issues/8674.
# E       Failed: DID NOT WARN. No warnings of type (<class
#         'pydantic.json_schema.PydanticJsonSchemaWarning'>,) were emitted.
# E       The list of emitted warnings is: [].
k="${k-}${k+ and }not test_callable_fallback_with_non_serializable_default"
%endif

# We don't build docs or care about benchmarking
ignore="${ignore-} --ignore=tests/test_docs.py"
ignore="${ignore-} --ignore=tests/benchmarks"

%pytest ${ignore-} -k "${k-}" -rs
%endif


%files -n python3-pydantic -f %{pyproject_files}
%doc CITATION.cff
%doc HISTORY.md
%doc README.md

# Note that the timezone extra has no dependencies on our platform.
%pyproject_extras_subpkg email timezone -n python3-pydantic

%files doc
%license LICENSE
%doc docs/*

%changelog
## START: Generated by rpmautospec
* Fri Dec 06 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.10.3-1
- Update to 2.10.3 (close RHBZ#2330186)

* Tue Nov 26 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.10.2-1
- Update to 2.10.2 (close RHBZ#2328974)

* Sun Nov 24 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.10.1-1
- Update to 2.10.1 (close RHBZ#2327740)

* Fri Oct 11 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.9.2-2
- Confirm that the license is SPDX MIT

* Wed Sep 18 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.9.2-1
- Update to 2.9.2

* Wed Sep 11 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.9.1-1
- Update to 2.9.1 (close RHBZ#2310330)

* Fri Aug 16 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.8.2-4
- Add pytz to test dependencies

* Fri Aug 02 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.8.2-3
- Re-enable a test that required pytest 8, now in F41

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

* Sun Jul 07 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.8.2-1
- Update to 2.8.2 (close RHBZ#2295692)

* Sat Jun 29 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.8.0~b1-1
- Update to 2.8.0~b1

* Tue Jun 18 2024 Python Maint <python-maint@redhat.com> - 2.7.4-3
- Rebuilt for Python 3.13

* Fri Jun 14 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.7.4-1
- Update to 2.7.4 (close RHBZ#2292385)

* Sun Jun 09 2024 Python Maint <python-maint@redhat.com> - 2.7.3-2
- Rebuilt for Python 3.13

* Wed Jun 05 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.7.3-1
- Update to 2.7.3 (close RHBZ#2290381)

* Thu May 30 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.7.2-2
- Ignore a new DeprecationWarning from Python 3.13 for now

* Wed May 29 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.7.2-1
- Update to 2.7.2 (close RHBZ#2283727)

* Wed Apr 24 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.7.1-1
- Update to 2.7.1. Fixes rhbz#2276773.

* Sat Apr 13 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.7.0-1
- Update to 2.7.0. Fixes rhbz#2274645.
- Package HISTORY.md and the new CITATION.cff as documentation.
- Move large documentation to a -doc subpackage

* Mon Mar 18 2024 Maxwell G <maxwell@gtmx.me> - 2.6.4-1
- Update to 2.6.4. Fixes rhbz#2269288.

* Wed Feb 28 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.6.3-1
- Update to 2.6.3. Fixes rhbz#2266533.

* Sat Feb 24 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.6.2-1
- Update to 2.6.2. Fixes rhbz#2265749.

* Mon Feb 05 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.6.1-1
- Update to 2.6.1. Fixes rhbz#2261885.

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

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

* Sun Dec 24 2023 Maxwell G <maxwell@gtmx.me> - 2.5.3-1
- Update to 2.5.3. Fixes rhbz#2255709.

* Sat Nov 25 2023 Maxwell G <maxwell@gtmx.me> - 2.5.2-1
- Update to 2.5.2. Fixes rhbz#2157134.

* Fri Nov 10 2023 Maxwell G <maxwell@gtmx.me> - 2.4.2-1
- Update to 2.4.2. Fixes rhbz#2157134.
- Obsolete dotenv extra that was removed upstream.

* Tue Oct 10 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.10.13-1
- Update to 1.10.13.

* Sat Aug 12 2023 Maxwell G <maxwell@gtmx.me> - 1.10.12-1
- Update to 1.10.12.

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

* Thu Jun 15 2023 Python Maint <python-maint@redhat.com> - 1.10.2-3
- Rebuilt for Python 3.12

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Wed Sep 07 2022 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.10.2-1
- Update to 1.10.2.

* Thu Sep 01 2022 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.10.1-1
- Update to 1.10.1.

* Wed Aug 24 2022 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.9.2-1
- Update to 1.9.2.

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 1.9.1-2
- Rebuilt for Python 3.11

* Thu Jun 09 2022 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.9.1-1
- Update to 1.9.1.

* Wed Feb 02 2022 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.9.0-1
- Update to 1.9.0.

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Wed Dec 22 2021 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.8.2-1
- Update to 1.8.2.

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 1.7.4-2
- Rebuilt for Python 3.10

* Tue May 11 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1.7.4-1
- Update to 1.7.4; fixes CVE-2021-29510

* Wed Feb 24 2021 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.7.3-1
- Update to 1.7.3.

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Tue Aug 11 2020 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.6.1-1
- Update to 1.6.1.

* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1.3-5
- Rebuilt for Python 3.9

* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Tue Jan 07 2020 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.3-3
- python-email_validator is now packaged as python-email-validator...

* Tue Jan 07 2020 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.3-2
- Review fixes.

* Mon Jan 06 2020 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.3-1
- Update to 1.3.
- Review fixes.

* Sun Nov 24 2019 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.1.1-1
- Update to 1.1.1.

* Sat Jul 27 2019 Susi Lehtola <jussilehtola@fedoraproject.org> - 0.31-1
- Initial package.

## END: Generated by rpmautospec