openai/openai-python

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.28.1

Branches

Tags

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

Clone

HTTPS

Download ZIP

pyproject.toml

202lines · modecode

1[project]
2name = "openai"
3version = "1.28.1"
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>=1.1.359",
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 "trio >=0.22.2"
68]
69
70[tool.rye.scripts]
71format = { chain = [
72 "format:ruff",
73 "format:docs",
74 "fix:ruff",
75]}
76"format:black" = "black ."
77"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md"
78"format:ruff" = "ruff format"
79"format:isort" = "isort ."
80
81"lint" = { chain = [
82 "check:ruff",
83 "typecheck",
84]}
85"check:ruff" = "ruff ."
86"fix:ruff" = "ruff --fix ."
87
88typecheck = { chain = [
89 "typecheck:pyright",
90 "typecheck:mypy"
91]}
92"typecheck:pyright" = "pyright"
93"typecheck:verify-types" = "pyright --verifytypes openai --ignoreexternal"
94"typecheck:mypy" = "mypy ."
95
96[build-system]
97requires = ["hatchling", "hatch-fancy-pypi-readme"]
98build-backend = "hatchling.build"
99
100[tool.hatch.build]
101include = [
102 "src/*"
103]
104
105[tool.hatch.build.targets.wheel]
106packages = ["src/openai"]
107
108[tool.hatch.metadata.hooks.fancy-pypi-readme]
109content-type = "text/markdown"
110
111[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
112path = "README.md"
113
114[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
115# replace relative links with absolute links
116pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
117replacement = '[\1](https://github.com/openai/openai-python/tree/main/\g<2>)'
118
119[tool.black]
120line-length = 120
121target-version = ["py37"]
122
123[tool.pytest.ini_options]
124testpaths = ["tests"]
125addopts = "--tb=short"
126xfail_strict = true
127asyncio_mode = "auto"
128filterwarnings = [
129 "error"
130]
131
132[tool.pyright]
133# this enables practically every flag given by pyright.
134# there are a couple of flags that are still disabled by
135# default in strict mode as they are experimental and niche.
136typeCheckingMode = "strict"
137pythonVersion = "3.7"
138
139exclude = [
140 "_dev",
141 ".venv",
142 ".nox",
143]
144
145reportImplicitOverride = true
146
147reportImportCycles = false
148reportPrivateUsage = false
149
150
151[tool.ruff]
152line-length = 120
153output-format = "grouped"
154target-version = "py37"
155select = [
156 # isort
157 "I",
158 # bugbear rules
159 "B",
160 # remove unused imports
161 "F401",
162 # bare except statements
163 "E722",
164 # unused arguments
165 "ARG",
166 # print statements
167 "T201",
168 "T203",
169 # misuse of typing.TYPE_CHECKING
170 "TCH004",
171 # import rules
172 "TID251",
173]
174ignore = [
175 # mutable defaults
176 "B006",
177]
178unfixable = [
179 # disable auto fix for print statements
180 "T201",
181 "T203",
182]
183ignore-init-module-imports = true
184
185[tool.ruff.format]
186docstring-code-format = true
187
188[tool.ruff.lint.flake8-tidy-imports.banned-api]
189"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"
190
191[tool.ruff.lint.isort]
192length-sort = true
193length-sort-straight = true
194combine-as-imports = true
195extra-standard-library = ["typing_extensions"]
196known-first-party = ["openai", "tests"]
197
198[tool.ruff.per-file-ignores]
199"bin/**.py" = ["T201", "T203"]
200"scripts/**.py" = ["T201", "T203"]
201"tests/**.py" = ["T201", "T203"]
202"examples/**.py" = ["T201", "T203"]
203