maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
pkgname=py3-textual
_pyname=${pkgname#py3-}
pkgver=3.2.0
pkgrel=0
pkgdesc="TUI framework for Python inspired by modern web development"
url="https://github.com/Textualize/textual"
arch="noarch"
license="MIT"
depends="
	python3
	py3-linkify-it-py
	py3-markdown-it-py
	py3-mdit-py-plugins
	py3-platformdirs
	py3-rich
	py3-typing-extensions
	"
makedepends="py3-gpep517 py3-poetry-core"
checkdepends="
	py3-pytest
	py3-pytest-xdist
	py3-pytest-asyncio
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Textualize/textual/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$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

	# test_snapshots.py requires pytest-textual-snapshot, which depends on py3-textual itself, for snap_compare fixture
	# test_languages.py requires optional tree_sitter_languages Python package
	# test_features.py is broken
	.testenv/bin/python3 -m pytest \
		--ignore=tests/snapshot_tests/test_snapshots.py \
		--ignore=tests/text_area/test_languages.py \
		--ignore=tests/test_features.py
}

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

sha512sums="
caea5b0373a3748ecc05f2f3747528e8a377853f0027c2337152d08e94f0dd1fe537a567ef2ab8eb6c5d15139f9a7b20deb3e95cd0653683537db8179d55cdfa  py3-textual-3.2.0.tar.gz
"
