syncsdk 0.2.0__tar.gz → 0.2.2__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 (66) hide show
  1. {syncsdk-0.2.0 → syncsdk-0.2.2}/PKG-INFO +39 -17
  2. {syncsdk-0.2.0 → syncsdk-0.2.2}/README.md +38 -16
  3. {syncsdk-0.2.0 → syncsdk-0.2.2}/pyproject.toml +1 -1
  4. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/client.py +10 -4
  5. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/generation.py +5 -0
  6. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/client_wrapper.py +2 -2
  7. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/webhooks/types/generation_notification.py +5 -0
  8. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/__init__.py +0 -0
  9. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/batch/__init__.py +0 -0
  10. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/batch/client.py +0 -0
  11. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/batch/raw_client.py +0 -0
  12. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/__init__.py +0 -0
  13. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/errors/__init__.py +0 -0
  14. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/errors/bad_request_error.py +0 -0
  15. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/errors/internal_server_error.py +0 -0
  16. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/errors/not_found_error.py +0 -0
  17. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/errors/payment_required_error.py +0 -0
  18. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/errors/too_many_requests_error.py +0 -0
  19. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/errors/unauthorized_error.py +0 -0
  20. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/__init__.py +0 -0
  21. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/active_speaker.py +0 -0
  22. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/audio.py +0 -0
  23. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/batch_id.py +0 -0
  24. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/batch_metrics.py +0 -0
  25. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/batch_response.py +0 -0
  26. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/batch_status.py +0 -0
  27. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/create_batch_response.py +0 -0
  28. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/create_generation_dto.py +0 -0
  29. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/eleven_labs.py +0 -0
  30. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/estimated_generation_cost.py +0 -0
  31. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/generation_error.py +0 -0
  32. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/generation_error_message.py +0 -0
  33. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/generation_id.py +0 -0
  34. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/generation_options.py +0 -0
  35. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/generation_status.py +0 -0
  36. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/input.py +0 -0
  37. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/model.py +0 -0
  38. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/segment_frames.py +0 -0
  39. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/segment_secs.py +0 -0
  40. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/sync_mode.py +0 -0
  41. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/tts.py +0 -0
  42. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/tts_provider_config.py +0 -0
  43. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/validation_response.py +0 -0
  44. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/common/types/video.py +0 -0
  45. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/__init__.py +0 -0
  46. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/api_error.py +0 -0
  47. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/datetime_utils.py +0 -0
  48. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/file.py +0 -0
  49. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/http_client.py +0 -0
  50. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/http_response.py +0 -0
  51. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/jsonable_encoder.py +0 -0
  52. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/pydantic_utilities.py +0 -0
  53. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/query_encoder.py +0 -0
  54. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/remove_none_from_dict.py +0 -0
  55. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/request_options.py +0 -0
  56. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/serialization.py +0 -0
  57. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/core/unchecked_base_model.py +0 -0
  58. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/environment.py +0 -0
  59. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/generations/__init__.py +0 -0
  60. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/generations/client.py +0 -0
  61. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/generations/raw_client.py +0 -0
  62. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/py.typed +0 -0
  63. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/version.py +0 -0
  64. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/webhooks/__init__.py +0 -0
  65. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/webhooks/types/__init__.py +0 -0
  66. {syncsdk-0.2.0 → syncsdk-0.2.2}/src/sync/webhooks/types/webhook_status.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: syncsdk
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Intended Audience :: Developers
@@ -24,16 +24,16 @@ Requires-Dist: pydantic-core (>=2.18.2,<3.0.0)
24
24
  Requires-Dist: typing_extensions (>=4.0.0)
25
25
  Description-Content-Type: text/markdown
26
26
 
27
- # Sync Python Library
27
+ # Sync Python SDK
28
28
 
29
29
  [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fsynchronicity-labs%2Fsync-python-sdk)
