blob: af8c3a41a7587679e8c166197bf91fa11cac72b6 (
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
|
# Maintainer: Carl Smedstad <carsme@archlinux.org>
pkgname=python-instructor
_pkgname=${pkgname#python-}
pkgver=1.0.0
pkgrel=1
pkgdesc="Structured outputs for LLMs"
arch=(any)
url="https://github.com/jxnl/instructor"
license=(MIT)
depends=(
python
python-aiohttp
python-docstring-parser
python-httpx
python-openai
python-pydantic
python-regex
python-rich
python-tenacity
python-typer
python-typing_extensions
)
makedepends=(
python-build
python-installer
python-poetry
python-wheel
)
checkdepends=(
python-anthropic
python-pytest
)
optdepends=('python-anthropic: support using Anthropic models')
source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz")
sha256sums=('ce22a19d72c1e3d72d3759b1a85f22b372478ebeb9f7b7d3709de390ccf8e561')
_archive="$_pkgname-$pkgver"
build() {
cd "$_archive"
python -m build --wheel --no-isolation
}
check() {
cd "$_archive"
rm -rf tmp_install
python -m installer --destdir=tmp_install dist/*.whl
local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
export PYTHONPATH="$PWD/tmp_install/$site_packages:$PYTHONPATH"
# Ignore tests requiring valid API keys to OpenAI or Anthropic, below is a
# mock one.
export OPENAI_API_KEY=sk-dBAe8c5a9bc4294cca9bed292cd61e0ff9030bB94647adfb
pytest \
--ignore tests/llm/test_anthropic/evals/test_simple.py \
--ignore tests/llm/test_openai \
--ignore tests/test_new_client.py
}
package() {
cd "$_archive"
python -m installer --destdir="$pkgdir" dist/*.whl
install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
|