summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0eacdf882e124410422307f7b305c0666f269bb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Maintainer: Carl Smedstad <carsme@archlinux.org>

pkgname=python-pytensor
_pkgname=${pkgname#python-}
pkgver=2.23.0
pkgrel=1
pkgdesc="Fork of Aesara -- Library for defining, optimizing, and efficiently evaluating mathematical expressions involving multi-dimensional arrays"
arch=(x86_64)
url="https://github.com/pymc-devs/pytensor"
license=(LicenseRef-PyTensorLicense)
depends=(
  glibc
  python
  python-cons
  python-etuples
  python-filelock
  python-llvmlite
  python-logical-unification
  python-minikanren
  python-numpy
  python-pydot
  python-scipy
  python-setuptools
)
makedepends=(
  cython
  git
  python-build
  python-installer
  python-versioneer
  python-wheel
)
checkdepends=(
  python-jax
  python-numba
  python-pytest
  python-pytest-mock
  python-tensorflow-probability
)
optdepends=(
  'python-jax: for graph transpilation compilation via JAX'
  'python-numba: for graph transpilation compilation via Numba'
  'python-tensorflow-probability: for graph transpilation compilation via JAX'
)
source=("git+$url.git#tag=rel-$pkgver")
sha256sums=('d4e6dd418a7b32cb0baaae1acef7f70328741592a9710b2f25698f08fca8351d')

_archive="$_pkgname"

build() {
  cd "$_archive"

  python -m build --wheel --no-isolation
}

check() {
  cd "$_archive"

  local deselect_test_args=(
    # d3viz functionality is currently not being maintained, see:
    # https://github.com/pymc-devs/pytensor/issues/333
    --deselect=tests/d3viz/test_d3viz.py

    # Raises ImportError when importing 'bijectors' from "partially
    # initialized" module 'tensorflow_probability.substrates.jax', not sure
    # why.
    --deselect=tests/link/jax/test_scalar.py

    # Requires python-pytest-benchmark.
    --deselect=tests/link/jax/test_elemwise.py::test_logsumexp_benchmark

    # Most time-consuming test files, deselect these to make test duration
    # more reasonable.
    --deselect=tests/link/numba/test_elemwise.py
    --deselect=tests/link/numba/test_scan.py
    --deselect=tests/scalar/test_basic.py
    --deselect=tests/scan/test_basic.py
    --deselect=tests/scan/test_checkpoints.py
    --deselect=tests/scan/test_rewriting.py
    --deselect=tests/sparse/test_basic.py
    --deselect=tests/sparse/test_var.py
    --deselect=tests/tensor/conv/test_abstract_conv.py
    --deselect=tests/tensor/rewriting/test_basic.py
    --deselect=tests/tensor/rewriting/test_elemwise.py
    --deselect=tests/tensor/rewriting/test_math.py
    --deselect=tests/tensor/rewriting/test_subtensor.py
    --deselect=tests/tensor/test_basic.py
    --deselect=tests/tensor/test_blas.py
    --deselect=tests/tensor/test_blockwise.py
    --deselect=tests/tensor/test_casting.py
    --deselect=tests/tensor/test_elemwise.py
    --deselect=tests/tensor/test_extra_ops.py
    --deselect=tests/tensor/test_inplace.py
    --deselect=tests/tensor/test_math.py
    --deselect=tests/tensor/test_math_scipy.py
    --deselect=tests/tensor/test_slinalg.py
    --deselect=tests/tensor/test_sort.py
    --deselect=tests/tensor/test_subtensor.py
  )

  rm -rf tmp_install
  python -m installer --destdir=tmp_install dist/*.whl

  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  export PYTHONPATH="$PWD/tmp_install/$site_packages"
  pytest tests "${deselect_test_args[@]}"
}

package() {
  cd "$_archive"

  python -m installer --destdir="$pkgdir" dist/*.whl

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