# Contributor: Bart Ribbers <bribbers@disroot.org>
maintainer="Bart Ribbers <bribbers@disroot.org>"
pkgname=py3-dask
pkgver=2024.11.0
pkgrel=0
pkgdesc="Parallel computing with task scheduling"
url="https://dask.org/"
arch="noarch"
license="BSD-3-Clause"
depends="
	py3-click
	py3-cloudpickle
	py3-dask-expr
	py3-fsspec
	py3-importlib-metadata
	py3-numpy
	py3-packaging
	py3-pandas
	py3-partd
	py3-toolz
	py3-yaml
	"
makedepends="
	py3-gpep517
	py3-python-versioneer
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-aiohttp
	py3-flaky
	py3-graphviz
	py3-jinja2
	py3-pandas-tests
	py3-pyarrow
	py3-pytest
	py3-pytest-cov
	py3-pytest-runner
	py3-pytest-xdist
	py3-requests
	py3-scipy
	"
subpackages="$pkgname-pyc"
source="https://pypi.python.org/packages/source/d/dask/dask-$pkgver.tar.gz"
builddir="$srcdir/dask-$pkgver"

# secfixes:
#   2022.2.0-r0:
#     - CVE-2021-42343

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	case "$CARCH" in
	arm*)
	.testenv/bin/python3 -m pytest \
		--deselect dask/bytes/tests/test_http.py::test_bag \
		--deselect dask/dataframe/io/tests/test_orc.py \
		--deselect dask/dataframe/tests/test_dataframe.py::test_slice_on_filtered_boundary \
		--deselect dask/dataframe/tests/test_groupby.py \
		--deselect dask/tests/test_distributed.py::test_blockwise_dataframe_io \
		--deselect dask/tests/test_distributed.py::test_default_scheduler_on_worker \
		--deselect dask/tests/test_distributed.py::test_dataframe_broadcast_merge \
		--deselect dask/dataframe/io/tests/test_parquet.py::test_pandas_timestamp_overflow_pyarrow \
		--deselect dask/dataframe/tests/test_dataframe.py::test_memory_usage_dataframe \
		--deselect dask/tests/test_distributed.py::test_serializable_groupby_agg \
		--deselect dask/tests/test_distributed.py::test_futures_in_subgraphs \
		--deselect dask/dataframe/tests/test_multi.py::test_merge_asof_on_by \
		--deselect dask/dataframe/tests/test_multi.py::test_merge_asof_on_by_tolerance \
		--deselect dask/dataframe/tests/test_multi.py::test_merge_asof_on_by_tolerance_no_exact_matches \
		--deselect dask/dataframe/tests/test_multi.py::test_join_gives_proper_divisions \
		--deselect dask/dataframe/tests/test_multi.py::test_merge_maintains_columns
	# dask/tests/test_distributed.py::test_serializable_groupby_agg Fatal Python error: Bus error
	# dask/tests/test_distributed.py::test_futures_in_subgraphs Fatal Python error: Bus error
	# dask/dataframe/tests/test_multi.py::*: ValueError: putmask: output array is read-only
	# (32-bit only) possibly related: https://github.com/pandas-dev/pandas/issues/57523
		;;
	x86)
	.testenv/bin/python3 -m pytest \
		--deselect dask/bytes/tests/test_http.py::test_bag \
		--deselect dask/dataframe/io/tests/test_orc.py \
		--deselect dask/dataframe/tests/test_dataframe.py::test_slice_on_filtered_boundary \
		--deselect dask/dataframe/tests/test_groupby.py \
		--deselect dask/tests/test_distributed.py::test_blockwise_dataframe_io \
		--deselect dask/dataframe/tests/test_dataframe.py::test_memory_usage_dataframe \
		--deselect dask/dataframe/tests/test_multi.py::test_merge_asof_on_by \
		--deselect dask/dataframe/tests/test_multi.py::test_merge_asof_on_by_tolerance \
		--deselect dask/dataframe/tests/test_multi.py::test_merge_asof_on_by_tolerance_no_exact_matches \
		--deselect dask/dataframe/tests/test_multi.py::test_join_gives_proper_divisions \
		--deselect dask/dataframe/tests/test_multi.py::test_merge_maintains_columns
		;;
	s390x)
	.testenv/bin/python3 -m pytest \
		--deselect dask/bytes/tests/test_http.py::test_bag \
		--deselect dask/dataframe/io/tests/test_orc.py \
		--deselect dask/dataframe/tests/test_dataframe.py::test_slice_on_filtered_boundary \
		--deselect dask/dataframe/tests/test_groupby.py \
		--deselect dask/tests/test_distributed.py::test_blockwise_dataframe_io \
		--deselect dask/dataframe/io/tests/test_parquet.py \
		--deselect dask/bytes/tests/test_http.py::test_parquet
		;;
	*)
	.testenv/bin/python3 -m pytest \
		--deselect dask/bytes/tests/test_http.py::test_bag \
		--deselect dask/dataframe/io/tests/test_orc.py \
		--deselect dask/dataframe/tests/test_dataframe.py::test_slice_on_filtered_boundary \
		--deselect dask/dataframe/tests/test_groupby.py \
		--deselect dask/tests/test_distributed.py::test_blockwise_dataframe_io
	esac
# dask/bytes/tests/test_http.py::test_parquet[pyarrow] FAILED
# dask/dataframe/io/tests/test_orc.py::* Fatal Python error: Aborted (core dumped)
# dask/dataframe/tests/test_dataframe.py::test_slice_on_filtered_boundary[0] FAILED
# dask/dataframe/tests/test_groupby.py::* ERROR unexpected keyword argument 'reruns'
# dask/tests/test_distributed.py::test_blockwise_dataframe_io: -"-
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	rm -r "$pkgdir"/usr/lib/python*/site-packages/dask/tests
	rm -r "$pkgdir"/usr/lib/python*/site-packages/dask/*/tests
}

sha512sums="
d214b6f57f4e95491a85da2761153cc690c1f7da4f71a2f80d89fc552ec8599415febff3ae828a85c2c163fa99bcef0458f5bdbb724e3683c714c21e078c1b34  dask-2024.11.0.tar.gz
"
