Blob Blame History Raw
%bcond tests 1

Name:           python-pydantic
Version:        2.7.1
Release:        %autorelease
Summary:        Data validation using Python type hinting

License:        MIT
Source:         %{url}/archive/v%{version}/%{name}-%{version}.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 pytest}
BuildRequires:  %{py3_dist pytest-mock}

%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.

%autosetup -n pydantic-%{version} -p1

# Delete pytest addopts. We don't care about benchmarking or coverage.
tomcli-set pyproject.toml del 'tool.pytest.ini_options.addopts'

%pyproject_buildrequires -x email -x dotenv


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

%pyproject_save_files -l pydantic

%pyproject_check_import -e pydantic.mypy -e pydantic.v1.mypy
%if %{with tests}
# We don't build docs or care about benchmarking
%pytest --ignore=tests/{,benchmarks}

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

%pyproject_extras_subpkg email -n python3-pydantic

%files doc
%license LICENSE
%doc docs/*