summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c689af5d4881d3d3ebdeec18e86ddacc22fe21d9 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Maintainer: Carl Smedstad <carl.smedstad at protonmail dot com>

pkgname=python-pytensor
_name=${pkgname#python-}
pkgver=2.18.6
pkgrel=2
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=(custom)
depends=(
  glibc
  python
  python-cons
  python-etuples
  python-filelock
  python-llvmlite
  python-logical-unification
  python-minikanren
  python-numpy
  python-pydot
  python-scipy
  python-setuptools
  python-typing_extensions
)
makedepends=(
  cython
  python-build
  python-installer
  python-versioneer
  python-wheel
)
checkdepends=(
  python-jax
  python-numba
  python-pytest
  python-pytest-benchmark
  python-pytest-mock
  python-tensorflow-probability
)
optdepends=(
  'python-jax: for graph transpilation compilation via JAX'
  'python-tensorflow-probability: for graph transpilation compilation via JAX'
  'python-numba: for graph transpilation compilation via Numba'
)

source=(
  "$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/rel-$pkgver.tar.gz"
  "remove-bin-package.patch"
)
sha256sums=(
  '393815578b527b90bc46dddff0355bf31447e8c3bd8c6c735f7d63532ecda464'
  '73360d53a5c5e5718a544c69218d3d64adc2390007a9b6781f7b61cc32415e59'
)

_archive="$_name-rel-$pkgver"

prepare() {
  cd "$_archive"

  patch --forward --strip=1 --input="$srcdir/remove-bin-package.patch"

  sed -i 's/versioneer\[toml\]==/versioneer\[toml\]>=/' pyproject.toml
}

build() {
  cd "$_archive"

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

check() {
  cd "$_archive"

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

    # I suspect this affects the global environment, specifically modifying
    # pytensor.config.profile_optimizer, which makes other tests fail, see:
    # https://github.com/pymc-devs/pytensor/issues/591
    tests/test_printing.py

    # Most time-consuming test files, ignore these to make test duration
    # more reasonable.
    tests/link/numba/test_elemwise.py
    tests/link/numba/test_scan.py
    tests/scalar/test_basic.py
    tests/scan/test_basic.py
    tests/scan/test_checkpoints.py
    tests/scan/test_rewriting.py
    tests/sparse/test_basic.py
    tests/sparse/test_var.py
    tests/tensor/conv/test_abstract_conv.py
    tests/tensor/rewriting/test_basic.py
    tests/tensor/rewriting/test_elemwise.py
    tests/tensor/rewriting/test_math.py
    tests/tensor/rewriting/test_subtensor.py
    tests/tensor/test_basic.py
    tests/tensor/test_blas.py
    tests/tensor/test_blockwise.py
    tests/tensor/test_casting.py
    tests/tensor/test_elemwise.py
    tests/tensor/test_extra_ops.py
    tests/tensor/test_inplace.py
    tests/tensor/test_math.py
    tests/tensor/test_math_scipy.py
    tests/tensor/test_slinalg.py
    tests/tensor/test_sort.py
    tests/tensor/test_subtensor.py
  )
  _ignored_tests_arg=$(printf " --ignore=%s" "${_ignored_tests[@]}")

  rm -rf tmp_install
  _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  python -m installer --destdir=tmp_install dist/*.whl

  export PYTHONPATH="$PWD/tmp_install/$_site_packages"
  # shellcheck disable=SC2086
  pytest tests \
    $_ignored_tests_arg
}

package() {
  cd "$_archive"

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

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