Skip to content

Commit 1f84c22

Browse files
author
hexiaochun
committed
feat: down to 3.7; add extras_require
1 parent 2cfd650 commit 1f84c22

File tree

6 files changed

+29
-32
lines changed

6 files changed

+29
-32
lines changed

setup.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,24 @@
1111
# prerequisite: setuptools
1212
# http://pypi.python.org/pypi/setuptools
1313

14-
REQUIRES = [
15-
"certifi>=2017.4.17",
16-
"python-dateutil>=2.1",
17-
"six>=1.10",
18-
"urllib3>=1.23"
19-
]
14+
REQUIRES = ["certifi>=2017.4.17", "python-dateutil>=2.1", "six>=1.10", "urllib3>=1.23"]
2015

2116
setup(
2217
name=NAME,
2318
version=VERSION,
2419
install_requires=REQUIRES,
2520
packages=find_packages(),
2621
include_package_data=True,
27-
description='Volcengine SDK for Python',
22+
description="Volcengine SDK for Python",
2823
license="Apache License 2.0",
29-
platforms='any',
30-
url='https://github.com/volcengine/volcengine-python-sdk',
24+
platforms="any",
25+
url="https://github.com/volcengine/volcengine-python-sdk",
26+
extras_require={
27+
"ark": [
28+
"pydantic>=1.9.0, <3",
29+
"httpx>=0.23.0, <1",
30+
"anyio>=3.5.0, <5",
31+
"cached-property; python_version < '3.8'",
32+
]
33+
},
3134
)

volcenginesdkarkruntime/_request_options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from __future__ import annotations
22

3-
from typing import Dict, Union, Any, ClassVar, TypedDict, TYPE_CHECKING, cast
3+
from typing import Dict, Union, Any, TYPE_CHECKING, cast
44

55
import pydantic
66
from httpx import Timeout
7-
from typing_extensions import Unpack
7+
from typing_extensions import Unpack, TypedDict, ClassVar
88

99
from ._compat import PYDANTIC_V2, ConfigDict
1010
from ._models import BaseModel

volcenginesdkarkruntime/_utils/_transform.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Literal
4-
from typing_extensions import override
3+
from typing_extensions import Literal, override
54

65
PropertyFormat = Literal["iso8601", "base64", "custom"]
76

volcenginesdkarkruntime/_utils/_typing.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
from typing import get_args, cast, get_origin, Annotated
2-
from typing_extensions import Required
1+
from __future__ import annotations
2+
3+
from typing import cast
4+
from typing_extensions import Required, get_args, get_origin, Annotated
35

46

57
def extract_type_arg(typ: type, index: int = 0) -> type:

volcenginesdkarkruntime/resources/chat/chat.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,20 @@
22

33
from __future__ import annotations
44

5-
from functools import cache
6-
75
from .completions import Completions, AsyncCompletions
6+
from ..._compat import cached_property
87
from ..._resource import SyncAPIResource, AsyncAPIResource
98

109
__all__ = ["Chat", "AsyncChat"]
1110

1211

1312
class Chat(SyncAPIResource):
14-
@property
15-
@cache
13+
@cached_property
1614
def completions(self) -> Completions:
1715
return Completions(self._client)
1816

1917

2018
class AsyncChat(AsyncAPIResource):
21-
@property
22-
@cache
19+
@cached_property
2320
def completions(self) -> AsyncCompletions:
2421
return AsyncCompletions(self._client)

volcenginesdkarkruntime/resources/chat/completions.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from __future__ import annotations
22

3-
from functools import cache
3+
from typing import Dict, List, Union, Iterable, Optional
44

55
import httpx
6+
from typing_extensions import Literal
67

78
from ..._base_client import make_request_options
89
from ..._resource import SyncAPIResource, AsyncAPIResource
9-
from typing import Dict, List, Union, Iterable, Optional, overload
10-
from typing_extensions import Literal
10+
from ..._compat import cached_property
1111

1212
from ..._response import (
1313
to_raw_response_wrapper,
@@ -29,13 +29,11 @@
2929

3030

3131
class Completions(SyncAPIResource):
32-
@property
33-
@cache
32+
@cached_property
3433
def with_raw_response(self) -> CompletionsWithRawResponse:
3534
return CompletionsWithRawResponse(self)
3635

37-
@property
38-
@cache
36+
@cached_property
3937
def with_streaming_response(self) -> CompletionsWithStreamingResponse:
4038
return CompletionsWithStreamingResponse(self)
4139

@@ -98,13 +96,11 @@ def create(
9896

9997

10098
class AsyncCompletions(AsyncAPIResource):
101-
@property
102-
@cache
99+
@cached_property
103100
def with_raw_response(self) -> AsyncCompletionsWithRawResponse:
104101
return AsyncCompletionsWithRawResponse(self)
105102

106-
@property
107-
@cache
103+
@cached_property
108104
def with_streaming_response(self) -> AsyncCompletionsWithStreamingResponse:
109105
return AsyncCompletionsWithStreamingResponse(self)
110106

0 commit comments

Comments
 (0)