# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Ashwin Vishnu <ashwinvis+arch at pr0t0nm4il dot com>
# Contributor: Specter119 <specter119 AT gmail DOT com>
# Contributor: xantares

_pyname=ipyparallel
pkgname=python-$_pyname
pkgver=9.0.2
pkgrel=1
pkgdesc='Interactive Parallel Computing in Python'
url='https://pypi.org/project/ipyparallel/'
arch=(any)
license=(BSD-3-Clause)
depends=(ipython
         python
         python-dateutil
         python-decorator
         python-ipykernel
         python-jupyter-client
         python-psutil
         python-pyzmq
         python-tornado
         python-tqdm
         python-traitlets)
makedepends=(git
             python-build
             python-hatchling
             python-installer)
checkdepends=(python-numpy
              python-pytest-asyncio
              python-pytest-tornado)
optdepends=('openmpi: to use the MPI Launchers in ipcluster command')
source=(git+https://github.com/ipython/ipyparallel#tag=$pkgver)
sha256sums=('26738e7864e314ee2da557b53003b380830bcfb3466001c80d17484103945508')

build() {
  cd $_pyname
  IPP_DISABLE_JS=1 \
  python -m build --wheel --no-isolation --skip-dependency-check
}

check() {
  cd $_pyname
  python -m installer --destdir=test_install dist/*.whl
  PYTHONPATH="$PWD"/test_install/`python -c "from sysconfig import get_path; print(get_path('platlib'))"` \
  pytest -v -k 'not test_local_ip_true_doesnt_trigger_warning' -W ignore::DeprecationWarning
}

package() {
  cd $_pyname
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 COPYING.md "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
  mv "$pkgdir"/{usr/,}etc
  rm -r "$pkgdir"/usr/lib/python*/site-packages/ipyparallel/tests
}
