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
URL:            https://github.com/pydantic/pydantic
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}
%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-%{version} -p1

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


%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}
# We don't build docs or care about benchmarking
%pytest --ignore=tests/{test_docs.py,benchmarks}
%endif


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

%pyproject_extras_subpkg email -n python3-pydantic

%files doc
%license LICENSE
%doc docs/*

%changelog
%autochangelog