runwayml 2.1.4__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.
- runwayml-2.1.5/.release-please-manifest.json +3 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/CHANGELOG.md +9 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/PKG-INFO +2 -2
- {runwayml-2.1.4 → runwayml-2.1.5}/pyproject.toml +2 -2
- {runwayml-2.1.4 → runwayml-2.1.5}/requirements-dev.lock +1 -1
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_models.py +3 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_response.py +10 -10
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_utils/__init__.py +1 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_utils/_typing.py +30 -1
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_version.py +1 -1
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/test_models.py +17 -1
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/utils.py +4 -0
- runwayml-2.1.4/.release-please-manifest.json +0 -3
- {runwayml-2.1.4 → runwayml-2.1.5}/.gitignore +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/CONTRIBUTING.md +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/LICENSE +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/README.md +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/SECURITY.md +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/api.md +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/bin/check-release-environment +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/bin/publish-pypi +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/examples/.keep +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/mypy.ini +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/noxfile.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/release-please-config.json +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/requirements.lock +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/__init__.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_base_client.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_client.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_compat.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_constants.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_exceptions.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_files.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_qs.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_resource.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_streaming.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_types.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_utils/_logs.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_utils/_proxy.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_utils/_reflection.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_utils/_streams.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_utils/_sync.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_utils/_transform.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/_utils/_utils.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/lib/.keep +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/py.typed +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/resources/__init__.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/resources/image_to_video.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/resources/tasks.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/types/__init__.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/types/image_to_video_create_params.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/types/image_to_video_create_response.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/src/runwayml/types/task_retrieve_response.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/__init__.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/api_resources/__init__.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/api_resources/test_image_to_video.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/api_resources/test_tasks.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/conftest.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/sample_file.txt +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/test_client.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/test_deepcopy.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/test_extract_files.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/test_files.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/test_qs.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/test_required_args.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/test_response.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/test_streaming.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/test_transform.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/test_utils/test_proxy.py +0 -0
- {runwayml-2.1.4 → runwayml-2.1.5}/tests/test_utils/test_typing.py +0 -0
@@ -1,5 +1,14 @@
|
|
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
|
+
|
3
12
|
## 2.1.4 (2024-12-10)
|
4
13
|
|
5
14
|
Full Changelog: [v2.1.3...v2.1.4](https://github.com/runwayml/sdk-python/compare/v2.1.3...v2.1.4)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: runwayml
|
3
|
-
Version: 2.1.
|
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.
|
29
|
+
Requires-Dist: typing-extensions<5,>=4.10
|
30
30
|
Description-Content-Type: text/markdown
|
31
31
|
|
32
32
|
# RunwayML Python API library
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "runwayml"
|
3
|
-
version = "2.1.
|
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.
|
13
|
+
"typing-extensions>=4.10, <5",
|
14
14
|
"anyio>=3.5.0, <5",
|
15
15
|
"distro>=1.7.0, <2",
|
16
16
|
"sniffio",
|
@@ -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
|
131
|
-
|
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=
|
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
|
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,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)
|
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
|
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
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|