summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3c7d286a73201c94c00f0cc7e1b05c8a84f763a8 (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
# -*- mode: shell-script -*-
# Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>
# Contributor: Dylon Edwards <deltaecho at archlinux dot us>

pkgname='python-tensorly'
pkgver=0.6.0
pkgrel=1
pkgdesc="Simple and Fast Tensor Learning in Python"
arch=('any')
url="https://tensorly.org/stable/home.html"
license=('BSD')
depends=(
    python
)
makedepends=(
    python-setuptools
)
optdepends=(
    python-numpy
    python-pytorch
    python-tensorflow
)
checkdepends=(
    python-pytest
    ${optdepends[@]}
)
# skipped backend tests
# - mxnet: somehow some tests fail
# - cupy: needs a GPU for tests
# - jax: build fails (https://github.com/google/jax/issues/7712)
optdepends+=(
    mxnet
    python-cupy
    python-jax
)
changelog="${pkgname}.changelog"
source=("tensorly-${pkgver}.tar.gz::https://github.com/tensorly/tensorly/archive/${pkgver}.tar.gz")
sha256sums=('e36a9124efd34f76fc727b0c45e92655a256231b56897591ee0d451ada279262')

build() {
    cd "tensorly-${pkgver}"
    python setup.py build
}

check() {
    cd "tensorly-${pkgver}"

    for backend in numpy pytorch tensorflow; do
        echo Testing against the $backend backend
        TENSORLY_BACKEND=$backend pytest -v tensorly
    done
}

package() {
    cd "tensorly-${pkgver}"
    python setup.py install --skip-build --root="$pkgdir" --optimize=1
    install -Dm644 LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname
}