# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Kyle Keen <keenerd@gmail.com>

pkgname=jupyter-nbclient
pkgver=0.10.2
pkgrel=2
pkgdesc='A tool for running Jupyter Notebooks in different execution contexts'
arch=(any)
url='https://github.com/jupyter/nbclient'
license=(BSD-3-Clause)
depends=(jupyter-nbformat
         python
         python-jupyter-client
         python-jupyter-core
         python-traitlets)
makedepends=(git
             python-build
             python-hatchling
             python-installer)
checkdepends=(jupyter-nbconvert
              python-flaky
              python-ipywidgets
              python-pytest-asyncio
              python-testpath
              python-xmltodict)
source=(git+https://github.com/jupyter/nbclient#tag=v$pkgver)
sha256sums=('c92255950decb930edb0b95a657ecc4e9f999b5be19b8242f556afcba8b783b0')

build() {
  cd nbclient
  python -m build --wheel --no-isolation
}

check() {
  cd nbclient
  pytest -v -k 'not test_cli_simple' # fails on build server
}

package() {
  cd nbclient
  python -m installer --destdir="$pkgdir" dist/*.whl

  install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}
