summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d680c2157ed2a4ff9e4d14863396304fd72e7802 (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
# Maintainer: envolution
# Contributor: Andrea Manenti <andrea [dot] manenti [at] yahoo [dot] com>
# Contributor: Henry-ZHR <henry-zhr@qq.com>
# shellcheck shell=bash disable=SC2034,SC2154
pkgname=python-safetensors
pkgver=0.5.2
pkgrel=1
pkgdesc='Simple, safe way to store and distribute tensors'
arch=('x86_64')
url='https://github.com/huggingface/safetensors'
license=('Apache-2.0')
depends=('python')
makedepends=('python-build'
  'python-installer'
  'python-maturin'
  'python-wheel'
  'python-setuptools-rust')
optdepends=('python-jax'
  'python-flax'
  'python-jaxlib'
  'python-numpy'
  'python-paddlepaddle'
  'python-tensorflow'
  'python-pytorch')
checkdepends=('python-pytorch'
  'python-numpy'
  'python-tensorflow'
  'python-jax'
  'python-flax'
  'python-jaxlib'
  # 'python-paddlepaddle'
  'python-black'
  'python-isort'
  'flake8'
  'python-click'
  'python-huggingface-hub'
  'python-pytest'
  'python-pytest-benchmark'
  'python-hypothesis'
  'python-h5py')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('f2d6aeacb909f14925508abd7842cd3da72cd45d79d4aec7d278c66af1afbf2f')

prepare() {
  mkdir -p "safetensors-${pkgver}/.git"
}

build() {
  cd "safetensors-${pkgver}/bindings/python"

  export RUSTUP_TOOLCHAIN=stable
  python -m build --wheel --no-isolation
}

check() {
  cd "safetensors-${pkgver}/bindings/python"
  local python_version=$(python -V | sed -e 's/Python \([0-9]\.[0-9]\+\)\..*/\1/')
  mkdir "${PWD}/test_build"
  python -m installer --destdir="${PWD}/test_build" dist/*.whl
  # Disable temporarily paddlepaddle and tensorflow tests
  PYTHONPATH="${PWD}/test_build/usr/lib/python${python_version}/site-packages" pytest tests/ \
    --ignore=tests/test_paddle_comparison.py \
    --ignore=tests/test_tf_comparison.py
}

package() {
  cd "safetensors-${pkgver}/bindings/python"
  python -m installer --destdir="${pkgdir}" dist/*.whl
}
# vim:set ts=2 sw=2 et: