# Contributor: Aiden Grossman <agrossman154@yahoo.com>
# Maintainer:
pkgname=py3-jupyter_client
pkgver=8.6.1
pkgrel=1
pkgdesc="Jupyter protocol client APIs"
url="https://github.com/jupyter/jupyter_client"
arch="noarch"
license="BSD-3-Clause"
depends="
	py3-dateutil
	py3-jupyter_core
	py3-pyzmq
	py3-tornado
	py3-traitlets
	"
makedepends="py3-gpep517 py3-hatchling"
checkdepends="
	ipython
	openssh
	py3-ipykernel
	py3-pytest
	py3-pytest-asyncio
	py3-pytest-jupyter
	py3-pytest-timeout
	"
# circular dependency with py3-ipykernel
options="!check"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/jupyter/jupyter_client/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/jupyter_client-$pkgver/"

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

check() {
	# first test fails on empty queue, more investigation needed
	# last test has a file descriptor related error, more investigation needed
	# other tests all hit their specified timeout
	pytest -vv \
		--deselect tests/test_kernelmanager.py::TestKernelManager::test_signal_kernel_subprocesses \
		--deselect tests/test_kernelmanager.py::TestParallel::test_start_parallel_thread_kernels \
		--deselect tests/test_kernelmanager.py::TestParallel::test_start_sequence_kernels \
		--deselect tests/test_kernelmanager.py::TestParallel::test_start_parallel_process_kernels \
		--deselect tests/test_kernelmanager.py::TestParallel::test_start_sequence_process_kernels \
		--deselect tests/test_kernelmanager.py::TestAsyncKernelManager::test_signal_kernel_subprocesses \
		--deselect tests/test_multikernelmanager.py::TestKernelManager::test_tcp_cinfo
}

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

sha512sums="
441ecaa3e2d8a44361458c2bfcde328db631890b424dd98391c329477077739985ac948892539a1491c00fe76021e576978b373f1d56adc2a45ae91aff76acb3  py3-jupyter_client-8.6.1.tar.gz
"
