Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # build-system 7 hatch-fancy-pypi-readme, 8 hatchling, 9 10 # dependencies 11 anyio, 12 distro, 13 httpx, 14 jiter, 15 pydantic, 16 sniffio, 17 tokenizers, 18 typing-extensions, 19 20 # optional dependencies 21 google-auth, 22 23 # test 24 dirty-equals, 25 nest-asyncio, 26 pytest-asyncio, 27 pytest-xdist, 28 pytestCheckHook, 29 respx, 30}: 31 32buildPythonPackage rec { 33 pname = "anthropic"; 34 version = "0.59.0"; 35 pyproject = true; 36 37 src = fetchFromGitHub { 38 owner = "anthropics"; 39 repo = "anthropic-sdk-python"; 40 tag = "v${version}"; 41 hash = "sha256-JUgJB0+9zfmj3asjn7FOozNB9STkKEvObbTP3KLDV+M="; 42 }; 43 44 postPatch = '' 45 substituteInPlace pyproject.toml \ 46 --replace-fail '"hatchling==1.26.3"' '"hatchling>=1.26.3"' 47 ''; 48 49 build-system = [ 50 hatchling 51 hatch-fancy-pypi-readme 52 ]; 53 54 dependencies = [ 55 anyio 56 distro 57 httpx 58 jiter 59 pydantic 60 sniffio 61 tokenizers 62 typing-extensions 63 ]; 64 65 optional-dependencies = { 66 vertex = [ google-auth ]; 67 }; 68 69 nativeCheckInputs = [ 70 dirty-equals 71 nest-asyncio 72 pytest-asyncio 73 pytest-xdist 74 pytestCheckHook 75 respx 76 ]; 77 78 pythonImportsCheck = [ "anthropic" ]; 79 80 disabledTests = [ 81 # Test require network access 82 "test_copy_build_request" 83 ]; 84 85 disabledTestPaths = [ 86 # Test require network access 87 "tests/api_resources" 88 "tests/lib/test_bedrock.py" 89 ]; 90 91 pytestFlags = [ 92 "-Wignore::DeprecationWarning" 93 ]; 94 95 meta = { 96 description = "Anthropic's safety-first language model APIs"; 97 homepage = "https://github.com/anthropics/anthropic-sdk-python"; 98 changelog = "https://github.com/anthropics/anthropic-sdk-python/releases/tag/${src.tag}"; 99 license = lib.licenses.mit; 100 maintainers = [ 101 lib.maintainers.natsukium 102 lib.maintainers.sarahec 103 ]; 104 }; 105}