openai/openai-python

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
98ece5783a061011ceede7dc2f94fa081666fdcf

Branches

Tags

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

Clone

HTTPS

Download ZIP

pyproject.toml

196lines · modecode

1[project]
2name = "openai"
3version = "1.30.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
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
40
41[project.urls]
42Homepage = "https://github.com/openai/openai-python"
43Repository = "https://github.com/openai/openai-python"
44
45
46
47[tool.rye]
48managed = true
49# version pins are in requirements-dev.lock
50dev-dependencies = [
51 "pyright>=1.1.359",
52 "mypy",
53 "respx",
54 "pytest",
55 "pytest-asyncio",
56 "ruff",
57 "time-machine",
58 "nox",
59 "dirty-equals>=0.6.0",
60 "importlib-metadata>=6.7.0",
61
62]
63
64[tool.rye.scripts]
65format = { chain = [
66 "format:ruff",
67 "format:docs",
68 "fix:ruff",
69]}
70"format:black" = "black ."
71"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md"
72"format:ruff" = "ruff format"
73"format:isort" = "isort ."
74
75"lint" = { chain = [
76 "check:ruff",
77 "typecheck",
78]}
79"check:ruff" = "ruff ."
80"fix:ruff" = "ruff --fix ."
81
82typecheck = { chain = [
83 "typecheck:pyright",
84 "typecheck:mypy"
85]}
86"typecheck:pyright" = "pyright"
87"typecheck:verify-types" = "pyright --verifytypes openai --ignoreexternal"
88"typecheck:mypy" = "mypy ."
89
90[build-system]
91requires = ["hatchling", "hatch-fancy-pypi-readme"]
92build-backend = "hatchling.build"
93
94[tool.hatch.build]
95include = [
96 "src/*"
97]
98
99[tool.hatch.build.targets.wheel]
100packages = ["src/openai"]
101
102[tool.hatch.metadata.hooks.fancy-pypi-readme]
103content-type = "text/markdown"
104
105[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
106path = "README.md"
107
108[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
109# replace relative links with absolute links
110pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
111replacement = '[\1](https://github.com/openai/openai-python/tree/main/\g<2>)'
112
113[tool.black]
114line-length = 120
115target-version = ["py37"]
116
117[tool.pytest.ini_options]
118testpaths = ["tests"]
119addopts = "--tb=short"
120xfail_strict = true
121asyncio_mode = "auto"
122filterwarnings = [
123 "error"
124]
125
126[tool.pyright]
127# this enables practically every flag given by pyright.
128# there are a couple of flags that are still disabled by
129# default in strict mode as they are experimental and niche.
130typeCheckingMode = "strict"
131pythonVersion = "3.7"
132
133exclude = [
134 "_dev",
135 ".venv",
136 ".nox",
137]
138
139reportImplicitOverride = true
140
141reportImportCycles = false
142reportPrivateUsage = false
143
144
145[tool.ruff]
146line-length = 120
147output-format = "grouped"
148target-version = "py37"
149select = [
150 # isort
151 "I",
152 # bugbear rules
153 "B",
154 # remove unused imports
155 "F401",
156 # bare except statements
157 "E722",
158 # unused arguments
159 "ARG",
160 # print statements
161 "T201",
162 "T203",
163 # misuse of typing.TYPE_CHECKING
164 "TCH004",
165 # import rules
166 "TID251",
167]
168ignore = [
169 # mutable defaults
170 "B006",
171]
172unfixable = [
173 # disable auto fix for print statements
174 "T201",
175 "T203",
176]
177ignore-init-module-imports = true
178
179[tool.ruff.format]
180docstring-code-format = true
181
182[tool.ruff.lint.flake8-tidy-imports.banned-api]
183"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"
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"scripts/**.py" = ["T201", "T203"]
195"tests/**.py" = ["T201", "T203"]
196"examples/**.py" = ["T201", "T203"]