openai/openai-python

Public

mirrored from https://github.com/openai/openai-pythonAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.17.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

pyproject.toml

195lines · modecode

1[project]
2name = "openai"
3version = "1.17.0"
4description = "The official Python library for the openai API"
5dynamic = ["readme"]
6license = "Apache-2.0"
7authors = [
8{ name = "OpenAI", email = "support@openai.com" },
9]
10dependencies = [
11 "httpx>=0.23.0, <1",
12 "pydantic>=1.9.0, <3",
13 "typing-extensions>=4.7, <5",
14 "anyio>=3.5.0, <5",
15 "distro>=1.7.0, <2",
16 "sniffio",
17 "cached-property; python_version < '3.8'",
18 "tqdm > 4"
19]
20requires-python = ">= 3.7.1"
21classifiers = [
22 "Typing :: Typed",
23 "Intended Audience :: Developers",
24 "Programming Language :: Python :: 3.7",
25 "Programming Language :: Python :: 3.8",
26 "Programming Language :: Python :: 3.9",
27 "Programming Language :: Python :: 3.10",
28 "Programming Language :: Python :: 3.11",
29 "Programming Language :: Python :: 3.12",
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 :: Apache Software License"
37]
38
39[project.optional-dependencies]
40datalib = ["numpy >= 1", "pandas >= 1.2.3", "pandas-stubs >= 1.1.0.11"]
41
42[project.urls]
43Homepage = "https://github.com/openai/openai-python"
44Repository = "https://github.com/openai/openai-python"
45
46[project.scripts]
47openai = "openai.cli:main"
48
49[tool.rye]
50managed = true
51# version pins are in requirements-dev.lock
52dev-dependencies = [
53 "pyright",
54 "mypy",
55 "respx",
56 "pytest",
57 "pytest-asyncio",
58 "ruff",
59 "time-machine",
60 "nox",
61 "dirty-equals>=0.6.0",
62 "importlib-metadata>=6.7.0",
63 "inline-snapshot >=0.7.0",
64 "azure-identity >=1.14.1",
65 "types-tqdm > 4",
66 "types-pyaudio > 0"
67]
68
69[tool.rye.scripts]
70format = { chain = [
71 "format:ruff",
72 "format:docs",
73 "fix:ruff",
74]}
75"format:black" = "black ."
76"format:docs" = "python bin/ruffen-docs.py README.md api.md"
77"format:ruff" = "ruff format"
78"format:isort" = "isort ."
79
80"lint" = { chain = [
81 "check:ruff",
82 "typecheck",
83]}
84"check:ruff" = "ruff ."
85"fix:ruff" = "ruff --fix ."
86
87typecheck = { chain = [
88 "typecheck:pyright",
89 "typecheck:mypy"
90]}
91"typecheck:pyright" = "pyright"
92"typecheck:verify-types" = "pyright --verifytypes openai --ignoreexternal"
93"typecheck:mypy" = "mypy ."
94
95[build-system]
96requires = ["hatchling", "hatch-fancy-pypi-readme"]
97build-backend = "hatchling.build"
98
99[tool.hatch.build]
100include = [
101 "src/*"
102]
103
104[tool.hatch.build.targets.wheel]
105packages = ["src/openai"]
106
107[tool.hatch.metadata.hooks.fancy-pypi-readme]
108content-type = "text/markdown"
109
110[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
111path = "README.md"
112
113[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
114# replace relative links with absolute links
115pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
116replacement = '[\1](https://github.com/openai/openai-python/tree/main/\g<2>)'
117
118[tool.black]
119line-length = 120
120target-version = ["py37"]
121
122[tool.pytest.ini_options]
123testpaths = ["tests"]
124addopts = "--tb=short"
125xfail_strict = true
126asyncio_mode = "auto"
127filterwarnings = [
128 "error"
129]
130
131[tool.pyright]
132# this enables practically every flag given by pyright.
133# there are a couple of flags that are still disabled by
134# default in strict mode as they are experimental and niche.
135typeCheckingMode = "strict"
136pythonVersion = "3.7"
137
138exclude = [
139 "_dev",
140 ".venv",
141 ".nox",
142]
143
144reportImplicitOverride = true
145
146reportImportCycles = false
147reportPrivateUsage = false
148
149
150[tool.ruff]
151line-length = 120
152output-format = "grouped"
153target-version = "py37"
154select = [
155 # isort
156 "I",
157 # bugbear rules
158 "B",
159 # remove unused imports
160 "F401",
161 # bare except statements
162 "E722",
163 # unused arguments
164 "ARG",
165 # print statements
166 "T201",
167 "T203",
168 # misuse of typing.TYPE_CHECKING
169 "TCH004"
170]
171ignore = [
172 # mutable defaults
173 "B006",
174]
175unfixable = [
176 # disable auto fix for print statements
177 "T201",
178 "T203",
179]
180ignore-init-module-imports = true
181
182[tool.ruff.format]
183docstring-code-format = true
184
185[tool.ruff.lint.isort]
186length-sort = true
187length-sort-straight = true
188combine-as-imports = true
189extra-standard-library = ["typing_extensions"]
190known-first-party = ["openai", "tests"]
191
192[tool.ruff.per-file-ignores]
193"bin/**.py" = ["T201", "T203"]
194"tests/**.py" = ["T201", "T203"]
195"examples/**.py" = ["T201", "T203"]
196