summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 73533a117beb5815ee5ca500a9295287ad0cd08d (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
116
117
# Maintainer: Harriet O'Brien <harrietobrien@protonmail.com>
# Contributor: Carl Smedstad <carsme@archlinux.org>

pkgname=python-pytensor
_pkgname=${pkgname#python-}
pkgver=2.29.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=("${url}/archive/refs/tags/rel-${pkgver}.tar.gz")
sha256sums=('41189ee434509c70a33a741c088cb6ec1b067c9c8240bf294e2f70ad7f5dd4c1')

build() {
  cd "$srcdir/$_pkgname-rel-$pkgver"
  python -m build --wheel --no-isolation
}

:||{
check() {
  cd "$srcdir/$_pkgname-rel-$pkgver"

  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', unsure 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 "$srcdir/$_pkgname-rel-$pkgver"

  python -m installer --destdir="/$pkgdir" dist/*.whl
  #python -m installer --destdir="/usr/bin" dist/*.whl
  #python -m installer --destdir="/opt" dist/*.whl

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