summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4dfbe548ced849ffdf8f1663be9afcf20cb77877 (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
71
72
73
74
75
76
77
78
79
80
81
82
# Maintainer: Claudia Pellegrino <auerhuhn@archlinux.org>
# Contributor: envolution
# Contributor: Carl Smedstad <carsme@archlinux.org>
# shellcheck shell=bash disable=SC2034,SC2154

pkgname=python-anthropic
_pkgname=anthropic-sdk-python
pkgver=1.15.0
pkgrel=1
pkgdesc="Python library that provides convenient access to the Anthropic REST API"
arch=(any)
url="https://github.com/anthropics/anthropic-sdk-python"
license=(MIT)
depends=(
  python
  python-anyio
  python-docstring-parser
  python-httpx2
  python-jiter
  python-opentelemetry-api
  python-pydantic
  python-pydantic-core
  python-sniffio
  python-standardwebhooks
  python-typing_extensions
)
makedepends=(
  python-build
  python-hatch-fancy-pypi-readme
  python-hatchling
  python-installer
  python-wheel
)
checkdepends=(
  python-boto3
  python-botocore
  python-dirty-equals
  python-opentelemetry-sdk
  python-pytest
  python-pytest-asyncio
  python-pytest-http-snapshot
  python-pytest-xdist
  python-respx
)
optdepends=(
  'python-boto3: for Anthropic Bedrock API support'
  'python-botocore: for Anthropic Bedrock API support'
  'python-google-auth: for Anthropic Vertex API support'
)
source=(
  "$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz"
)
sha256sums=('a8f673531c286bdb1fa90c2c816bec3703b072f27ad118c23744d515d4e25dad')

prepare() {
  cd $_pkgname-$pkgver
  sed -i 's/hatchling==/hatchling>=/' pyproject.toml
}

build() {
  cd $_pkgname-$pkgver

  python -m build --wheel --no-isolation
}

check() {
  cd $_pkgname-$pkgver

  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl

  # Deselect tests/api_resources as it requires access to the API.
  test-env/bin/python -m pytest -p no:benchmark \
    --deselect tests/api_resources/
}

package() {
  cd $_pkgname-$pkgver

  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}