runwayml 3.5.0__py3-none-any.whl → 3.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
runwayml/__init__.py CHANGED
@@ -37,7 +37,7 @@ from ._exceptions import (
37
37
  APIResponseValidationError,
38
38
  )
39
39
  from .lib.polling import TaskFailedError, TaskTimeoutError
40
- from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
40
+ from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
41
41
  from ._utils._logs import setup_logging as _setup_logging
42
42
 
43
43
  __all__ = [
@@ -79,6 +79,7 @@ __all__ = [
79
79
  "DEFAULT_CONNECTION_LIMITS",
80
80
  "DefaultHttpxClient",
81
81
  "DefaultAsyncHttpxClient",
82
+ "DefaultAioHttpClient",
82
83
  "TaskFailedError",
83
84
  "TaskTimeoutError",
84
85
  ]
runwayml/_base_client.py CHANGED
@@ -1289,6 +1289,24 @@ class _DefaultAsyncHttpxClient(httpx.AsyncClient):
1289
1289
  super().__init__(**kwargs)
1290
1290
 
1291
1291
 
1292
+ try:
1293
+ import httpx_aiohttp
1294
+ except ImportError:
1295
+
1296
+ class _DefaultAioHttpClient(httpx.AsyncClient):
1297
+ def __init__(self, **_kwargs: Any) -> None:
1298
+ raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra")
1299
+ else:
1300
+
1301
+ class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
1302
+ def __init__(self, **kwargs: Any) -> None:
1303
+ kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
1304
+ kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
1305
+ kwargs.setdefault("follow_redirects", True)
1306
+
1307
+ super().__init__(**kwargs)
1308
+
1309
+
1292
1310
  if TYPE_CHECKING:
1293
1311
  DefaultAsyncHttpxClient = httpx.AsyncClient
1294
1312
  """An alias to `httpx.AsyncClient` that provides the same defaults that this SDK
@@ -1297,8 +1315,12 @@ if TYPE_CHECKING:
1297
1315
  This is useful because overriding the `http_client` with your own instance of
1298
1316
  `httpx.AsyncClient` will result in httpx's defaults being used, not ours.
1299
1317
  """
1318
+
1319
+ DefaultAioHttpClient = httpx.AsyncClient
1320
+ """An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`."""
1300
1321
  else:
1301
1322
  DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient
1323
+ DefaultAioHttpClient = _DefaultAioHttpClient
1302
1324
 
1303
1325
 
1304
1326
  class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient):
runwayml/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "runwayml"
4
- __version__ = "3.5.0" # x-release-please-version
4
+ __version__ = "3.6.0" # x-release-please-version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: runwayml
3
- Version: 3.5.0
3
+ Version: 3.6.0
4
4
  Summary: The official Python library for the runwayml API
5
5
  Project-URL: Homepage, https://github.com/runwayml/sdk-python
6
6
  Project-URL: Repository, https://github.com/runwayml/sdk-python
@@ -27,11 +27,14 @@ Requires-Dist: httpx<1,>=0.23.0
27
27
  Requires-Dist: pydantic<3,>=1.9.0
28
28
  Requires-Dist: sniffio
29
29
  Requires-Dist: typing-extensions<5,>=4.10
30
+ Provides-Extra: aiohttp
31
+ Requires-Dist: aiohttp; extra == 'aiohttp'
32
+ Requires-Dist: httpx-aiohttp>=0.1.6; extra == 'aiohttp'
30
33
  Description-Content-Type: text/markdown
31
34
 
32
35
  # RunwayML Python API library
33
36
 
