Skip to content

Commit aef2c55

Browse files
stainless-botRobertCraigie
authored andcommitted
chore(internal): migrate from Poetry to Rye
1 parent 11b3d7f commit aef2c55

File tree

8 files changed

+158
-1252
lines changed

8 files changed

+158
-1252
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ __pycache__
66

77
dist
88

9+
.venv
10+
911
.env
1012
codegen.log

bin/test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22

3-
bin/check-test-server && poetry run pytest "$@"
3+
bin/check-test-server && rye run pytest "$@"

noxfile.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import nox
2-
import nox_poetry
32

43

5-
@nox_poetry.session(reuse_venv=True, name="test-pydantic-v1")
4+
@nox.session(reuse_venv=True, name="test-pydantic-v1")
65
def test_pydantic_v1(session: nox.Session) -> None:
7-
session.run_always("poetry", "install", external=True)
8-
9-
# https://github.com/cjolowicz/nox-poetry/issues/1116
10-
session._session.run("python", "-m", "pip", "install", "pydantic<2", external=True) # type: ignore
6+
session.install("-r", "requirements-dev.lock")
7+
session.install("pydantic<2")
118

129
session.run("pytest", "--showlocals", "--ignore=tests/functional", *session.posargs)

poetry.lock

Lines changed: 0 additions & 1206 deletions
This file was deleted.

pyproject.toml

