# Maintainer: Bruno Pagani <archange@archlinux.org>

_pkg=distributed
pkgname=python-${_pkg}
pkgver=2024.4.1
pkgrel=2
pkgdesc="Distributed task scheduler for Dask"
arch=(x86_64 aarch64)
url="https://distributed.dask.org/"
license=(BSD-3-Clause)
depends=(
    python
    python-click
    python-cloudpickle
    python-dask
    python-jinja
    python-msgpack
    python-packaging
    python-psutil
    python-sortedcontainers
    python-tblib
    python-toolz
    python-tornado
    python-urllib3
    python-yaml
    python-zict
)
makedepends=(
    python-build
    python-installer
    python-setuptools
    python-versioneer
    python-wheel
    )
checkdepends=(ipython
    python-pytest
    python-pytest-repeat
    python-pytest-timeout
    python-flaky
    python-blosc
    python-cryptography
    python-distributed
    python-fsspec
    python-h5py
    python-ipykernel
    python-ipywidgets
    python-jsonschema
    python-locket
    python-lz4
    python-netcdf4
    python-numpy
    python-pandas
    python-paramiko
    python-prometheus_client
    python-pyarrow
    python-pytorch
    python-requests
    python-scipy
    python-snappy
    python-zstandard
)
# No tests in PyPi tarballs
#source=(https://files.pythonhosted.org/packages/source/${_pkg::1}/${_pkg}/${_pkg}-${pkgver}.tar.gz)
source=(https://github.com/dask/distributed/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('37908bfb644f223a15e010f33b6ff75b8c99ffa7b8a38370a8e688b4fac3b1cb')

prepare() {
  sed -i 's/, "versioneer\[toml\].*"//' ${_pkg}-${pkgver}/pyproject.toml
}

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

# Not collecting properly, no time to investigate
#check() {
#  cd ${_pkg}-${pkgver}
#  pytest -vvrsfE --color=yes distributed -m "not avoid_ci"
#}

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