# Contributor: Newbyte <newbyte@disroot.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-pydantic
pkgver=2.9.2
pkgrel=0
pkgdesc="Data parsing and validation using Python type hints"
url="https://github.com/pydantic/pydantic"
arch="noarch"
license="MIT"
depends="
	py3-annotated-types
	py3-pydantic-core
	py3-typing-extensions
	"
makedepends="
	py3-gpep517
	py3-hatchling
	py3-hatch-fancy-pypi-readme
	py3-wheel
	"
checkdepends="
	py3-cloudpickle
	py3-dirty-equals
	py3-email-validator
	py3-faker
	py3-hypothesis
	py3-jsonschema
	py3-pytest
	py3-pytest-mock
	py3-pytest-benchmark
	py3-rich
	py3-tzdata
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/pydantic/pydantic/archive/refs/tags/v$pkgver.tar.gz
	invalid_schema.patch
	"
builddir="$srcdir/pydantic-$pkgver"
patch_args="-p1 --no-backup-if-mismatch"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	.testenv/bin/python3 -m pytest --benchmark-disable \
		--ignore=tests/test_docs.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
ca4efd3972fabff9be675e1f8bc39b4048e18b56db7d8985c560172aceb9f73818ede407d1b97a9069815c0cc7ce9b8dada0cbb43ba0f66a84be7700b48230b6  py3-pydantic-2.9.2.tar.gz
26712b861a0a564e18d3bad19fd87753f4c1643b728f6906857cfa84cab508b091f66c58db87415993a3a7c320facccf3952d5438d0b389a183aecf62c6d819d  invalid_schema.patch
"
