diffio 0.1.0__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.
diffio-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Diffio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
diffio-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,234 @@
1
+ Metadata-Version: 2.4
2
+ Name: diffio
3
+ Version: 0.1.0
4
+ Summary: Python SDK for the Diffio API.
5
+ Author: Diffio
6
+ License: MIT
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: httpx>=0.24.0
20
+ Provides-Extra: dev
21
+ Requires-Dist: build>=1.0; extra == "dev"
22
+ Requires-Dist: pytest>=7.4; extra == "dev"
23
+ Requires-Dist: twine>=5.0; extra == "dev"
24
+ Dynamic: license-file
25
+
26
+ # Diffio Python SDK
27
+
28
+ The Diffio Python SDK helps you call the Diffio API from Python. This version covers project creation, upload, generation, progress checks, and download URLs.
29
+ Requires Python 3.8 or later.
30
+
31
+ ## Install
32
+
33
+ ```bash
34
+ pip install diffio
35
+ ```
36
+
37
+ For local development:
38
+
39
+ ```bash
40
+ cd diffio-python
41
+ pip install -e .
42
+ ```
43
+
44
+ ## Configuration
45
+
46
+ Set the API key with `DIFFIO_API_KEY`. You can also override the base URL with `DIFFIO_API_BASE_URL`.
47
+
48
+ ```bash
49
+ export DIFFIO_API_KEY="diffio_live_..."
50
+ export DIFFIO_API_BASE_URL="https://us-central1-diffioai.cloudfunctions.net"
51
+ ```
52
+
53
+ For emulators, set the base URL to the Functions emulator host.
54
+
55
+ ```bash
56
+ export DIFFIO_API_BASE_URL="http://127.0.0.1:5001/diffioai/us-central1"
57
+ ```
58
+
59
+ ## Request options
60
+
61
+ Use request options to override headers, timeouts, retries, or the API key per request.
62
+ You can also pass `timeoutInSeconds` as an alias for `timeout`.
63
+
64
+ ```py
65
+ from diffio import DiffioClient, RequestOptions
66
+
67
+ client = DiffioClient(apiKey="diffio_live_...")
68
+ projects = client.list_projects(
69
+ requestOptions=RequestOptions(
70
+ headers={"X-Debug": "1"},
71
+ timeout=30.0,
72
+ maxRetries=2,
73
+ retryBackoff=0.5,
74
+ )
75
+ )
76
+ ```
77
+
78
+ ## Create a project and generation
79
+
80
+ `create_project` uploads the file and returns the project metadata.
81
+
82
+ ```py
83
+ from diffio import DiffioClient
84
+
85
+ client = DiffioClient(apiKey="diffio_live_...")
86
+ file_path = "sample.wav"
87
+ project = client.create_project(
88
+ filePath=file_path,
89
+ )
90
+
91
+ generation = client.create_generation(
92
+ apiProjectId=project.apiProjectId,
93
+ model="diffio-2",
94
+ sampling={"steps": 12, "guidance": 1.5},
95
+ )
96
+
97
+ print(generation.generationId)
98
+ ```
99
+
100
+ ## Audio isolation helper
101
+
102
+ ```py
103
+ from diffio import DiffioClient
104
+
105
+ client = DiffioClient(apiKey="diffio_live_...")
106
+ result = client.audio_isolation.isolate(
107
+ filePath="sample.wav",
108
+ model="diffio-2",
109
+ sampling={"steps": 12, "guidance": 1.5},
110
+ )
111
+
112
+ print(result.generation.generationId)
113
+ ```
114
+
115
+ ## Restore audio in one call
116
+
117
+ This helper runs the full flow and returns the downloaded bytes plus a metadata dict.
118
+
119
+ ```py
120
+ from diffio import DiffioClient
121
+
122
+ client = DiffioClient(apiKey="diffio_live_...")
123
+ audio_bytes, info = client.restore_audio(
124
+ filePath="sample.wav",
125
+ model="diffio-2",
126
+ sampling={"steps": 12, "guidance": 1.5},
127
+ onProgress=lambda progress: print(progress.status),
128
+ )
129
+
130
+ if info["error"]:
131
+ print(info["error"])
132
+ else:
133
+ with open("restored.mp3", "wb") as handle:
134
+ handle.write(audio_bytes)
135
+
136
+ print(info["apiProjectId"], info["generationId"])
137
+ ```
138
+
139
+ ## Generation progress
140
+
141
+ ```py
142
+ from diffio import DiffioClient
143
+
144
+ client = DiffioClient(apiKey="diffio_live_...")
145
+ progress = client.generations.get_progress(
146
+ generationId="gen_123",
147
+ apiProjectId="proj_123",
148
+ )
149
+
150
+ print(progress.status)
151
+ ```
152
+
153
+ ## Generation download
154
+
155
+ ```py
156
+ from diffio import DiffioClient
157
+
158
+ client = DiffioClient(apiKey="diffio_live_...")
159
+ download = client.generations.download(
160
+ generationId="gen_123",
161
+ apiProjectId="proj_123",
162
+ downloadType="mp3",
163
+ downloadFilePath="restored.mp3",
164
+ )
165
+
166
+ print(download.downloadUrl)
167
+ ```
168
+
169
+ If you only need the URL, use `client.generations.get_download`.
170
+
171
+ ## List projects
172
+
173
+ ```py
174
+ from diffio import DiffioClient
175
+
176
+ client = DiffioClient(apiKey="diffio_live_...")
177
+ projects = client.projects.list()
178
+
179
+ for project in projects.projects:
180
+ print(project.apiProjectId, project.status)
181
+ ```
182
+
183
+ ## List project generations
184
+
185
+ ```py
186
+ from diffio import DiffioClient
187
+
188
+ client = DiffioClient(apiKey="diffio_live_...")
189
+ generations = client.projects.list_generations(apiProjectId="proj_123")
190
+
191
+ for generation in generations.generations:
192
+ print(generation.generationId, generation.status)
193
+ ```
194
+
195
+ ## Webhooks portal access
196
+
197
+ ```py
198
+ from diffio import DiffioClient
199
+
200
+ client = DiffioClient(apiKey="diffio_live_...")
201
+ portal = client.webhooks.get_portal_access(mode="test")
202
+ print(portal.portalUrl)
203
+ ```
204
+
205
+ ## Send a test webhook event
206
+
207
+ ```py
208
+ from diffio import DiffioClient
209
+
210
+ client = DiffioClient(apiKey="diffio_live_...")
211
+ event = client.webhooks.send_test_event(
212
+ eventType="generation.completed",
213
+ mode="test",
214
+ samplePayload={"apiProjectId": "proj_123"},
215
+ )
216
+
217
+ print(event.svixMessageId)
218
+ ```
219
+
220
+ ## Tutorials
221
+
222
+ * Audio restoration CLI tutorial: `tutorials/audio-restoration-cli/README.md`
223
+
224
+ ## Runtime compatibility
225
+
226
+ Use Python 3.8 or later.
227
+
228
+ ## Tests
229
+
230
+ ```bash
231
+ cd diffio-python
232
+ python -m pip install -r requirements-dev.txt
233
+ python -m pytest
234
+ ```
diffio-0.1.0/README.md ADDED
@@ -0,0 +1,209 @@
1
+ # Diffio Python SDK
2
+
3
+ The Diffio Python SDK helps you call the Diffio API from Python. This version covers project creation, upload, generation, progress checks, and download URLs.
4
+ Requires Python 3.8 or later.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ pip install diffio
10
+ ```
11
+
12
+ For local development:
13
+
14
+ ```bash
15
+ cd diffio-python
16
+ pip install -e .
17
+ ```
18
+
19
+ ## Configuration
20
+
21
+ Set the API key with `DIFFIO_API_KEY`. You can also override the base URL with `DIFFIO_API_BASE_URL`.
22
+
23
+ ```bash
24
+ export DIFFIO_API_KEY="diffio_live_..."
25
+ export DIFFIO_API_BASE_URL="https://us-central1-diffioai.cloudfunctions.net"
26
+ ```
27
+
28
+ For emulators, set the base URL to the Functions emulator host.
29
+
30
+ ```bash
31
+ export DIFFIO_API_BASE_URL="http://127.0.0.1:5001/diffioai/us-central1"
32
+ ```
33
+
34
+ ## Request options
35
+
36
+ Use request options to override headers, timeouts, retries, or the API key per request.
37
+ You can also pass `timeoutInSeconds` as an alias for `timeout`.
38
+
39
+ ```py
40
+ from diffio import DiffioClient, RequestOptions
41
+
42
+ client = DiffioClient(apiKey="diffio_live_...")
43
+ projects = client.list_projects(
44
+ requestOptions=RequestOptions(
45
+ headers={"X-Debug": "1"},
46
+ timeout=30.0,
47
+ maxRetries=2,
48
+ retryBackoff=0.5,
49
+ )
50
+ )
51
+ ```
52
+
53
+ ## Create a project and generation
54
+
55
+ `create_project` uploads the file and returns the project metadata.
56
+
57
+ ```py
58
+ from diffio import DiffioClient
59
+
60
+ client = DiffioClient(apiKey="diffio_live_...")
61
+ file_path = "sample.wav"
62
+ project = client.create_project(
63
+ filePath=file_path,
64
+ )
65
+
66
+ generation = client.create_generation(
67
+ apiProjectId=project.apiProjectId,
68
+ model="diffio-2",
69
+ sampling={"steps": 12, "guidance": 1.5},
70
+ )
71
+
72
+ print(generation.generationId)
73
+ ```
74
+
75
+ ## Audio isolation helper
76
+
77
+ ```py
78
+ from diffio import DiffioClient
79
+
80
+ client = DiffioClient(apiKey="diffio_live_...")
81
+ result = client.audio_isolation.isolate(
82
+ filePath="sample.wav",
83
+ model="diffio-2",
84
+ sampling={"steps": 12, "guidance": 1.5},
85
+ )
86
+
87
+ print(result.generation.generationId)
88
+ ```
89
+
90
+ ## Restore audio in one call
91
+
92
+ This helper runs the full flow and returns the downloaded bytes plus a metadata dict.
93
+
94
+ ```py
95
+ from diffio import DiffioClient
96
+
97
+ client = DiffioClient(apiKey="diffio_live_...")
98
+ audio_bytes, info = client.restore_audio(
99
+ filePath="sample.wav",
100
+ model="diffio-2",
101
+ sampling={"steps": 12, "guidance": 1.5},
102
+ onProgress=lambda progress: print(progress.status),
103
+ )
104
+
105
+ if info["error"]:
106
+ print(info["error"])
107
+ else:
108
+ with open("restored.mp3", "wb") as handle:
109
+ handle.write(audio_bytes)
110
+
111
+ print(info["apiProjectId"], info["generationId"])
112
+ ```
113
+
114
+ ## Generation progress
115
+
116
+ ```py
117
+ from diffio import DiffioClient
118
+
119
+ client = DiffioClient(apiKey="diffio_live_...")
120
+ progress = client.generations.get_progress(
121
+ generationId="gen_123",
122
+ apiProjectId="proj_123",
123
+ )
124
+
125
+ print(progress.status)
126
+ ```
127
+
128
+ ## Generation download
129
+
130
+ ```py
131
+ from diffio import DiffioClient
132
+
133
+ client = DiffioClient(apiKey="diffio_live_...")
134
+ download = client.generations.download(
135
+ generationId="gen_123",
136
+ apiProjectId="proj_123",
137
+ downloadType="mp3",
138
+ downloadFilePath="restored.mp3",
139
+ )
140
+
141
+ print(download.downloadUrl)
142
+ ```
143
+
144
+ If you only need the URL, use `client.generations.get_download`.
145
+
146
+ ## List projects
147
+
148
+ ```py
149
+ from diffio import DiffioClient
150
+
151
+ client = DiffioClient(apiKey="diffio_live_...")
152
+ projects = client.projects.list()
153
+
154
+ for project in projects.projects:
155
+ print(project.apiProjectId, project.status)
156
+ ```
157
+
158
+ ## List project generations
159
+
160
+ ```py
161
+ from diffio import DiffioClient
162
+
163
+ client = DiffioClient(apiKey="diffio_live_...")
164
+ generations = client.projects.list_generations(apiProjectId="proj_123")
165
+
166
+ for generation in generations.generations:
167
+ print(generation.generationId, generation.status)
168
+ ```
169
+
170
+ ## Webhooks portal access
171
+
172
+ ```py
173
+ from diffio import DiffioClient
174
+
175
+ client = DiffioClient(apiKey="diffio_live_...")
176
+ portal = client.webhooks.get_portal_access(mode="test")
177
+ print(portal.portalUrl)
178
+ ```
179
+
180
+ ## Send a test webhook event
181
+
182
+ ```py
183
+ from diffio import DiffioClient
184
+
185
+ client = DiffioClient(apiKey="diffio_live_...")
186
+ event = client.webhooks.send_test_event(
187
+ eventType="generation.completed",
188
+ mode="test",
189
+ samplePayload={"apiProjectId": "proj_123"},
190
+ )
191
+
192
+ print(event.svixMessageId)
193
+ ```
194
+
195
+ ## Tutorials
196
+
197
+ * Audio restoration CLI tutorial: `tutorials/audio-restoration-cli/README.md`
198
+
199
+ ## Runtime compatibility
200
+
201
+ Use Python 3.8 or later.
202
+
203
+ ## Tests
204
+
205
+ ```bash
206
+ cd diffio-python
207
+ python -m pip install -r requirements-dev.txt
208
+ python -m pytest
209
+ ```
@@ -0,0 +1,44 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "diffio"
7
+ version = "0.1.0"
8
+ description = "Python SDK for the Diffio API."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "Diffio" }
14
+ ]
15
+ dependencies = [
16
+ "httpx>=0.24.0"
17
+ ]
18
+ classifiers = [
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3 :: Only",
23
+ "Programming Language :: Python :: 3.8",
24
+ "Programming Language :: Python :: 3.9",
25
+ "Programming Language :: Python :: 3.10",
26
+ "Programming Language :: Python :: 3.11",
27
+ "Programming Language :: Python :: 3.12",
28
+ ]
29
+
30
+ [project.optional-dependencies]
31
+ dev = [
32
+ "build>=1.0",
33
+ "pytest>=7.4",
34
+ "twine>=5.0",
35
+ ]
36
+
37
+ [tool.setuptools]
38
+ package-dir = { "" = "src" }
39
+
40
+ [tool.setuptools.packages.find]
41
+ where = ["src"]
42
+
43
+ [tool.pytest.ini_options]
44
+ testpaths = ["tests"]
diffio-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,59 @@
1
+ from .client import (
2
+ AudioIsolationClient,
3
+ DiffioClient,
4
+ GenerationsClient,
5
+ ProjectsClient,
6
+ RequestOptions,
7
+ WebhooksClient,
8
+ )
9
+ from .errors import DiffioApiError
10
+ from .types import (
11
+ AudioIsolationResult,
12
+ CreateGenerationResponse,
13
+ CreateProjectResponse,
14
+ DownloadType,
15
+ GenerationDownloadResponse,
16
+ GenerationProgressResponse,
17
+ GenerationProgressStage,
18
+ GenerationWebhookEvent,
19
+ GenerationWebhookStatus,
20
+ ListProjectGenerationsResponse,
21
+ ListProjectsResponse,
22
+ ModelKey,
23
+ ProjectGenerationSummary,
24
+ ProjectSummary,
25
+ WebhookEventType,
26
+ WebhookMode,
27
+ WebhookPortalResponse,
28
+ WebhookTestEventResponse,
29
+ )
30
+
31
+ __all__ = [
32
+ "AudioIsolationClient",
33
+ "AudioIsolationResult",
34
+ "CreateGenerationResponse",
35
+ "CreateProjectResponse",
36
+ "DownloadType",
37
+ "DiffioApiError",
38
+ "DiffioClient",
39
+ "GenerationDownloadResponse",
40
+ "GenerationProgressResponse",
41
+ "GenerationProgressStage",
42
+ "GenerationWebhookEvent",
43
+ "GenerationWebhookStatus",
44
+ "GenerationsClient",
45
+ "ListProjectGenerationsResponse",
46
+ "ListProjectsResponse",
47
+ "ModelKey",
48
+ "ProjectGenerationSummary",
49
+ "ProjectSummary",
50
+ "ProjectsClient",
51
+ "RequestOptions",
52
+ "WebhookEventType",
53
+ "WebhookMode",
54
+ "WebhookPortalResponse",
55
+ "WebhookTestEventResponse",
56
+ "WebhooksClient",
57
+ ]
58
+
59
+ __version__ = "0.1.0"