summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7f6ac5dd0a5d82e5bb84de78869738f73c524d37 (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
# Maintainer: envolution
# Contributor: Wu Zhenyu <wuzhenyu@ustc.edu>
# shellcheck shell=bash disable=SC2034,SC2154

_pkgname=llama-cpp-python
pkgname=python-llama-cpp
pkgver=0.3.9
pkgrel=2
pkgdesc="Python bindings for llama.cpp"
arch=(any)
url=https://github.com/abetlen/llama-cpp-python
license=(GPL-3.0-or-later)
depends=(
  python-typing_extensions
  python-numpy
  python-diskcache
)
optdepends=(
  uvicorn # python-uvicorn
  python-fastapi
  python-pydantic-settings
  python-sse-starlette
  python-pyaml
)
makedepends=(
  python-scikit-build
  python-installer
  python-build
  python-wheel
  python-scikit-build-core
)
checkdepends=(
  python-pytest
  python-huggingface-hub
  python-scipy
  python-httpx
  python-fastapi
  python-sse-starlette
  #python-sse-starlette-context #missing but tests don't seem to require it
  python-pydantic-settings
  python-jinja
)
source=("https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/${_pkgname//-/_}-$pkgver.tar.gz")
sha256sums=('a3a985f558385e2f5de5b663f4e9b0817506d6af98122450142cd98e79216370')

_srcdir="llama_cpp_python-${pkgver}"
build() {
  cd $_srcdir
  export PREFIX=/usr
  python -m build --wheel --no-isolation
}

check() {
  cd $_srcdir
  python -m pytest
}

package() {
  local _sys_site=$(python -c "import sysconfig; print(sysconfig.get_paths()['purelib'])")
  cd $_srcdir
  python -m installer --destdir="$pkgdir" dist/*.whl
  rm -r "$pkgdir/$_sys_site"/{lib,bin,include}
}

# vim:set ts=2 sw=2 et: