runwayml 2.1.3__tar.gz → 2.1.5__tar.gz

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.
Files changed (70) hide show
  1. runwayml-2.1.5/.release-please-manifest.json +3 -0
  2. {runwayml-2.1.3 → runwayml-2.1.5}/CHANGELOG.md +22 -0
  3. {runwayml-2.1.3 → runwayml-2.1.5}/PKG-INFO +6 -5
  4. {runwayml-2.1.3 → runwayml-2.1.5}/README.md +4 -3
  5. {runwayml-2.1.3 → runwayml-2.1.5}/pyproject.toml +2 -2
  6. {runwayml-2.1.3 → runwayml-2.1.5}/requirements-dev.lock +3 -3
  7. {runwayml-2.1.3 → runwayml-2.1.5}/requirements.lock +2 -2
  8. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_models.py +3 -0
  9. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_response.py +10 -10
  10. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_types.py +2 -4
  11. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_utils/__init__.py +1 -0
  12. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_utils/_typing.py +30 -1
  13. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_version.py +1 -1
  14. {runwayml-2.1.3 → runwayml-2.1.5}/tests/test_models.py +17 -1
  15. {runwayml-2.1.3 → runwayml-2.1.5}/tests/utils.py +4 -0
  16. runwayml-2.1.3/.release-please-manifest.json +0 -3
  17. {runwayml-2.1.3 → runwayml-2.1.5}/.gitignore +0 -0
  18. {runwayml-2.1.3 → runwayml-2.1.5}/CONTRIBUTING.md +0 -0
  19. {runwayml-2.1.3 → runwayml-2.1.5}/LICENSE +0 -0
  20. {runwayml-2.1.3 → runwayml-2.1.5}/SECURITY.md +0 -0
  21. {runwayml-2.1.3 → runwayml-2.1.5}/api.md +0 -0
  22. {runwayml-2.1.3 → runwayml-2.1.5}/bin/check-release-environment +0 -0
  23. {runwayml-2.1.3 → runwayml-2.1.5}/bin/publish-pypi +0 -0
  24. {runwayml-2.1.3 → runwayml-2.1.5}/examples/.keep +0 -0
  25. {runwayml-2.1.3 → runwayml-2.1.5}/mypy.ini +0 -0
  26. {runwayml-2.1.3 → runwayml-2.1.5}/noxfile.py +0 -0
  27. {runwayml-2.1.3 → runwayml-2.1.5}/release-please-config.json +0 -0
  28. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/__init__.py +0 -0
  29. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_base_client.py +0 -0
  30. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_client.py +0 -0
  31. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_compat.py +0 -0
  32. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_constants.py +0 -0
  33. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_exceptions.py +0 -0
  34. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_files.py +0 -0
  35. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_qs.py +0 -0
  36. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_resource.py +0 -0
  37. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_streaming.py +0 -0
  38. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_utils/_logs.py +0 -0
  39. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_utils/_proxy.py +0 -0
  40. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_utils/_reflection.py +0 -0
  41. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_utils/_streams.py +0 -0
  42. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_utils/_sync.py +0 -0
  43. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_utils/_transform.py +0 -0
  44. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/_utils/_utils.py +0 -0
  45. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/lib/.keep +0 -0
  46. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/py.typed +0 -0
  47. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/resources/__init__.py +0 -0
  48. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/resources/image_to_video.py +0 -0
  49. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/resources/tasks.py +0 -0
  50. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/types/__init__.py +0 -0
  51. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/types/image_to_video_create_params.py +0 -0
  52. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/types/image_to_video_create_response.py +0 -0
  53. {runwayml-2.1.3 → runwayml-2.1.5}/src/runwayml/types/task_retrieve_response.py +0 -0
  54. {runwayml-2.1.3 → runwayml-2.1.5}/tests/__init__.py +0 -0
  55. {runwayml-2.1.3 → runwayml-2.1.5}/tests/api_resources/__init__.py +0 -0
  56. {runwayml-2.1.3 → runwayml-2.1.5}/tests/api_resources/test_image_to_video.py +0 -0
  57. {runwayml-2.1.3 → runwayml-2.1.5}/tests/api_resources/test_tasks.py +0 -0
  58. {runwayml-2.1.3 → runwayml-2.1.5}/tests/conftest.py +0 -0
  59. {runwayml-2.1.3 → runwayml-2.1.5}/tests/sample_file.txt +0 -0
  60. {runwayml-2.1.3 → runwayml-2.1.5}/tests/test_client.py +0 -0
  61. {runwayml-2.1.3 → runwayml-2.1.5}/tests/test_deepcopy.py +0 -0
  62. {runwayml-2.1.3 → runwayml-2.1.5}/tests/test_extract_files.py +0 -0
  63. {runwayml-2.1.3 → runwayml-2.1.5}/tests/test_files.py +0 -0
  64. {runwayml-2.1.3 → runwayml-2.1.5}/tests/test_qs.py +0 -0
  65. {runwayml-2.1.3 → runwayml-2.1.5}/tests/test_required_args.py +0 -0
  66. {runwayml-2.1.3 → runwayml-2.1.5}/tests/test_response.py +0 -0
  67. {runwayml-2.1.3 → runwayml-2.1.5}/tests/test_streaming.py +0 -0
  68. {runwayml-2.1.3 → runwayml-2.1.5}/tests/test_transform.py +0 -0
  69. {runwayml-2.1.3 → runwayml-2.1.5}/tests/test_utils/test_proxy.py +0 -0
  70. {runwayml-2.1.3 → runwayml-2.1.5}/tests/test_utils/test_typing.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "2.1.5"