34
- [![PyPI version](https://img.shields.io/pypi/v/runwayml.svg)](https://pypi.org/project/runwayml/)
37
+ [![PyPI version](https://github.com/runwayml/sdk-python/tree/main/<https://img.shields.io/pypi/v/runwayml.svg?label=pypi%20(stable)>)](https://pypi.org/project/runwayml/)
35
38
 
36
39
  The RunwayML Python library provides convenient access to the RunwayML REST API from any Python 3.8+
37
40
  application. The library includes type definitions for all request params and response fields,
@@ -105,6 +108,43 @@ asyncio.run(main())
105
108
 
106
109
  Functionality between the synchronous and asynchronous clients is otherwise identical.
107
110
 
111
+ ### With aiohttp
112
+
113
+ By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
114
+
115
+ You can enable this by installing `aiohttp`:
116
+
117
+ ```sh
118
+ # install from PyPI
119
+ pip install runwayml[aiohttp]
120
+ ```
121
+
122
+ Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
123
+
124
+ ```python
125
+ import os
126
+ import asyncio
127
+ from runwayml import DefaultAioHttpClient
128
+ from runwayml import AsyncRunwayML
129
+
130
+
131
+ async def main() -> None:
132
+ async with AsyncRunwayML(
133
+ api_key=os.environ.get("RUNWAYML_API_SECRET"), # This is the default and can be omitted
134
+ http_client=DefaultAioHttpClient(),
135
+ ) as client:
136
+ image_to_video = await client.image_to_video.create(
137
+ model="gen4_turbo",
138
+ prompt_image="https://example.com/assets/bunny.jpg",
139
+ ratio="1280:720",
140
+ prompt_text="The bunny is eating a carrot",
141
+ )
142
+ print(image_to_video.id)
143
+
144
+
145
+ asyncio.run(main())
146
+ ```
147
+
108
148
  ## Using types
109
149
 
110
150
  Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
@@ -206,7 +246,7 @@ client.with_options(max_retries=5).image_to_video.create(
206
246
  ### Timeouts
207
247
 
208
248
  By default requests time out after 1 minute. You can configure this with a `timeout` option,
209
- which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
249
+ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
210
250
 
211
251
  ```python
212
252
  from runwayml import RunwayML
@@ -1,5 +1,5 @@
1
- runwayml/__init__.py,sha256=y_OizTn3A4yOML16rBpWDwOU4caMAtiu6Iz02DHETgA,2693
2
- runwayml/_base_client.py,sha256=Ix0P9AvG5RoBrE4TOAyaAmMipKftcg4eZTPbuI4Ugio,65886
1
+ runwayml/__init__.py,sha256=tr-n2Y4sH_wBv8t2F_jk7ku_rLT2erU3j61ONZJWUVs,2743
2
+ runwayml/_base_client.py,sha256=FH5ueSL8_ijbhXlcd6FG98sy_IMnFsAhVkBkCcv4ZjI,66717
3
3
  runwayml/_client.py,sha256=tEooz-jH6JGowMQwrTZE7CKcyqpILEHKfSFf7OevoIU,18513
4
4
  runwayml/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
5
5
  runwayml/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
@@ -11,7 +11,7 @@ runwayml/_resource.py,sha256=BF-j3xY5eRTKmuTxg8eDhLtLP4MLB1phDh_B6BKipKA,1112
11
11
  runwayml/_response.py,sha256=WxjSEXX-j01ZhlSxYyMCVSEKxo20pgy40RA7iyski8M,28800
12
12
  runwayml/_streaming.py,sha256=NSVuAgknVQWU1cgZEjQn01IdZKKynb5rOeYp5Lo-OEQ,10108
13
13
  runwayml/_types.py,sha256=YL6SdhLq5SHlT644GjzDwOJ_Slyr8QDRCoacOp4trhI,6199
14
- runwayml/_version.py,sha256=TTPBS3eF1AlhzcYEdnHx7EWU5BZA4Oj9bDtQQ7AX6Wo,160
14
+ runwayml/_version.py,sha256=cTRo7ZS2XlFsYQnDltFU4mR3P69yxWhnj5GXcoaXxfM,160
15
15
  runwayml/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  runwayml/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
17
17
  runwayml/_utils/_logs.py,sha256=ZfS5W59hdqEBVV86lNrk28PhvUxtHOzs9JqiLhSu0pI,780
@@ -40,7 +40,7 @@ runwayml/types/text_to_image_create_params.py,sha256=I8Dr4UG6VnciQ87zN6qp03FKwlQ
40
40
  runwayml/types/text_to_image_create_response.py,sha256=koMzUg82dYFQPp77wln3UR1z8WO2sHCNMWGgoQ9Id8M,262
41
41
  runwayml/types/video_upscale_create_params.py,sha256=Ta3BNQy9aeTUBU5Ui-CMJtF32HeNRqbNpqjAAOKXyks,743
42
42
  runwayml/types/video_upscale_create_response.py,sha256=zf-79HbJa68dUHltBiZjVtnW_U6HUI-htmkTm5URBSU,264
43
- runwayml-3.5.0.dist-info/METADATA,sha256=XVkA49TYYef7Lo64G3DhqxZ_TnLk6sAD-syfEscSpE0,13986
44
- runwayml-3.5.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
45
- runwayml-3.5.0.dist-info/licenses/LICENSE,sha256=baeFj6izBWIm6A5_7N3-WAsy_VYpDF05Dd4zS1zsfZI,11338
46
- runwayml-3.5.0.dist-info/RECORD,,
43
+ runwayml-3.6.0.dist-info/METADATA,sha256=bR7BWijWXnNF3KexxAaHUaeUDjSgxAztRyUSEmFF19w,15209
44
+ runwayml-3.6.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
45
+ runwayml-3.6.0.dist-info/licenses/LICENSE,sha256=baeFj6izBWIm6A5_7N3-WAsy_VYpDF05Dd4zS1zsfZI,11338
46
+ runwayml-3.6.0.dist-info/RECORD,,