# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-pydantic-core
pkgver=2.27.2
pkgrel=0
pkgdesc="Core validation logic for pydantic written in rust"
url="https://github.com/pydantic/pydantic-core"
arch="all"
license="MIT"
depends="py3-typing-extensions"
makedepends="py3-gpep517 py3-maturin py3-wheel py3-installer cargo"
checkdepends="
	py3-pytest
	py3-pytest-benchmark
	py3-pytest-mock
	py3-pytest-timeout
	py3-hypothesis
	py3-dirty-equals
	py3-tzdata
	"
subpackages="$pkgname-pyc"
source="https://github.com/pydantic/pydantic-core/archive/refs/tags/v$pkgver/py3-pydantic-core-$pkgver.tar.gz"
builddir="$srcdir/pydantic-core-$pkgver"
options="net" # cargo crates

prepare() {
	default_prepare
	cargo fetch --locked
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--config-json '{"build-args": "--frozen"}' \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	# allow_partial: circular dependency on py3-inline-snapshot
	.testenv/bin/python3 -m pytest --ignore=tests/validators/test_allow_partial.py
}

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

sha512sums="
2720fe30c074b654bad2f200786962f3d92300de01b757b3a6a892cc3a2cec0693fd0070cee8d27a6c83baba68a29a6fd049cdf2d4fdd50bc07312ef4f3cf47c  py3-pydantic-core-2.27.2.tar.gz
"