Lines changed: 58 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,71 @@
1-
[tool.poetry]
1+
[project]
22
name = "openai"
33
version = "1.0.0-beta.3"
44
description = "Client library for the openai API"
55
readme = "README.md"
6-
authors = ["OpenAI <[email protected]>"]
76
license = "Apache-2.0"
8-
repository = "https://github.com/openai/openai-python"
9-
packages = [
10-
{ include = "openai", from = "src" }
7+
authors = [
8+
{ name = "OpenAI", email = "[email protected]" },
119
]
10+
dependencies = [
11+
"httpx>=0.23.0, <1",
12+
"pydantic>=1.9.0, <3",
13+
"typing-extensions>=4.5, <5",
14+
"anyio>=3.5.0, <4",
15+
"distro>=1.7.0, <2",
16+
"tqdm > 4"
17+
]
18+
requires-python = ">= 3.7.1"
19+
20+
[project.optional-dependencies]
21+
datalib = ["numpy >= 1", "pandas >= 1.2.3", "pandas-stubs >= 1.1.0.11"]
22+
23+
[project.urls]
24+
Homepage = "https://github.com/openai/openai-python"
25+
Repository = "https://github.com/openai/openai-python"
1226

13-
[tool.poetry.dependencies]
14-
python = "^3.7.1"
15-
httpx = ">= 0.23.0, < 1"
16-
pydantic = ">= 1.9.0, < 3"
17-
typing-extensions = ">= 4.5, < 5"
18-
anyio = ">= 3.5.0, < 4"
19-
distro = ">= 1.7.0, < 2"
20-
tqdm = "> 4"
21-
22-
numpy = { version = ">= 1", optional = true }
23-
pandas = { version = ">= 1.2.3", optional = true }
24-
pandas-stubs = { version = ">= 1.1.0.11", optional = true }
25-
26-
[tool.poetry.extras]
27-
datalib = ["numpy", "pandas", "pandas-stubs"]
28-
29-
[tool.poetry.group.dev.dependencies]
30-
pyright = "1.1.326"
31-
mypy = "1.4.1"
32-
black = "23.3.0"
33-
respx = "0.19.2"
34-
pytest = "7.1.1"
35-
pytest-asyncio = "0.21.1"
36-
ruff = "0.0.282"
37-
isort = "5.10.1"
38-
time-machine = "^2.9.0"
39-
nox = "^2023.4.22"
40-
nox-poetry = "^1.0.3"
41-
types-tqdm = "> 4"
42-
[tool.poetry.scripts]
27+
[project.scripts]
4328
openai = "openai.cli:main"
4429

30+
[tool.rye]
31+
managed = true
32+
dev-dependencies = [
33+
"pyright==1.1.326",
34+
"mypy==1.4.1",
35+
"black==23.3.0",
36+
"respx==0.19.2",
37+
"pytest==7.1.1",
38+
"pytest-asyncio==0.21.1",
39+
"ruff==0.0.282",
40+
"isort==5.10.1",
41+
"time-machine==2.9.0",
42+
"nox==2023.4.22",
43+
"types-tqdm > 4"
44+
]
45+
46+
[tool.rye.scripts]
47+
format = { chain = [
48+
"format:black",
49+
"format:docs",
50+
"format:ruff",
51+
"format:isort",
52+
]}
53+
"format:black" = "black ."
54+
"format:docs" = "python bin/blacken-docs.py README.md api.md"
55+
"format:ruff" = "ruff --fix ."
56+
"format:isort" = "isort ."
57+
4558
[build-system]
46-
requires = ["poetry-core>=1.0.0"]
47-
build-backend = "poetry.core.masonry.api"
59+
requires = ["hatchling"]
60+
build-backend = "hatchling.build"
61+
62+
[tool.hatch.build]
63+
include = [
64+
"src/*"
65+
]
66+
67+
[tool.hatch.build.targets.wheel]
68+
packages = ["src/openai"]
4869

4970
[tool.black]
5071
line-length = 120

requirements-dev.lock

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# generated by rye
2+
# use `rye lock` or `rye sync` to update this lockfile
3+
#
4+
# last locked with the following flags:
5+
# pre: false
6+
# features: []
7+
# all-features: true
8+
9+
-e file:.
10+
annotated-types==0.6.0
11+
anyio==3.7.1
12+
argcomplete==3.1.2
13+
attrs==23.1.0
14+
black==23.3.0
15+
certifi==2023.7.22
16+
click==8.1.7
17+
colorlog==6.7.0
18+
distlib==0.3.7
19+
distro==1.8.0
20+
exceptiongroup==1.1.3
21+
filelock==3.12.4
22+
h11==0.12.0
23+
httpcore==0.15.0
24+
httpx==0.23.0
25+
idna==3.4
26+
iniconfig==2.0.0
27+
isort==5.10.1
28+
mypy==1.4.1
29+
mypy-extensions==1.0.0
30+
nodeenv==1.8.0
31+
nox==2023.4.22
32+
numpy==1.26.1
33+
packaging==23.2
34+
pandas==2.1.1
35+
pandas-stubs==2.1.1.230928
36+
pathspec==0.11.2
37+
platformdirs==3.11.0
38+
pluggy==1.3.0
39+
py==1.11.0
40+
pydantic==2.4.2
41+
pydantic-core==2.10.1
42+
pyright==1.1.326
43+
pytest==7.1.1
44+
pytest-asyncio==0.21.1
45+
python-dateutil==2.8.2
46+
pytz==2023.3.post1
47+
respx==0.19.2
48+
rfc3986==1.5.0
49+
ruff==0.0.282
50+
six==1.16.0
51+
sniffio==1.3.0
52+
time-machine==2.9.0
53+
tomli==2.0.1
54+
tqdm==4.66.1
55+
types-pytz==2023.3.1.1
56+
types-tqdm==4.66.0.2
57+
typing-extensions==4.8.0
58+
tzdata==2023.3
59+
virtualenv==20.24.5
60+
# The following packages are considered to be unsafe in a requirements file:
61+
setuptools==68.2.2

requirements.lock

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# generated by rye
2+
# use `rye lock` or `rye sync` to update this lockfile
3+
#
4+
# last locked with the following flags:
5+
# pre: false
6+
# features: []
7+
# all-features: true
8+
9+
-e file:.
10+
annotated-types==0.6.0
11+
anyio==3.7.1
12+
certifi==2023.7.22
13+
distro==1.8.0
14+
exceptiongroup==1.1.3
15+
h11==0.12.0
16+
httpcore==0.15.0
17+
httpx==0.23.0
18+
idna==3.4
19+
numpy==1.26.1
20+
pandas==2.1.1
21+
pandas-stubs==2.1.1.230928
22+
pydantic==2.4.2
23+
pydantic-core==2.10.1
24+
python-dateutil==2.8.2
25+
pytz==2023.3.post1
26+
rfc3986==1.5.0
27+
six==1.16.0
28+
sniffio==1.3.0
29+
tqdm==4.66.1
30+
types-pytz==2023.3.1.1
31+
typing-extensions==4.8.0
32+
tzdata==2023.3

src/openai/_models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import pydantic
99
import pydantic.generics
10-
from pydantic import Extra
1110
from pydantic.fields import FieldInfo
1211

1312
from ._types import (
@@ -56,7 +55,7 @@ def model_fields_set(self) -> set[str]:
5655
return self.__fields_set__ # type: ignore
5756

5857
class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated]
59-
extra: Any = Extra.allow # type: ignore
58+
extra: Any = pydantic.Extra.allow # type: ignore
6059

6160
def __str__(self) -> str:
6261
# mypy complains about an invalid self arg

0 commit comments

Comments
 (0)