30
30
  [![pypi](https://img.shields.io/pypi/v/syncsdk)](https://pypi.python.org/pypi/syncsdk)
31
31
 
32
- The Sync Python library provides convenient access to the Sync API from Python.
32
+ The Sync Python SDK provides convenient access to the Sync API from Python.
33
33
 
34
34
  ## Documentation
35
35
 
36
- API reference documentation is available [here](https://sync.docs.buildwithfern.com/api-reference).
36
+ API reference documentation is available [here](https://docs.sync.so/api-reference).
37
37
 
38
38
  ## Installation
39
39
 
@@ -43,20 +43,30 @@ pip install syncsdk
43
43
 
44
44
  ## Reference
45
45
 
46
- A full reference for this library is available [here](https://github.com/synchronicity-labs/sync-python-sdk/blob/HEAD/./reference.md).
46
+ A full reference for this library is available [here](./reference.md).
47
47
 
48
48
  ## Usage
49
49
 
50
- Instantiate and use the client with the following:
50
+ Set SYNC_API_KEY environment variable to your [Sync](https://sync.so/settings/api-keys) and use the client with the following:
51
51
 
52
52
  ```python
53
53
  from sync import Sync
54
-
55
- client = Sync(
56
- api_key="YOUR_API_KEY",
57
- )
58
- client.batch.create(
59
- dry_run=True,
54
+ from sync.common import Audio, GenerationOptions, Video
55
+
56
+ sync = Sync()
57
+ sync.generations.create(
58
+ input=[
59
+ Video(
60
+ url="https://assets.sync.so/docs/example-video.mp4",
61
+ ),
62
+ Audio(
63
+ url="https://assets.sync.so/docs/example-audio.wav",
64
+ ),
65
+ ],
66
+ model="lipsync-2",
67
+ options=GenerationOptions(
68
+ sync_mode="loop",
69
+ ),
60
70
  )
61
71
  ```
62
72
 
@@ -68,6 +78,7 @@ The SDK also exports an `async` client so that you can make non-blocking calls t
68
78
  import asyncio
69
79
 
70
80
  from sync import AsyncSync
81
+ from sync.common import Audio, GenerationOptions, Video
71
82
 
72
83
  client = AsyncSync(
73
84
  api_key="YOUR_API_KEY",
@@ -75,8 +86,19 @@ client = AsyncSync(
75
86
 
76
87
 
77
88
  async def main() -> None:
78
- await client.batch.create(
79
- dry_run=True,
89
+ await client.generations.create(
90
+ input=[
91
+ Video(
92
+ url="https://assets.sync.so/docs/example-video.mp4",
93
+ ),
94
+ Audio(
95
+ url="https://assets.sync.so/docs/example-audio.wav",
96
+ ),
97
+ ],
98
+ model="lipsync-2",
99
+ options=GenerationOptions(
100
+ sync_mode="loop",
101
+ ),
80
102
  )
81
103
 
82
104
 
@@ -92,7 +114,7 @@ will be thrown.
92
114
  from sync.core.api_error import ApiError
93
115
 
94
116
  try:
95
- client.batch.create(...)
117
+ client.generations.create(...)
96
118
  except ApiError as e:
97
119
  print(e.status_code)
98
120
  print(e.body)
@@ -115,7 +137,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
115
137
  Use the `max_retries` request option to configure this behavior.
116
138
 
117
139
  ```python
118
- client.batch.create(..., request_options={
140
+ client.generations.create(..., request_options={
119
141
  "max_retries": 1
120
142
  })
121
143
  ```
@@ -135,7 +157,7 @@ client = Sync(
135
157
 
136
158
 
137
159
  # Override timeout for a specific method
138
- client.batch.create(..., request_options={
160
+ client.generations.create(..., request_options={
139
161
  "timeout_in_seconds": 1
140
162
  })
141
163
  ```
@@ -1,13 +1,13 @@
1
- # Sync Python Library
1
+ # Sync Python SDK
2
2
 
3
3
  [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fsynchronicity-labs%2Fsync-python-sdk)
4
4
  [![pypi](https://img.shields.io/pypi/v/syncsdk)](https://pypi.python.org/pypi/syncsdk)
5
5
 
6
- The Sync Python library provides convenient access to the Sync API from Python.
6
+ The Sync Python SDK provides convenient access to the Sync API from Python.
7
7
 
8
8
  ## Documentation
9
9
 
10
- API reference documentation is available [here](https://sync.docs.buildwithfern.com/api-reference).
10
+ API reference documentation is available [here](https://docs.sync.so/api-reference).
11
11
 
12
12
  ## Installation
13
13
 
@@ -17,20 +17,30 @@ pip install syncsdk
17
17
 
18
18
  ## Reference
19
19
 
20
- A full reference for this library is available [here](https://github.com/synchronicity-labs/sync-python-sdk/blob/HEAD/./reference.md).
20
+ A full reference for this library is available [here](./reference.md).
21
21
 
22
22
  ## Usage
23
23
 
24
- Instantiate and use the client with the following:
24
+ Set SYNC_API_KEY environment variable to your [Sync](https://sync.so/settings/api-keys) and use the client with the following:
25
25
 
26
26
  ```python
27
27
  from sync import Sync
28
-
29
- client = Sync(
30
- api_key="YOUR_API_KEY",
31
- )
32
- client.batch.create(
33
- dry_run=True,
28
+ from sync.common import Audio, GenerationOptions, Video
29
+
30
+ sync = Sync()
31
+ sync.generations.create(
32
+ input=[
33
+ Video(
34
+ url="https://assets.sync.so/docs/example-video.mp4",
35
+ ),
36
+ Audio(
37
+ url="https://assets.sync.so/docs/example-audio.wav",
38
+ ),
39
+ ],
40
+ model="lipsync-2",
41
+ options=GenerationOptions(
42
+ sync_mode="loop",
43
+ ),
34
44
  )
35
45
  ```
36
46
 
@@ -42,6 +52,7 @@ The SDK also exports an `async` client so that you can make non-blocking calls t
42
52
  import asyncio
43
53
 
44
54
  from sync import AsyncSync
55
+ from sync.common import Audio, GenerationOptions, Video
45
56
 
46
57
  client = AsyncSync(
47
58
  api_key="YOUR_API_KEY",
@@ -49,8 +60,19 @@ client = AsyncSync(
49
60
 
50
61
 
51
62
  async def main() -> None:
52
- await client.batch.create(
53
- dry_run=True,
63
+ await client.generations.create(
64
+ input=[
65
+ Video(
66
+ url="https://assets.sync.so/docs/example-video.mp4",
67
+ ),
68
+ Audio(
69
+ url="https://assets.sync.so/docs/example-audio.wav",
70
+ ),
71
+ ],
72
+ model="lipsync-2",
73
+ options=GenerationOptions(
74
+ sync_mode="loop",
75
+ ),
54
76
  )
55
77
 
56
78
 
@@ -66,7 +88,7 @@ will be thrown.
66
88
  from sync.core.api_error import ApiError
67
89
 
68
90
  try:
69
- client.batch.create(...)
91
+ client.generations.create(...)
70
92
  except ApiError as e:
71
93
  print(e.status_code)
72
94
  print(e.body)
@@ -89,7 +111,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
89
111
  Use the `max_retries` request option to configure this behavior.
90
112
 
91
113
  ```python
92
- client.batch.create(..., request_options={
114
+ client.generations.create(..., request_options={
93
115
  "max_retries": 1
94
116
  })
95
117
  ```
@@ -109,7 +131,7 @@ client = Sync(
109
131
 
110
132
 
111
133
  # Override timeout for a specific method
112
- client.batch.create(..., request_options={
134
+ client.generations.create(..., request_options={
113
135
  "timeout_in_seconds": 1
114
136
  })
115
137
  ```
@@ -3,7 +3,7 @@ name = "syncsdk"
3
3
 
4
4
  [tool.poetry]
5
5
  name = "syncsdk"
6
- version = "0.2.0"
6
+ version = "0.2.2"
7
7
  description = ""
8
8
  readme = "README.md"
9
9
  authors = []
@@ -2,7 +2,9 @@
2
2
 
3
3
  import typing
4
4
  from .environment import SyncEnvironment
5
+ import os
5
6
  import httpx
7
+ from .core.api_error import ApiError
6
8
  from .core.client_wrapper import SyncClientWrapper
7
9
  from .batch.client import BatchClient
8
10
  from .generations.client import GenerationsClient
@@ -29,7 +31,7 @@ class Sync:
29
31
 
30
32
 
31
33
 
32
- api_key : str
34
+ api_key : typing.Optional[str]
33
35
  timeout : typing.Optional[float]
34
36
  The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
35
37
 
@@ -53,7 +55,7 @@ class Sync:
53
55
  *,
54
56
  base_url: typing.Optional[str] = None,
55
57
  environment: SyncEnvironment = SyncEnvironment.DEFAULT,
56
- api_key: str,
58
+ api_key: typing.Optional[str] = os.getenv("SYNC_API_KEY"),
57
59
  timeout: typing.Optional[float] = None,
58
60
  follow_redirects: typing.Optional[bool] = True,
59
61
  httpx_client: typing.Optional[httpx.Client] = None,
@@ -61,6 +63,8 @@ class Sync:
61
63
  _defaulted_timeout = (
62
64
  timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
63
65
  )
66
+ if api_key is None:
67
+ raise ApiError(body="The client must be instantiated be either passing in api_key or setting SYNC_API_KEY")
64
68
  self._client_wrapper = SyncClientWrapper(
65
69
  base_url=_get_base_url(base_url=base_url, environment=environment),
66
70
  api_key=api_key,
@@ -93,7 +97,7 @@ class AsyncSync:
93
97
 
94
98
 
95
99
 
96
- api_key : str
100
+ api_key : typing.Optional[str]
97
101
  timeout : typing.Optional[float]
98
102
  The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
99
103
 
@@ -117,7 +121,7 @@ class AsyncSync:
117
121
  *,
118
122
  base_url: typing.Optional[str] = None,
119
123
  environment: SyncEnvironment = SyncEnvironment.DEFAULT,
120
- api_key: str,
124
+ api_key: typing.Optional[str] = os.getenv("SYNC_API_KEY"),
121
125
  timeout: typing.Optional[float] = None,
122
126
  follow_redirects: typing.Optional[bool] = True,
123
127
  httpx_client: typing.Optional[httpx.AsyncClient] = None,
@@ -125,6 +129,8 @@ class AsyncSync:
125
129
  _defaulted_timeout = (
126
130
  timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
127
131
  )
132
+ if api_key is None:
133
+ raise ApiError(body="The client must be instantiated be either passing in api_key or setting SYNC_API_KEY")
128
134
  self._client_wrapper = AsyncClientWrapper(
129
135
  base_url=_get_base_url(base_url=base_url, environment=environment),
130
136
  api_key=api_key,
@@ -25,6 +25,11 @@ class Generation(UncheckedBaseModel):
25
25
  The error message if the generation failed.
26
26
  """
27
27
 
28
+ error_code: typing.Optional[str] = pydantic.Field(default=None)
29
+ """
30
+ The error code if the generation failed.
31
+ """
32
+
28
33
  id: GenerationId
29
34
  input: typing.List[Input] = pydantic.Field()
30
35
  """
@@ -14,10 +14,10 @@ class BaseClientWrapper:
14
14
 
15
15
  def get_headers(self) -> typing.Dict[str, str]:
16
16
  headers: typing.Dict[str, str] = {
17
- "User-Agent": "syncsdk/0.2.0",
17
+ "User-Agent": "syncsdk/0.2.2",
18
18
  "X-Fern-Language": "Python",
19
19
  "X-Fern-SDK-Name": "syncsdk",
20
- "X-Fern-SDK-Version": "0.2.0",
20
+ "X-Fern-SDK-Version": "0.2.2",
21
21
  }
22
22
  headers["x-api-key"] = self.api_key
23
23
  return headers
@@ -37,6 +37,11 @@ class GenerationNotification(UncheckedBaseModel):
37
37
  error message if the generation failed
38
38
  """
39
39
 
40
+ error_code: typing.Optional[str] = pydantic.Field(default=None)
41
+ """
42
+ error code if the generation failed
43
+ """
44
+
40
45
  options: typing.Optional[GenerationOptions] = pydantic.Field(default=None)
41
46
  """
42
47
  options used for the generation
File without changes
File without changes
File without changes
File without changes
File without changes