Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
270 lines (242 loc) · 6.93 KB
/
Copy pathpyproject.toml
File metadata and controls
270 lines (242 loc) · 6.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
[project]
name = "openai"
version = "3.41.0"
description = "The official Python library for the openai API"
dynamic = ["readme"]
license = "Apache-2.0"
authors = [
{ name = "OpenAI", email = "support@openai.com" },
]
dependencies = [
"httpx2>=2.12.0, <3",
"pydantic>=1.10.13, <3, !=2.0.*, !=2.1.*, !=2.2.*, !=2.3.*",
"typing-extensions>=4.14, <5",
"anyio>=4.10.0, <5",
"sniffio",
"jiter>=0.16.0, <1",
]
requires-python = ">= 3.10"
classifiers = [
"Typing :: Typed",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Operating System :: OS Independent",
"Operating System :: POSIX",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: Apache Software License"
]
[project.urls]
Homepage = "https://github.com/openai/openai-python"
Repository = "https://github.com/openai/openai-python"
[project.optional-dependencies]
aiohttp = [
"aiohttp>=3.14.3",
]
realtime = ["websockets >= 13, < 16"]
datalib = ["numpy >= 1", "pandas >= 1.2.3"]
voice_helpers = ["sounddevice>=0.5.1", "numpy>=2.0.2"]
bedrock = [
"botocore>=1.40.0,<2",
"urllib3>=2.7.0,<3",
]
vertex = ["google-auth[requests]>=2.36,<3"]
[dependency-groups]
dev = [
"ty==0.0.87",
"pytest>=9.0.3",
"pytest-asyncio>=1.4.0",
"Pillow==12.3.0",
"ruff",
"rich>=13.7.1",
"inline-snapshot>=0.28.0",
"azure-identity >=1.14.1",
"botocore==1.43.106",
"pandas-stubs >= 1.1.0.11",
"trio >=0.22.2",
"pytest-xdist>=3.6.1",
"griffe>=1",
"types-requests>=2.33.0.20261006",
]
pydantic-v1 = ["pydantic>=1.10.26,<2"]
pydantic-v2 = ["pydantic>=2,<3"]
provider-computer = ["Pillow==12.3.0"]
provider-browser = ["playwright==1.63.0"]
browser-demo = ["playwright==1.63.0"]
# Isolated build requirements are exported with hashes by scripts/build.
build = [
"hatchling==1.32.4",
"packaging==26.3",
"pathspec==1.1.1",
"pluggy==1.6.0",
"tomli==2.4.1; python_version < '3.11'",
"trove-classifiers==2026.9.21.13",
]
[tool.uv]
# Keep the minimum compatible with Dependabot's uv updater; CI pins its version.
required-version = ">=0.12.1"
exclude-newer = "8 days"
default-groups = ["dev", "pydantic-v2"]
conflicts = [
[{ group = "pydantic-v1" }, { group = "pydantic-v2" }],
]
# Security floors for transitive dependencies. Constraints do not
# install these packages into the SDK's runtime environment.
constraint-dependencies = [
# HTTPX2 also publishes an exact pin to its matching httpcore2 release.
"httpcore2>=2.12.0",
"azure-core>=1.38.0",
"cryptography>=50.0.0",
"msal>=1.37.0",
"pygments>=2.20.0",
"pyjwt>=2.14.0",
"requests>=2.33.0",
]
# Also constrain editable/source builds performed by uv sync.
build-constraint-dependencies = [
"hatchling==1.32.4",
"packaging==26.3",
"pathspec==1.1.1",
"pluggy==1.6.0",
"tomli==2.4.1; python_version < '3.11'",
"trove-classifiers==2026.9.21.13",
]
[build-system]
requires = ["hatchling==1.32.4"]
build-backend = "hatchling.build"
[tool.hatch.build]
include = [
"src/*"
]
[tool.hatch.build.targets.wheel]
packages = ["src/openai"]
[tool.hatch.build.targets.sdist]
# Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc)
include = [
"/*.toml",
"/*.json",
"/*.lock",
"/*.md",
"/.node-version",
"/pnpm-lock.yaml",
"/pnpm-workspace.yaml",
"bin/*",
"examples/*",
"scripts/*",
"src/*",
"tests/*",
]
[tool.hatch.metadata.hooks.custom]
path = "scripts/hatch_metadata.py"
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=short -n auto --durations=20"
xfail_strict = true
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
filterwarnings = [
"error"
]
[tool.inline-snapshot]
format-command="ruff format --stdin-filename {filename}"
# Repository checks use ty; published annotations remain checker-independent.
[tool.ty.environment]
python-version = "3.10"
[tool.ty.src]
exclude = [
"examples/browser/",
"examples/browser-use-demo/",
"examples/computer-desktop/",
"_dev", "node_modules", ".pnpm-store", ".venv", ".venv-pydantic-v1", ".nox",
"tests/respx2", "src/openai/_vendor", "scripts/hatch_metadata.py",
"examples/realtime/audio_util.py", "examples/realtime/push_to_talk_app.py",
]
[tool.ty.rules]
unused-type-ignore-comment = "error"
unused-ignore-comment = "error"
redundant-cast = "error"
[[tool.ty.overrides]]
include = ["tests/test_lazy_imports.py"]
[tool.ty.overrides.rules]
# Reexports retain callable/class subtypes that assert_type cannot spell exactly.
assert-type-unspellable-subtype = "ignore"
[[tool.ty.overrides]]
include = [
"src/openai/_exceptions.py",
"src/openai/lib/streaming/responses/_events.py",
"src/openai/types/chat/parsed_chat_completion.py",
"src/openai/types/chat/parsed_function_tool_call.py",
"src/openai/types/evals/runs/output_item_list_response.py",
"src/openai/types/evals/runs/output_item_retrieve_response.py",
"tests/test_models.py",
]
[tool.ty.overrides.rules]
# These Pydantic models and HTTP exceptions intentionally narrow mutable fields.
# Preserve their existing contract without suppressing unrelated overrides.
invalid-mutable-override = "ignore"
[[tool.ty.overrides]]
include = [
"tests/**", "src/openai/resources/**",
"src/openai/lib/_assistants_*.py",
]
[tool.ty.overrides.rules]
# Tests exercise deprecated entrypoints; their implementations and reexports must remain available.
deprecated = "ignore"
[tool.ruff]
extend-exclude = ["tests/respx2", "src/openai/_vendor"]
line-length = 120
output-format = "grouped"
target-version = "py310"
[tool.ruff.format]
docstring-code-format = true
[tool.ruff.lint]
select = [
# isort
"I",
# bugbear rules
"B",
# remove unused imports
"F401",
# check for missing future annotations
"FA102",
# bare except statements
"E722",
# unused arguments
"ARG",
# print statements
"T201",
"T203",
# misuse of typing.TYPE_CHECKING
"TC004",
# import rules
"TID251",
]
ignore = [
# mutable defaults
"B006",
]
unfixable = [
# disable auto fix for print statements
"T201",
"T203",
]
extend-safe-fixes = ["FA102"]
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"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"
[tool.ruff.lint.isort]
length-sort = true
length-sort-straight = true
combine-as-imports = true
extra-standard-library = ["typing_extensions"]
known-first-party = ["openai", "tests"]
[tool.ruff.lint.per-file-ignores]
"bin/**.py" = ["T201", "T203"]
"scripts/**.py" = ["T201", "T203"]
"tests/**.py" = ["T201", "T203"]
"examples/**.py" = ["T201", "T203"]