1{
2 lib,
3 anyio,
4 buildPythonPackage,
5 dirty-equals,
6 distro,
7 fetchFromGitHub,
8 google-auth,
9 hatch-fancy-pypi-readme,
10 hatchling,
11 httpx,
12 pydantic,
13 pytest-asyncio,
14 pytestCheckHook,
15 pythonOlder,
16 respx,
17 sniffio,
18 tokenizers,
19 typing-extensions,
20}:
21
22buildPythonPackage rec {
23 pname = "anthropic";
24 version = "0.26.0";
25 pyproject = true;
26
27 disabled = pythonOlder "3.8";
28
29 src = fetchFromGitHub {
30 owner = "anthropics";
31 repo = "anthropic-sdk-python";
32 rev = "refs/tags/v${version}";
33 hash = "sha256-xoYhRRanqZ93UlSoqeeH83JmsoiijDTUDtnY3VDLQAg=";
34 };
35
36 build-system = [
37 hatchling
38 hatch-fancy-pypi-readme
39 ];
40
41 dependencies = [
42 anyio
43 distro
44 httpx
45 sniffio
46 pydantic
47 tokenizers
48 typing-extensions
49 ];
50
51 passthru.optional-dependencies = {
52 vertex = [ google-auth ];
53 };
54
55 nativeCheckInputs = [
56 dirty-equals
57 pytest-asyncio
58 pytestCheckHook
59 respx
60 ];
61
62 pythonImportsCheck = [ "anthropic" ];
63
64 disabledTests = [
65 # Test require network access
66 "test_copy_build_request"
67 ];
68
69 disabledTestPaths = [
70 # Test require network access
71 "tests/api_resources"
72 ];
73
74 pytestFlagsArray = [
75 "-W"
76 "ignore::DeprecationWarning"
77 ];
78
79 meta = with lib; {
80 description = "Anthropic's safety-first language model APIs";
81 homepage = "https://github.com/anthropics/anthropic-sdk-python";
82 changelog = "https://github.com/anthropics/anthropic-sdk-python/releases/tag/v${version}";
83 license = licenses.mit;
84 maintainers = with maintainers; [ natsukium ];
85 };
86}