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

_pyname=traitlets
pkgname=python-$_pyname
pkgver=5.14.3
pkgrel=3
pkgdesc='A configuration system for Python applications'
arch=(any)
url='https://traitlets.readthedocs.io/en/stable'
license=(BSD-3-Clause)
depends=(python
         python-argcomplete
         python-typing_extensions)
makedepends=(git
             python-build
             python-hatchling
             python-installer)
checkdepends=(python-pytest-mock
              python-pytest-mypy-testing)
source=(git+https://github.com/ipython/traitlets#tag=v$pkgver)
sha256sums=('84a712e6293b4bfde7a609f7bee3bca22c8b120766ea9d5f6fe7171b86cc3d48')

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

check() {
  cd $_pyname
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest -v -k 'not mypy_dict_typing'
}

package() {
  cd $_pyname
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
