# Maintainer: Jakub Klinkovský <lahwaacz at archlinux dot org>
# Maintainer: Bruno Pagani <archange@archlinux.org>
# Contributor: Andrzej Giniewicz <gginiu@gmail.com>
# Contributor: Oliver Sherouse <oliver DOT sherouse AT gmail DOT com>

_name=seaborn
pkgname=python-$_name
pkgver=0.13.2
pkgrel=2.2
pkgdesc="Statistical data visualization"
arch=(any)
url="https://seaborn.pydata.org/"
license=(BSD-3-Clause)
depends=(
  python-pandas
  python-matplotlib
)
makedepends=(
  python-build
  python-installer
  python-flit-core
)
optdepends=(
  'python-scipy: clustering matrices and some advanced options'
  'python-statsmodels: advanced regression plots'
)
checkdepends=(
  python-pytest
  python-scipy
  python-statsmodels
)
source=(https://github.com/mwaskom/seaborn/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
b2sums=('f50643890b980d55916bfc508367e4255e259ec537d02cfc1d68da29035d1e44507748f9b0f5e0a27564476f5b328af2b79f35611877e51879f8c440cccfcf01')

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

check() {
  cd $_name-$pkgver
  local pytest_options=(
    -vv
    -W ignore::DeprecationWarning
    # AttributeError: module 'numpy' has no attribute 'VisibleDeprecationWarning'
    --deselect tests/test_distributions.py::TestKDEPlotBivariate::test_weights
    # KeyError: 'labelleft'
    --deselect tests/_core/test_plot.py::TestLabelVisibility::test_1d_column_wrapped
    --deselect tests/_core/test_plot.py::TestLabelVisibility::test_1d_row_wrapped
  )
  pytest "${pytest_options[@]}"
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 LICENSE.md -t "$pkgdir"/usr/share/licenses/$pkgname/
}