3
+ }
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.5 (2024-12-13)
4
+
5
+ Full Changelog: [v2.1.4...v2.1.5](https://github.com/runwayml/sdk-python/compare/v2.1.4...v2.1.5)
6
+
7
+ ### Chores
8
+
9
+ * **internal:** add support for TypeAliasType ([#46](https://github.com/runwayml/sdk-python/issues/46)) ([278afad](https://github.com/runwayml/sdk-python/commit/278afade7c0541db8a14f4dbb763ec6cd2797558))
10
+ * **internal:** bump pyright ([#44](https://github.com/runwayml/sdk-python/issues/44)) ([eb51ffa](https://github.com/runwayml/sdk-python/commit/eb51ffa9ef89567501d19cf9183ac64792062559))
11
+
12
+ ## 2.1.4 (2024-12-10)
13
+
14
+ Full Changelog: [v2.1.3...v2.1.4](https://github.com/runwayml/sdk-python/compare/v2.1.3...v2.1.4)
15
+
16
+ ### Chores
17
+
18
+ * **internal:** bump pydantic dependency ([#40](https://github.com/runwayml/sdk-python/issues/40)) ([ae3a845](https://github.com/runwayml/sdk-python/commit/ae3a8457855179ccc6e784e2e2cf39613fedddcd))
19
+
20
+
21
+ ### Documentation
22
+
23
+ * **readme:** fix http client proxies example ([#42](https://github.com/runwayml/sdk-python/issues/42)) ([d1389f7](https://github.com/runwayml/sdk-python/commit/d1389f73504fc60d07be4742ea12c7f9d5841034))
24
+
3
25
  ## 2.1.3 (2024-12-04)
4
26
 
5
27
  Full Changelog: [v2.1.2...v2.1.3](https://github.com/runwayml/sdk-python/compare/v2.1.2...v2.1.3)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: runwayml
3
- Version: 2.1.3
3
+ Version: 2.1.5
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
@@ -26,7 +26,7 @@ Requires-Dist: distro<2,>=1.7.0
26
26
  Requires-Dist: httpx<1,>=0.23.0
27
27
  Requires-Dist: pydantic<3,>=1.9.0
28
28
  Requires-Dist: sniffio
29
- Requires-Dist: typing-extensions<5,>=4.7
29
+ Requires-Dist: typing-extensions<5,>=4.10
30
30
  Description-Content-Type: text/markdown
31
31
 
32
32
  # RunwayML Python API library
@@ -321,18 +321,19 @@ can also get all the extra fields on the Pydantic model as a dict with
321
321
 
322
322
  You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
323
323
 
324
- - Support for proxies
325
- - Custom transports
324
+ - Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
325
+ - Custom [transports](https://www.python-httpx.org/advanced/transports/)
326
326
  - Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
327
327
 
328
328
  ```python
329
+ import httpx
329
330
  from runwayml import RunwayML, DefaultHttpxClient
330
331
 
331
332
  client = RunwayML(
332
333
  # Or use the `RUNWAYML_BASE_URL` env var
333
334
  base_url="http://my.test.server.example.com:8083",
334
335
  http_client=DefaultHttpxClient(
335
- proxies="http://my.test.proxy.example.com",
336
+ proxy="http://my.test.proxy.example.com",
336
337
  transport=httpx.HTTPTransport(local_address="0.0.0.0"),
337
338
  ),
338
339
  )
@@ -290,18 +290,19 @@ can also get all the extra fields on the Pydantic model as a dict with
290
290
 
291
291
  You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
292
292
 
293
- - Support for proxies
294
- - Custom transports
293
+ - Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
294
+ - Custom [transports](https://www.python-httpx.org/advanced/transports/)
295
295
  - Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
296
296
 
297
297
  ```python
298
+ import httpx
298
299
  from runwayml import RunwayML, DefaultHttpxClient
299
300
 
300
301
  client = RunwayML(
301
302
  # Or use the `RUNWAYML_BASE_URL` env var
302
303
  base_url="http://my.test.server.example.com:8083",
303
304
  http_client=DefaultHttpxClient(
304
- proxies="http://my.test.proxy.example.com",
305
+ proxy="http://my.test.proxy.example.com",
305
306
  transport=httpx.HTTPTransport(local_address="0.0.0.0"),
306
307
  ),
307
308
  )
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "runwayml"
3
- version = "2.1.3"
3
+ version = "2.1.5"
4
4
  description = "The official Python library for the runwayml API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -10,7 +10,7 @@ authors = [
10
10
  dependencies = [
11
11
  "httpx>=0.23.0, <1",
12
12
  "pydantic>=1.9.0, <3",
13
- "typing-extensions>=4.7, <5",
13
+ "typing-extensions>=4.10, <5",
14
14
  "anyio>=3.5.0, <5",
15
15
  "distro>=1.7.0, <2",
16
16
  "sniffio",
@@ -62,13 +62,13 @@ platformdirs==3.11.0
62
62
  # via virtualenv
63
63
  pluggy==1.5.0
64
64
  # via pytest
65
- pydantic==2.9.2
65
+ pydantic==2.10.3
66
66
  # via runwayml
67
- pydantic-core==2.23.4
67
+ pydantic-core==2.27.1
68
68
  # via pydantic
69
69
  pygments==2.18.0
70
70
  # via rich
71
- pyright==1.1.389
71
+ pyright==1.1.390
72
72
  pytest==8.3.3
73
73
  # via pytest-asyncio
74
74
  pytest-asyncio==0.24.0
@@ -30,9 +30,9 @@ httpx==0.25.2
30
30
  idna==3.4
31
31
  # via anyio
32
32
  # via httpx
33
- pydantic==2.9.2
33
+ pydantic==2.10.3
34
34
  # via runwayml
35
- pydantic-core==2.23.4
35
+ pydantic-core==2.27.1
36
36
  # via pydantic
37
37
  sniffio==1.3.0
38
38
  # via anyio
@@ -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_):
@@ -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
 
@@ -192,10 +192,8 @@ ResponseT = TypeVar(
192
192
  StrBytesIntFloat = Union[str, bytes, int, float]
193
193
 
194
194
  # Note: copied from Pydantic
195
- # https://github.com/pydantic/pydantic/blob/32ea570bf96e84234d2992e1ddf40ab8a565925a/pydantic/main.py#L49
196
- IncEx: TypeAlias = Union[
197
- Set[int], Set[str], Mapping[int, Union["IncEx", Literal[True]]], Mapping[str, Union["IncEx", Literal[True]]]
198
- ]
195
+ # https://github.com/pydantic/pydantic/blob/6f31f8f68ef011f84357330186f603ff295312fd/pydantic/main.py#L79
196
+ IncEx: TypeAlias = Union[Set[int], Set[str], Mapping[int, Union["IncEx", bool]], Mapping[str, Union["IncEx", bool]]]
199
197
 
200
198
  PostParser = Callable[[Any], Any]
201
199
 
@@ -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):
@@ -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.3" # x-release-please-version
4
+ __version__ = "2.1.5" # x-release-please-version
@@ -1,7 +1,7 @@
1
1
  import json
2
2
  from typing import Any, Dict, List, Union, Optional, cast
3
3
  from datetime import datetime, timezone
4
- from typing_extensions import Literal, Annotated
4
+ from typing_extensions import Literal, Annotated, TypeAliasType
5
5
 
6
6
  import pytest
7
7
  import pydantic
@@ -828,3 +828,19 @@ def test_discriminated_unions_invalid_data_uses_cache() -> None:
828
828
  # if the discriminator details object stays the same between invocations then
829
829
  # we hit the cache
830
830
  assert UnionType.__discriminator__ is discriminator
831
+
832
+
833
+ @pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1")
834
+ def test_type_alias_type() -> None:
835
+ Alias = TypeAliasType("Alias", str)
836
+
837
+ class Model(BaseModel):
838
+ alias: Alias
839
+ union: Union[int, Alias]
840
+
841
+ m = construct_type(value={"alias": "foo", "union": "bar"}, type_=Model)
842
+ assert isinstance(m, Model)
843
+ assert isinstance(m.alias, str)
844
+ assert m.alias == "foo"
845
+ assert isinstance(m.union, str)
846
+ assert m.union == "bar"
@@ -16,6 +16,7 @@ from runwayml._utils import (
16
16
  is_union_type,
17
17
  extract_type_arg,
18
18
  is_annotated_type,
19
+ is_type_alias_type,
19
20
  )
20
21
  from runwayml._compat import PYDANTIC_V2, field_outer_type, get_model_fields
21
22
  from runwayml._models import BaseModel
@@ -51,6 +52,9 @@ def assert_matches_type(
51
52
  path: list[str],
52
53
  allow_none: bool = False,
53
54
  ) -> None:
55
+ if is_type_alias_type(type_):
56
+ type_ = type_.__value__
57
+
54
58
  # unwrap `Annotated[T, ...]` -> `T`
55
59
  if is_annotated_type(type_):
56
60
  type_ = extract_type_arg(type_, 0)
@@ -1,3 +0,0 @@
1
- {
2
- ".": "2.1.3"
3
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes