runwayml 2.1.4__py3-none-any.whl → 2.1.6__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/_client.py CHANGED
@@ -8,7 +8,7 @@ from typing_extensions import Self, override
8
8
 
9
9
  import httpx
10
10
 
11
- from . import resources, _exceptions
11
+ from . import _exceptions
12
12
  from ._qs import Querystring
13
13
  from ._types import (
14
14
  NOT_GIVEN,
@@ -24,6 +24,7 @@ from ._utils import (
24
24
  get_async_library,
25
25
  )
26
26
  from ._version import __version__
27
+ from .resources import tasks, image_to_video
27
28
  from ._streaming import Stream as Stream, AsyncStream as AsyncStream
28
29
  from ._exceptions import RunwayMLError, APIStatusError
29
30
  from ._base_client import (
@@ -37,7 +38,6 @@ __all__ = [
37
38
  "Transport",
38
39
  "ProxiesTypes",
39
40
  "RequestOptions",
40
- "resources",
41
41
  "RunwayML",
42
42
  "AsyncRunwayML",
43
43
  "Client",
@@ -46,8 +46,8 @@ __all__ = [
46
46
 
47
47
 
48
48
  class RunwayML(SyncAPIClient):
49
- tasks: resources.TasksResource
50
- image_to_video: resources.ImageToVideoResource
49
+ tasks: tasks.TasksResource
50
+ image_to_video: image_to_video.ImageToVideoResource
51
51
  with_raw_response: RunwayMLWithRawResponse
52
52
  with_streaming_response: RunwayMLWithStreamedResponse
53
53
 
@@ -111,8 +111,8 @@ class RunwayML(SyncAPIClient):
111
111
  _strict_response_validation=_strict_response_validation,
112
112
  )
113
113
 
114
- self.tasks = resources.TasksResource(self)
115
- self.image_to_video = resources.ImageToVideoResource(self)
114
+ self.tasks = tasks.TasksResource(self)
115
+ self.image_to_video = image_to_video.ImageToVideoResource(self)
116
116
  self.with_raw_response = RunwayMLWithRawResponse(self)
117
117
  self.with_streaming_response = RunwayMLWithStreamedResponse(self)
118
118
 
@@ -225,8 +225,8 @@ class RunwayML(SyncAPIClient):
225
225
 
226
226
 
227
227
  class AsyncRunwayML(AsyncAPIClient):
228
- tasks: resources.AsyncTasksResource
229
- image_to_video: resources.AsyncImageToVideoResource
228
+ tasks: tasks.AsyncTasksResource
229
+ image_to_video: image_to_video.AsyncImageToVideoResource
230
230
  with_raw_response: AsyncRunwayMLWithRawResponse
231
231
  with_streaming_response: AsyncRunwayMLWithStreamedResponse
232
232
 
@@ -290,8 +290,8 @@ class AsyncRunwayML(AsyncAPIClient):
290
290
  _strict_response_validation=_strict_response_validation,
291
291
  )
292
292
 
293
- self.tasks = resources.AsyncTasksResource(self)
294
- self.image_to_video = resources.AsyncImageToVideoResource(self)
293
+ self.tasks = tasks.AsyncTasksResource(self)
294
+ self.image_to_video = image_to_video.AsyncImageToVideoResource(self)
295
295
  self.with_raw_response = AsyncRunwayMLWithRawResponse(self)
296
296
  self.with_streaming_response = AsyncRunwayMLWithStreamedResponse(self)
297
297
 
@@ -405,26 +405,26 @@ class AsyncRunwayML(AsyncAPIClient):
405
405
 
406
406
  class RunwayMLWithRawResponse:
407
407
  def __init__(self, client: RunwayML) -> None:
408
- self.tasks = resources.TasksResourceWithRawResponse(client.tasks)
409
- self.image_to_video = resources.ImageToVideoResourceWithRawResponse(client.image_to_video)
408
+ self.tasks = tasks.TasksResourceWithRawResponse(client.tasks)
409
+ self.image_to_video = image_to_video.ImageToVideoResourceWithRawResponse(client.image_to_video)
410
410
 
411
411
 
412
412
  class AsyncRunwayMLWithRawResponse:
413
413
  def __init__(self, client: AsyncRunwayML) -> None:
414
- self.tasks = resources.AsyncTasksResourceWithRawResponse(client.tasks)
415
- self.image_to_video = resources.AsyncImageToVideoResourceWithRawResponse(client.image_to_video)
414
+ self.tasks = tasks.AsyncTasksResourceWithRawResponse(client.tasks)
415
+ self.image_to_video = image_to_video.AsyncImageToVideoResourceWithRawResponse(client.image_to_video)
416
416
 
417
417
 
418
418
  class RunwayMLWithStreamedResponse:
419
419
  def __init__(self, client: RunwayML) -> None:
420
- self.tasks = resources.TasksResourceWithStreamingResponse(client.tasks)
421
- self.image_to_video = resources.ImageToVideoResourceWithStreamingResponse(client.image_to_video)
420
+ self.tasks = tasks.TasksResourceWithStreamingResponse(client.tasks)
421
+ self.image_to_video = image_to_video.ImageToVideoResourceWithStreamingResponse(client.image_to_video)
422
422
 
423
423
 
424
424
  class AsyncRunwayMLWithStreamedResponse:
425
425
  def __init__(self, client: AsyncRunwayML) -> None:
426
- self.tasks = resources.AsyncTasksResourceWithStreamingResponse(client.tasks)
427
- self.image_to_video = resources.AsyncImageToVideoResourceWithStreamingResponse(client.image_to_video)
426
+ self.tasks = tasks.AsyncTasksResourceWithStreamingResponse(client.tasks)
427
+ self.image_to_video = image_to_video.AsyncImageToVideoResourceWithStreamingResponse(client.image_to_video)
428
428
 
429
429
 
430
430
  Client = RunwayML
runwayml/_models.py CHANGED
@@ -46,6 +46,7 @@ from ._utils import (
46
46
  strip_not_given,
47
47
  extract_type_arg,
48
48
  is_annotated_type,
49
+ is_type_alias_type,
49
50
  strip_annotated_type,
50
51
  )
51
52
  from ._compat import (
@@ -428,6 +429,8 @@ def construct_type(*, value: object, type_: object) -> object:
428
429
  # we allow `object` as the input type because otherwise, passing things like
429
430
  # `Literal['value']` will be reported as a type error by type checkers
430
431
  type_ = cast("type[object]", type_)
432
+ if is_type_alias_type(type_):
433
+ type_ = type_.__value__ # type: ignore[unreachable]
431
434
 
432
435
  # unwrap `Annotated[T, ...]` -> `T`
433
436
  if is_annotated_type(type_):
runwayml/_response.py CHANGED
@@ -25,7 +25,7 @@ import httpx
25
25
  import pydantic
26
26
 
27
27
  from ._types import NoneType
28
- from ._utils import is_given, extract_type_arg, is_annotated_type, extract_type_var_from_base
28
+ from ._utils import is_given, extract_type_arg, is_annotated_type, is_type_alias_type, extract_type_var_from_base
29
29
  from ._models import BaseModel, is_basemodel
30
30
  from ._constants import RAW_RESPONSE_HEADER, OVERRIDE_CAST_TO_HEADER
31
31
  from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type
@@ -126,9 +126,15 @@ class BaseAPIResponse(Generic[R]):
126
126
  )
127
127
 
128
128
  def _parse(self, *, to: type[_T] | None = None) -> R | _T:
129
+ cast_to = to if to is not None else self._cast_to
130
+
131
+ # unwrap `TypeAlias('Name', T)` -> `T`
132
+ if is_type_alias_type(cast_to):
133
+ cast_to = cast_to.__value__ # type: ignore[unreachable]
134
+
129
135
  # unwrap `Annotated[T, ...]` -> `T`
130
- if to and is_annotated_type(to):
131
- to = extract_type_arg(to, 0)
136
+ if cast_to and is_annotated_type(cast_to):
137
+ cast_to = extract_type_arg(cast_to, 0)
132
138
 
133
139
  if self._is_sse_stream:
134
140
  if to:
@@ -164,18 +170,12 @@ class BaseAPIResponse(Generic[R]):
164
170
  return cast(
165
171
  R,
166
172
  stream_cls(
167
- cast_to=self._cast_to,
173
+ cast_to=cast_to,
168
174
  response=self.http_response,
169
175
  client=cast(Any, self._client),
170
176
  ),
171
177
  )
172
178
 
173
- cast_to = to if to is not None else self._cast_to
174
-
175
- # unwrap `Annotated[T, ...]` -> `T`
176
- if is_annotated_type(cast_to):
177
- cast_to = extract_type_arg(cast_to, 0)
178
-
179
179
  if cast_to is NoneType:
180
180
  return cast(R, None)
181
181
 
@@ -39,6 +39,7 @@ from ._typing import (
39
39
  is_iterable_type as is_iterable_type,
40
40
  is_required_type as is_required_type,
41
41
  is_annotated_type as is_annotated_type,
42
+ is_type_alias_type as is_type_alias_type,
42
43
  strip_annotated_type as strip_annotated_type,
43
44
  extract_type_var_from_base as extract_type_var_from_base,
44
45
  )
@@ -1,8 +1,17 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import sys
4
+ import typing
5
+ import typing_extensions
3
6
  from typing import Any, TypeVar, Iterable, cast
4
7
  from collections import abc as _c_abc
5
- from typing_extensions import Required, Annotated, get_args, get_origin
8
+ from typing_extensions import (
9
+ TypeIs,
10
+ Required,
11
+ Annotated,
12
+ get_args,
13
+ get_origin,
14
+ )
6
15
 
7
16
  from .._types import InheritsGeneric
8
17
  from .._compat import is_union as _is_union
@@ -36,6 +45,26 @@ def is_typevar(typ: type) -> bool:
36
45
  return type(typ) == TypeVar # type: ignore
37
46
 
38
47
 
48
+ _TYPE_ALIAS_TYPES: tuple[type[typing_extensions.TypeAliasType], ...] = (typing_extensions.TypeAliasType,)
49
+ if sys.version_info >= (3, 12):
50
+ _TYPE_ALIAS_TYPES = (*_TYPE_ALIAS_TYPES, typing.TypeAliasType)
51
+
52
+
53
+ def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]:
54
+ """Return whether the provided argument is an instance of `TypeAliasType`.
55
+
56
+ ```python
57
+ type Int = int
58
+ is_type_alias_type(Int)
59
+ # > True
60
+ Str = TypeAliasType("Str", str)
61
+ is_type_alias_type(Str)
62
+ # > True
63
+ ```
64
+ """
65
+ return isinstance(tp, _TYPE_ALIAS_TYPES)
66
+
67
+
39
68
  # Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]]
40
69
  def strip_annotated_type(typ: type) -> type:
41
70
  if is_required_type(typ) or is_annotated_type(typ):
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__ = "2.1.4" # x-release-please-version
4
+ __version__ = "2.1.6" # x-release-please-version
@@ -1,11 +1,12 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: runwayml
3
- Version: 2.1.4
3
+ Version: 2.1.6
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
7
7
  Author-email: RunwayML <dev-feedback@runwayml.com>
8
- License: Apache-2.0
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
9
10
  Classifier: Intended Audience :: Developers
10
11
  Classifier: License :: OSI Approved :: Apache Software License
11
12
  Classifier: Operating System :: MacOS
@@ -26,7 +27,7 @@ Requires-Dist: distro<2,>=1.7.0
26
27
  Requires-Dist: httpx<1,>=0.23.0
27
28
  Requires-Dist: pydantic<3,>=1.9.0
28
29
  Requires-Dist: sniffio
29
- Requires-Dist: typing-extensions<5,>=4.7
30
+ Requires-Dist: typing-extensions<5,>=4.10
30
31
  Description-Content-Type: text/markdown
31
32
 
32
33
  # RunwayML Python API library
@@ -349,6 +350,16 @@ client.with_options(http_client=DefaultHttpxClient(...))
349
350
 
350
351
  By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
351
352
 
353
+ ```py
354
+ from runwayml import RunwayML
355
+
356
+ with RunwayML() as client:
357
+ # make requests here
358
+ ...
359
+
360
+ # HTTP client is now closed
361
+ ```
362
+
352
363
  ## Versioning
353
364
 
354
365
  This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
@@ -1,26 +1,26 @@
1
1
  runwayml/__init__.py,sha256=iXnJfH73wbj9IxfCHpwfWBxgOa9C4FRrrbBZM5f3biw,2476
2
2
  runwayml/_base_client.py,sha256=Ehfq1oaghucmu9n_MpuoOlH-qZGbetwzgNOmVG81cns,68038
3
- runwayml/_client.py,sha256=mJfU5Cq2rBWL1fwMlbjFd9w5oWZ8kb5Ps5B37y53PQw,16428
3
+ runwayml/_client.py,sha256=4y5GISlJ-EYAWKfNIj6p2W_7KwJY3bHVkCYU7yNJBtU,16453
4
4
  runwayml/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
5
5
  runwayml/_constants.py,sha256=JE8kyZa2Q4NK_i4fO--8siEYTzeHnT0fYbOFDgDP4uk,464
6
6
  runwayml/_exceptions.py,sha256=p2Q8kywHCVQzArLQL4Ht-HetTBhAvevU6yDvEq7PpIE,3224
7
7
  runwayml/_files.py,sha256=mf4dOgL4b0ryyZlbqLhggD3GVgDf6XxdGFAgce01ugE,3549
8
- runwayml/_models.py,sha256=uhxvXZC0JO7HuGR_GWXH-zYKuptF2rwiGVJfMMfg3fw,28470
8
+ runwayml/_models.py,sha256=iumFIitiWZTGITgF2nwOmEPIJGIEeJaUXhDlpaSN9Wg,28589
9
9
  runwayml/_qs.py,sha256=AOkSz4rHtK4YI3ZU_kzea-zpwBUgEY8WniGmTPyEimc,4846
10
10
  runwayml/_resource.py,sha256=BF-j3xY5eRTKmuTxg8eDhLtLP4MLB1phDh_B6BKipKA,1112
11
- runwayml/_response.py,sha256=7EGNYCVRHiVys7y6gAx5HWIwUxWvmjhd05ur53OeFkQ,28621
11
+ runwayml/_response.py,sha256=RetJb-IkgnyakTwxVpNoHS4r6gR-fWncQ1z-t_E4x1A,28677
12
12
  runwayml/_streaming.py,sha256=NSVuAgknVQWU1cgZEjQn01IdZKKynb5rOeYp5Lo-OEQ,10108
13
13
  runwayml/_types.py,sha256=oHct1QQY_lI8bepCgfWDZm2N5VNi0e6o1iLeiTh4Y_0,6145
14
- runwayml/_version.py,sha256=-qAYhUa3nk_jUtnr7GPcYJL7nEcxpitZUU_gnT9JX-0,160
14
+ runwayml/_version.py,sha256=DLi9eAplNPPqLVq3OFvYWBAOMx0lC_LID-fVZqN0B4U,160
15
15
  runwayml/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- runwayml/_utils/__init__.py,sha256=k266EatJr88V8Zseb7xUimTlCeno9SynRfLwadHP1b4,2016
16
+ runwayml/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
17
17
  runwayml/_utils/_logs.py,sha256=ZfS5W59hdqEBVV86lNrk28PhvUxtHOzs9JqiLhSu0pI,780
18
18
  runwayml/_utils/_proxy.py,sha256=z3zsateHtb0EARTWKk8QZNHfPkqJbqwd1lM993LBwGE,1902
19
19
  runwayml/_utils/_reflection.py,sha256=ZmGkIgT_PuwedyNBrrKGbxoWtkpytJNU1uU4QHnmEMU,1364
20
20
  runwayml/_utils/_streams.py,sha256=SMC90diFFecpEg_zgDRVbdR3hSEIgVVij4taD-noMLM,289
21
21
  runwayml/_utils/_sync.py,sha256=jJl-iCEaZZUAkq4IUtzN1-aMsKTUFaNoNbeYnnpQjIQ,2438
22
22
  runwayml/_utils/_transform.py,sha256=Dkkyr7OveGmOolepcvXmVJWE3kqim4b0nM0h7yWbgeY,13468
23
- runwayml/_utils/_typing.py,sha256=tFbktdpdHCQliwzGsWysgn0P5H0JRdagkZdb_LegGkY,3838
23
+ runwayml/_utils/_typing.py,sha256=nTJz0jcrQbEgxwy4TtAkNxuU0QHHlmc6mQtA6vIR8tg,4501
24
24
  runwayml/_utils/_utils.py,sha256=8UmbPOy_AAr2uUjjFui-VZSrVBHRj6bfNEKRp5YZP2A,12004
25
25
  runwayml/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
26
26
  runwayml/resources/__init__.py,sha256=O-ZVFaODsGXK0pKVlV4HKoeJyq3p9sK_9COJTv7P1WM,1069
@@ -30,7 +30,7 @@ runwayml/types/__init__.py,sha256=R3cLEXzpcEpEOuxaFBo3R72ewH1LtjpkZ0aYOIt1CAo,40
30
30
  runwayml/types/image_to_video_create_params.py,sha256=98DsjOHnmHEi8mVjZOQEDL3P1hJUT8uktp0mDA5WJ5Y,1869
31
31
  runwayml/types/image_to_video_create_response.py,sha256=l5GszzUSItV-ZYHCB8hH_GSVibUZEkzfRLrAhXkd8O4,346
32
32
  runwayml/types/task_retrieve_response.py,sha256=v8y2bLxsW6srzScW-B3Akv72q_PI_NQmduGrGRQMHds,2139
33
- runwayml-2.1.4.dist-info/METADATA,sha256=wSIQq9TgR6y4xDm-YW3FpxHXNHyGf8XpDD7U2sZX_6w,13417
34
- runwayml-2.1.4.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
35
- runwayml-2.1.4.dist-info/licenses/LICENSE,sha256=p4nykVRdA5nXTd8-slKCIfrlJZMB3wn8QBVasNQ_G_Q,11338
36
- runwayml-2.1.4.dist-info/RECORD,,
33
+ runwayml-2.1.6.dist-info/METADATA,sha256=pDxdCrNSTt-2hzxCyymfLPSp4rxiGSK_QhcyZuWnrw4,13578
34
+ runwayml-2.1.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
+ runwayml-2.1.6.dist-info/licenses/LICENSE,sha256=p4nykVRdA5nXTd8-slKCIfrlJZMB3wn8QBVasNQ_G_Q,11338
36
+ runwayml-2.1.6.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.26.3
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any