summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a3b03c08b6b797e3ff98b7b4f0d34a6fb956290e (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
# Maintainer: Daniel Bershatsky <bepshatsky@yandex.ru>
pkgname=python-chex
_pkgname=${pkgname#python-}
pkgver=0.1.88
pkgrel=1
pkgdesc="A library of utilities for helping to write reliable JAX code"
arch=('any')
url="https://github.com/google-deepmind/chex"
license=('Apache')
groups=('deepmind' 'jax')
depends=('python-absl'
         'python-jax>=0.4.27'
         'python-numpy'
         'python-toolz'
         'python-typing_extensions')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
checkdepends=('python-cloudpickle' 'python-dm-tree' 'python-pytest')
source=("$_pkgname-$pkgver.tar.gz::https://github.com/google-deepmind/$_pkgname/archive/refs/tags/v$pkgver.tar.gz"
        'chex.diff')
sha256sums=('aa1e85724c0c45741f7ee14353539d3a3e355a0542f289ef61119d51bb621603'
            'SKIP')

prepare() {
    cd "$_pkgname-$pkgver"
    # There is no dependency on `dm-tree` in `chex`.
    sed -i '/\(dm[-_]tree\|setuptools\)/d' requirements/requirements.txt
    # https://github.com/google-deepmind/chex/issues/347
    patch -p1 -i../chex.diff
}

build() {
    python -m build -nw "$_pkgname-$pkgver"
}

check() {
    cd "$_pkgname-$pkgver"
    export PYTHONPATH=$PWD
    pytest -v -s chex
}

package() {
    cd "$_pkgname-$pkgver"
    python -m installer \
        --compile-bytecode 1 \
        --destdir $pkgdir \
        dist/$_pkgname-$pkgver-*.whl
}