| 1 |
[project] |
| 2 |
name = "anthropic" |
| 3 |
version = "1.9.0" |
| 4 |
description = "The official Python library for the anthropic API" |
| 5 |
dynamic = ["readme"] |
| 6 |
license = "MIT" |
| 7 |
authors = [ |
| 8 |
{ name = "Anthropic", email = "[email protected]" }, |
| 9 |
] |
| 10 |
|
| 11 |
dependencies = [ |
| 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 |
] |
| 20 |
|
| 21 |
requires-python = ">= 3.10" |
| 22 |
classifiers = [ |
| 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 |
] |
| 38 |
|
| 39 |
[project.optional-dependencies] |
| 40 |
aiohttp = ["aiohttp>=3.10.0, <4"] |
| 41 |
vertex = ["google-auth[requests] >=2, <3"] |
| 42 |
google_cloud = ["google-auth[requests] >=2, <3"] |
| 43 |
aws = ["boto3 >=1.28.57, <2", "botocore >=1.31.57, <2"] |
| 44 |
bedrock = ["boto3 >=1.28.57, <2", "botocore >=1.31.57, <2"] |
| 45 |
mcp = ["mcp>=1.0, <3; python_version >= '3.10'"] |
| 46 |
webhooks = ["standardwebhooks >= 1.0.1, < 2"] |
| 47 |
|
| 48 |
[project.urls] |
| 49 |
Homepage = "https://github.com/anthropics/anthropic-sdk-python" |
| 50 |
Repository = "https://github.com/anthropics/anthropic-sdk-python" |
| 51 |
|
| 52 |
|
| 53 |
[tool.uv] |
| 54 |
managed = true |
| 55 |
required-version = ">=0.9" |
| 56 |
add-bounds = "major" |
| 57 |
# Ensure the lockfile always uses public PyPI, regardless of contributor's global uv config |
| 58 |
index = [{ url = "https://pypi.org/simple", default = true }] |
| 59 |
conflicts = [ |
| 60 |
[ |
| 61 |
{ group = "pydantic-v1" }, |
| 62 |
{ group = "pydantic-v2" }, |
| 63 |
], |
| 64 |
[ |
| 65 |
{ group = "pydantic-v1" }, |
| 66 |
{ extra = "mcp" }, |
| 67 |
], |
| 68 |
] |
| 69 |
|
| 70 |
[dependency-groups] |
| 71 |
# version pins are in uv.lock |
| 72 |
dev = [ |
| 73 |
"pyright==1.1.399", |
| 74 |
"respx", |
| 75 |
"pytest", |
| 76 |
"pytest-asyncio", |
| 77 |
"ruff", |
| 78 |
"time-machine", |
| 79 |
"dirty-equals>=0.6.0", |
| 80 |
"importlib-metadata>=6.7.0", |
| 81 |
"boto3-stubs >= 1", |
| 82 |
"rich>=13.7.1", |
| 83 |
"pytest-xdist>=3.6.1", |
| 84 |
"hypothesis", |
| 85 |
"inline-snapshot>=0.28.0", |
| 86 |
"griffe>=1", |
| 87 |
"http-snapshot[httpx]==0.1.9", |
| 88 |
"packaging", |
| 89 |
"tomli; python_version < '3.11'", |
| 90 |
"httpx2>=2.9", |
| 91 |
] |
| 92 |
pydantic-v1 = [ |
| 93 |
"pydantic>=1.10.0,<2", |
| 94 |
] |
| 95 |
pydantic-v2 = [ |
| 96 |
"pydantic~=2.0 ; python_full_version < '3.14'", |
| 97 |
"pydantic~=2.12 ; python_full_version >= '3.14'", |
| 98 |
] |
| 99 |
|
| 100 |
[build-system] |
| 101 |
requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme>=22.4, <26"] |
| 102 |
build-backend = "hatchling.build" |
| 103 |
|
| 104 |
[tool.hatch.build] |
| 105 |
include = [ |
| 106 |
"src/*" |
| 107 |
] |
| 108 |
|
| 109 |
[tool.hatch.build.targets.wheel] |
| 110 |
packages = ["src/anthropic"] |
| 111 |
|
| 112 |
[tool.hatch.build.targets.sdist] |
| 113 |
# Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc) |
| 114 |
include = [ |
| 115 |
"/*.toml", |
| 116 |
"/*.json", |
| 117 |
"/*.lock", |
| 118 |
"/*.md", |
| 119 |
"bin/*", |
| 120 |
"examples/*", |
| 121 |
"src/*", |
| 122 |
"tests/*", |
| 123 |
] |
| 124 |
|
| 125 |
[tool.hatch.metadata.hooks.fancy-pypi-readme] |
| 126 |
content-type = "text/markdown" |
| 127 |
|
| 128 |
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]] |
| 129 |
path = "README.md" |
| 130 |
|
| 131 |
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] |
| 132 |
# replace relative links with absolute links |
| 133 |
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)' |
| 134 |
replacement = '[\1](https://github.com/anthropics/anthropic-sdk-python/tree/main/\g<2>)' |
| 135 |
|
| 136 |
[tool.pytest.ini_options] |
| 137 |
testpaths = ["tests"] |
| 138 |
addopts = "--tb=short -n auto -p tests._alias_httpx" |
| 139 |
pythonpath = ["."] |
| 140 |
xfail_strict = true |
| 141 |
asyncio_mode = "auto" |
| 142 |
asyncio_default_fixture_loop_scope = "session" |
| 143 |
filterwarnings = [ |
| 144 |
"error" |
| 145 |
] |
| 146 |
|
| 147 |
[tool.inline-snapshot] |
| 148 |
format-command="ruff format --stdin-filename {filename}" |
| 149 |
|
| 150 |
[tool.pyright] |
| 151 |
# this enables practically every flag given by pyright. |
| 152 |
# there are a couple of flags that are still disabled by |
| 153 |
# default in strict mode as they are experimental and niche. |
| 154 |
typeCheckingMode = "strict" |
| 155 |
pythonVersion = "3.10" |
| 156 |
|
| 157 |
exclude = [ |
| 158 |
".git", |
| 159 |
"_dev", |
| 160 |
".venv", |
| 161 |
"src/anthropic/_vendor", |
| 162 |
] |
| 163 |
|
| 164 |
reportImplicitOverride = true |
| 165 |
reportOverlappingOverload = false |
| 166 |
|
| 167 |
reportImportCycles = false |
| 168 |
reportPrivateUsage = false |
| 169 |
|
| 170 |
[tool.ruff] |
| 171 |
line-length = 120 |
| 172 |
output-format = "grouped" |
| 173 |
target-version = "py310" |
| 174 |
extend-exclude = ["src/anthropic/_vendor"] |
| 175 |
|
| 176 |
[tool.ruff.format] |
| 177 |
docstring-code-format = true |
| 178 |
|
| 179 |
[tool.ruff.lint] |
| 180 |
select = [ |
| 181 |
# isort |
| 182 |
"I", |
| 183 |
# bugbear rules |
| 184 |
"B", |
| 185 |
# remove unused imports |
| 186 |
"F401", |
| 187 |
# bare except statements |
| 188 |
"E722", |
| 189 |
# unused arguments |
| 190 |
"ARG", |
| 191 |
# print statements |
| 192 |
"T201", |
| 193 |
"T203", |
| 194 |
# misuse of typing.TYPE_CHECKING |
| 195 |
"TC004", |
| 196 |
# import rules |
| 197 |
"TID251", |
| 198 |
] |
| 199 |
ignore = [ |
| 200 |
# mutable defaults |
| 201 |
"B006", |
| 202 |
] |
| 203 |
unfixable = [ |
| 204 |
# disable auto fix for print statements |
| 205 |
"T201", |
| 206 |
"T203", |
| 207 |
] |
| 208 |
|
| 209 |
[tool.ruff.lint.flake8-tidy-imports.banned-api] |
| 210 |
"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" |
| 211 |
|
| 212 |
[tool.ruff.lint.isort] |
| 213 |
length-sort = true |
| 214 |
length-sort-straight = true |
| 215 |
combine-as-imports = true |
| 216 |
extra-standard-library = ["typing_extensions"] |
| 217 |
known-first-party = ["anthropic", "tests"] |
| 218 |
|
| 219 |
[tool.ruff.lint.per-file-ignores] |
| 220 |
"bin/**.py" = ["T201", "T203"] |
| 221 |
"scripts/**.py" = ["T201", "T203"] |
| 222 |
"tests/**.py" = ["T201", "T203"] |
| 223 |
"examples/**.py" = ["T201", "T203"] |