Unverified Commit b3e9116b authored by Leona Maroni's avatar Leona Maroni Committed by GitHub
Browse files

python3Packages.anthropic: 0.49.0 -> 0.51.0 (#407079)

parents 45124b5c 950bf3ae
Loading
Loading
Loading
Loading
+35 −28
Original line number Diff line number Diff line
{
  lib,
  anyio,
  buildPythonPackage,
  dirty-equals,
  distro,
  fetchFromGitHub,
  google-auth,

  # build-system
  hatch-fancy-pypi-readme,
  hatchling,

  # dependencies
  anyio,
  distro,
  httpx,
  jiter,
  nest-asyncio,
  pydantic,
  pytest-asyncio,
  pytestCheckHook,
  pythonAtLeast,
  pythonOlder,
  respx,
  sniffio,
  tokenizers,
  typing-extensions,

  # optional dependencies
  google-auth,

  # test
  dirty-equals,
  nest-asyncio,
  pytest-asyncio,
  pytestCheckHook,
  respx,
}:

buildPythonPackage rec {
  pname = "anthropic";
  version = "0.49.0";
  version = "0.51.0";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "anthropics";
    repo = "anthropic-sdk-python";
    tag = "v${version}";
    hash = "sha256-vbK8rqCekWbgLAU7YlHUhfV+wB7Q3Rpx0OUYvq3WYWw=";
    hash = "sha256-gD3qZpPKtKZtuoGqnKVgFp0gCxpL0Aq5NGFCMk+z3cQ=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail '"hatchling==1.26.3"' '"hatchling>=1.26.3"'
  '';

  build-system = [
    hatchling
    hatch-fancy-pypi-readme
@@ -46,8 +55,8 @@ buildPythonPackage rec {
    distro
    httpx
    jiter
    sniffio
    pydantic
    sniffio
    tokenizers
    typing-extensions
  ];
@@ -58,22 +67,17 @@ buildPythonPackage rec {

  nativeCheckInputs = [
    dirty-equals
    pytest-asyncio
    nest-asyncio
    pytest-asyncio
    pytestCheckHook
    respx
  ];

  pythonImportsCheck = [ "anthropic" ];

  disabledTests =
    [
  disabledTests = [
    # Test require network access
    "test_copy_build_request"
    ]
    ++ lib.optionals (pythonAtLeast "3.13") [
      # Fails on RuntimeWarning: coroutine method 'aclose' of 'AsyncStream._iter_events' was never awaited
      "test_multi_byte_character_multiple_chunks[async]"
  ];

  disabledTestPaths = [
@@ -87,11 +91,14 @@ buildPythonPackage rec {
    "ignore::DeprecationWarning"
  ];

  meta = with lib; {
  meta = {
    description = "Anthropic's safety-first language model APIs";
    homepage = "https://github.com/anthropics/anthropic-sdk-python";
    changelog = "https://github.com/anthropics/anthropic-sdk-python/releases/tag/${src.tag}";
    license = licenses.mit;
    maintainers = with maintainers; [ natsukium ];
    license = lib.licenses.mit;
    maintainers = [
      lib.maintainers.natsukium
      lib.maintainers.sarahec
    ];
  };
}