# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer:
pkgname=py3-pytools
pkgver=2025.1.2
pkgrel=0
pkgdesc="Collection of tools for Python3"
url="https://github.com/inducer/pytools"
arch="noarch"
license="MIT"
depends="
	py3-platformdirs
	py3-typing-extensions
	"
makedepends="
	py3-gpep517
	py3-hatchling
	"
checkdepends="
	py3-numpy
	py3-pytest
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/inducer/pytools/archive/v$pkgver.tar.gz"
builddir="$srcdir/pytools-$pkgver"

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
	# some tests depend on siphash24 which isn't packaged
	# https://github.com/inducer/pytools/pull/251
	.testenv/bin/python3 -m pytest --ignore pytools/test/test_persistent_dict.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	# Tests shouldn't be included
	rm -r "$pkgdir"/usr/lib/python*/site-packages/pytools/test
}

sha512sums="
0f8552328f0b76e8f681ee90e074dcb58071955f0e0a8fdaabdd42bdcc6a7a1d24a8a731956d63897c290c689b73ebf1ef644dbeb03c6501155271a2be81e877  py3-pytools-2025.1.2.tar.gz
"
