Repository Public
1[project]2name = "anthropic"3version = "1.7.0"4description = "The official Python library for the anthropic API"5dynamic = ["readme"]6license = "MIT"7authors = [8{ name = "Anthropic", email = "support@anthropic.com" },9]1011dependencies = [12 "httpx2>=2.0.0, <3",13 "pydantic>=1.10.0, <3",14 "typing-extensions>=4.14, <5",15 "anyio>=4.1.0, <5",16 "sniffio>=1, <2",17 "jiter>=0.4.0, <1",18 "docstring-parser>=0.15,<1",19]2021requires-python = ">= 3.10"22classifiers = [23 "Typing :: Typed",24 "Intended Audience :: Developers",25 "Programming Language :: Python :: 3.10",26 "Programming Language :: Python :: 3.11",27 "Programming Language :: Python :: 3.12",28 "Programming Language :: Python :: 3.13",29 "Programming Language :: Python :: 3.14",30 "Operating System :: OS Independent",31 "Operating System :: POSIX",32 "Operating System :: MacOS",33 "Operating System :: POSIX :: Linux",34 "Operating System :: Microsoft :: Windows",35 "Topic :: Software Development :: Libraries :: Python Modules",36 "License :: OSI Approved :: MIT License"37]3839[project.optional-dependencies]40aiohttp = ["aiohttp>=3.10.0, <4"]41vertex = ["google-auth[requests] >=2, <3"]42google_cloud = ["google-auth[requests] >=2, <3"]43aws = ["boto3 >=1.28.57, <2", "botocore >=1.31.57, <2"]44bedrock = ["boto3 >=1.28.57, <2", "botocore >=1.31.57, <2"]45mcp = ["mcp>=1.0, <3; python_version >= '3.10'"]46webhooks = ["standardwebhooks >= 1.0.1, < 2"]4748[project.urls]49Homepage = "https://github.com/anthropics/anthropic-sdk-python"50Repository = "https://github.com/anthropics/anthropic-sdk-python"515253[tool.uv]54managed = true55required-version = ">=0.9"56add-bounds = "major"57# Ensure the lockfile always uses public PyPI, regardless of contributor's global uv config58index = [{ url = "https://pypi.org/simple", default = true }]59conflicts = [60 [61 { group = "pydantic-v1" },62 { group = "pydantic-v2" },63 ],64 [65 { group = "pydantic-v1" },66 { extra = "mcp" },67 ],68]6970[dependency-groups]71# version pins are in uv.lock72dev = [73 "pyright==1.1.399",74 "mypy==1.17",75 "respx",76 "pytest",77 "pytest-asyncio",78 "ruff",79 "time-machine",80 "dirty-equals>=0.6.0",81 "importlib-metadata>=6.7.0",82 "boto3-stubs >= 1",83 "rich>=13.7.1",84 "pytest-xdist>=3.6.1",85 "hypothesis",86 "inline-snapshot>=0.28.0",87 "griffe>=1",88 "http-snapshot[httpx]==0.1.9",89 "packaging",90 "tomli; python_version < '3.11'",91 "httpx2>=2.9",92]93pydantic-v1 = [94 "pydantic>=1.10.0,<2",95]96pydantic-v2 = [97 "pydantic~=2.0 ; python_full_version < '3.14'",98 "pydantic~=2.12 ; python_full_version >= '3.14'",99]100101[build-system]102requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme>=22.4, <26"]103build-backend = "hatchling.build"104105[tool.hatch.build]106include = [107 "src/*"108]109110[tool.hatch.build.targets.wheel]111packages = ["src/anthropic"]112113[tool.hatch.build.targets.sdist]114# Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc)115include = [116 "/*.toml",117 "/*.json",118 "/*.lock",119 "/*.md",120 "/mypy.ini",121 "bin/*",122 "examples/*",123 "src/*",124 "tests/*",125]126127[tool.hatch.metadata.hooks.fancy-pypi-readme]128content-type = "text/markdown"129130[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]131path = "README.md"132133[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]134# replace relative links with absolute links135pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'136replacement = '[\1](https://github.com/anthropics/anthropic-sdk-python/tree/main/\g<2>)'137138[tool.pytest.ini_options]139testpaths = ["tests"]140addopts = "--tb=short -n auto -p tests._alias_httpx"141pythonpath = ["."]142xfail_strict = true143asyncio_mode = "auto"144asyncio_default_fixture_loop_scope = "session"145filterwarnings = [146 "error"147]148149[tool.inline-snapshot]150format-command="ruff format --stdin-filename {filename}"151152[tool.pyright]153# this enables practically every flag given by pyright.154# there are a couple of flags that are still disabled by155# default in strict mode as they are experimental and niche.156typeCheckingMode = "strict"157pythonVersion = "3.10"158159exclude = [160 ".git",161 "_dev",162 ".venv",163 "src/anthropic/_vendor",164]165166reportImplicitOverride = true167reportOverlappingOverload = false168169reportImportCycles = false170reportPrivateUsage = false171172[tool.mypy]173pretty = true174show_error_codes = true175176# Exclude _files.py because mypy isn't smart enough to apply177# the correct type narrowing and as this is an internal module178# it's fine to just use Pyright.179#180# We also exclude our `tests` as mypy doesn't always infer181# types correctly and Pyright will still catch any type errors.182exclude = ["src/anthropic/_files.py", "_dev/.*.py", "tests/.*", "examples/mcp_server_weather.py", "examples/mcp_tool_runner.py", "examples/tools_with_mcp.py", "examples/memory/basic.py", "src/anthropic/lib/_parse/_transform.py", "src/anthropic/lib/tools/_beta_functions.py"]183184strict_equality = true185implicit_reexport = true186check_untyped_defs = true187no_implicit_optional = true188189warn_return_any = true190warn_unreachable = true191warn_unused_configs = true192193# Turn these options off as it could cause conflicts194# with the Pyright options.195warn_unused_ignores = false196warn_redundant_casts = false197198disallow_any_generics = true199disallow_untyped_defs = true200disallow_untyped_calls = true201disallow_subclassing_any = true202disallow_incomplete_defs = true203disallow_untyped_decorators = true204cache_fine_grained = true205206# By default, mypy reports an error if you assign a value to the result207# of a function call that doesn't return anything. We do this in our test208# cases:209# ```210# result = ...211# assert result is None212# ```213# Changing this codegen to make mypy happy would increase complexity214# and would not be worth it.215disable_error_code = "func-returns-value,overload-cannot-match"216217[[tool.mypy.overrides]]218module = "anthropic.lib.vertex._auth"219disallow_untyped_calls = false220221[[tool.mypy.overrides]]222module = "tests.lib.tools.test_mcp_tool"223follow_imports = "skip"224225[tool.ruff]226line-length = 120227output-format = "grouped"228target-version = "py310"229extend-exclude = ["src/anthropic/_vendor"]230231[tool.ruff.format]232docstring-code-format = true233234[tool.ruff.lint]235select = [236 # isort237 "I",238 # bugbear rules239 "B",240 # remove unused imports241 "F401",242 # bare except statements243 "E722",244 # unused arguments245 "ARG",246 # print statements247 "T201",248 "T203",249 # misuse of typing.TYPE_CHECKING250 "TC004",251 # import rules252 "TID251",253]254ignore = [255 # mutable defaults256 "B006",257]258unfixable = [259 # disable auto fix for print statements260 "T201",261 "T203",262]263264[tool.ruff.lint.flake8-tidy-imports.banned-api]265"functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead"266267[tool.ruff.lint.isort]268length-sort = true269length-sort-straight = true270combine-as-imports = true271extra-standard-library = ["typing_extensions"]272known-first-party = ["anthropic", "tests"]273274[tool.ruff.lint.per-file-ignores]275"bin/**.py" = ["T201", "T203"]276"scripts/**.py" = ["T201", "T203"]277"tests/**.py" = ["T201", "T203"]278"examples/**.py" = ["T201", "T203"]279