speechweave 1.0.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.
@@ -0,0 +1,43 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+ id-token: write
12
+
13
+ jobs:
14
+ publish:
15
+ runs-on: ubuntu-latest
16
+ environment: production
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Setup Python
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.12"
25
+
26
+ - name: Install dependencies
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ pip install build ".[dev]"
30
+
31
+ - name: Lint
32
+ run: |
33
+ ruff check .
34
+ ruff format --check .
35
+
36
+ - name: Test
37
+ run: pytest
38
+
39
+ - name: Build distributions
40
+ run: python -m build
41
+
42
+ - name: Publish to PyPI
43
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,16 @@
1
+ .venv/
2
+ dist/
3
+ build/
4
+ *.egg-info/
5
+ src/*.egg-info/
6
+ __pycache__/
7
+ *.pyc
8
+ .pytest_cache/
9
+ .mypy_cache/
10
+ .ruff_cache/
11
+ .coverage
12
+ htmlcov/
13
+ coverage/
14
+ .DS_Store
15
+ *.log
16
+ .env*
@@ -0,0 +1,12 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.15.21
4
+ hooks:
5
+ - id: ruff
6
+ args: [ --fix ]
7
+ - id: ruff-format
8
+ - repo: https://github.com/pre-commit/mirrors-mypy
9
+ rev: v1.10.0
10
+ hooks:
11
+ - id: mypy
12
+ additional_dependencies: [ types-requests ]
@@ -0,0 +1,6 @@
1
+ {
2
+ "[python]": {
3
+ "editor.defaultFormatter": "charliermarsh.ruff",
4
+ "editor.formatOnSave": true
5
+ }
6
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SpeechWeave
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.
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.4
2
+ Name: speechweave
3
+ Version: 1.0.0
4
+ Summary: Official SpeechWeave Python SDK
5
+ Project-URL: Homepage, https://github.com/speechweave/speechweave-python
6
+ Project-URL: Documentation, https://speechweave.com/docs
7
+ Project-URL: Issues, https://github.com/speechweave/speechweave-python/issues
8
+ Author-email: David Rae <david@speechweave.com>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: httpx>=0.24.0
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
23
+ Requires-Dist: pytest>=7.0; extra == 'dev'
24
+ Requires-Dist: ruff>=0.8; extra == 'dev'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # SpeechWeave Python SDK
28
+
29
+ [![PyPI version](https://img.shields.io/pypi/v/speechweave.svg)](https://pypi.org/project/speechweave/)
30
+ [![Python versions](https://img.shields.io/pypi/pyversions/speechweave.svg)](https://pypi.org/project/speechweave/)
31
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
32
+
33
+ The native Python SDK for SpeechWeave — background job polling, presigned uploads, and webhook verification. Python 3.10+.
34
+
35
+ **Docs:** [speechweave.com/docs](https://speechweave.com/docs) · [API reference](https://speechweave.com/docs/api)
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ pip install speechweave
41
+ ```
42
+
43
+ Set your API key:
44
+
45
+ ```bash
46
+ export SPEECHWEAVE_API_KEY="sk_..."
47
+ ```
48
+
49
+ ## Quick start
50
+
51
+ ```python
52
+ from speechweave import SpeechWeave, wait_for_job
53
+
54
+ client = SpeechWeave()
55
+
56
+ with open("audio.wav", "rb") as f:
57
+ job = client.transcribe_file(
58
+ f,
59
+ filename="audio.wav",
60
+ model="core",
61
+ language="en",
62
+ )
63
+
64
+ result = wait_for_job(client, job["id"], timeout_sec=300)
65
+ print(result["transcript"])
66
+ ```
67
+
68
+ For `jobs.create`, URL input, cancel, and other job operations, see the [API reference](https://speechweave.com/docs/api).
69
+
70
+ ## Async
71
+
72
+ ```python
73
+ import asyncio
74
+ from speechweave import AsyncSpeechWeave, async_wait_for_job
75
+
76
+ async def main():
77
+ async with AsyncSpeechWeave() as client:
78
+ with open("audio.wav", "rb") as f:
79
+ job = await client.transcribe_file(
80
+ f,
81
+ filename="audio.wav",
82
+ model="core",
83
+ )
84
+
85
+ result = await async_wait_for_job(client, job["id"])
86
+ print(result["transcript"])
87
+
88
+ asyncio.run(main())
89
+ ```
90
+
91
+ ## Webhooks
92
+
93
+ ```python
94
+ from speechweave import verify_webhook
95
+
96
+ result = verify_webhook(
97
+ secret=WEBHOOK_SECRET,
98
+ raw_body=raw_body,
99
+ signature_header=signature_header,
100
+ )
101
+ ```
102
+
103
+ See the [docs](https://speechweave.com/docs) for a full FastAPI example.
104
+
105
+ ## Errors
106
+
107
+ ```python
108
+ from speechweave import SpeechWeave, SpeechWeaveError
109
+
110
+ try:
111
+ client = SpeechWeave(api_key="bad_key")
112
+ client.get_job("job_123")
113
+ except SpeechWeaveError as e:
114
+ print(e.status)
115
+ print(e.code)
116
+ ```
117
+
118
+ ## Configuration
119
+
120
+ - `api_key` — or set `SPEECHWEAVE_API_KEY`
121
+ - `base_url` — defaults to `https://api.speechweave.com/v1`
122
+ - `timeout` — httpx timeout in seconds (default `120`)
123
+
124
+ ## Compatibility & Migration
125
+
126
+ If you are building a new application, use the native SDK above for full feature support. If you have an existing OpenAI, Deepgram, or AssemblyAI codebase, use the options below to switch with minimal changes.
127
+
128
+ ### Drop-in usage
129
+
130
+ Convenience helpers if you want OpenAI/Deepgram/AssemblyAI response shapes without adding another package. They use presigned uploads like the native API.
131
+
132
+ ```python
133
+ from speechweave import SpeechWeave
134
+
135
+ client = SpeechWeave()
136
+
137
+ with open("clip.mp3", "rb") as f:
138
+ result = client.audio.transcriptions.create(
139
+ file=f,
140
+ filename="clip.mp3",
141
+ model="core",
142
+ )
143
+
144
+ print(result["text"])
145
+ ```
146
+
147
+ More examples: [OpenAI](https://speechweave.com/docs/migration/openai) · [Deepgram](https://speechweave.com/docs/migration/deepgram) · [AssemblyAI](https://speechweave.com/docs/migration/assemblyai)
148
+
149
+ ### Migrating from OpenAI
150
+
151
+ You don't need this SDK for a quick swap — use the official `openai` package and point it at SpeechWeave:
152
+
153
+ ```python
154
+ from openai import OpenAI
155
+
156
+ client = OpenAI(
157
+ api_key="sk_live_...",
158
+ base_url="https://api.speechweave.com/v1",
159
+ )
160
+
161
+ with open("clip.mp3", "rb") as f:
162
+ result = client.audio.transcriptions.create(model="core", file=f)
163
+
164
+ print(result.text)
165
+ ```
166
+
167
+ OpenAI model names like `whisper-1` are aliased to `core` on our backend. See the [OpenAI migration guide](https://speechweave.com/docs/migration/openai).
@@ -0,0 +1,141 @@
1
+ # SpeechWeave Python SDK
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/speechweave.svg)](https://pypi.org/project/speechweave/)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/speechweave.svg)](https://pypi.org/project/speechweave/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ The native Python SDK for SpeechWeave — background job polling, presigned uploads, and webhook verification. Python 3.10+.
8
+
9
+ **Docs:** [speechweave.com/docs](https://speechweave.com/docs) · [API reference](https://speechweave.com/docs/api)
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pip install speechweave
15
+ ```
16
+
17
+ Set your API key:
18
+
19
+ ```bash
20
+ export SPEECHWEAVE_API_KEY="sk_..."
21
+ ```
22
+
23
+ ## Quick start
24
+
25
+ ```python
26
+ from speechweave import SpeechWeave, wait_for_job
27
+
28
+ client = SpeechWeave()
29
+
30
+ with open("audio.wav", "rb") as f:
31
+ job = client.transcribe_file(
32
+ f,
33
+ filename="audio.wav",
34
+ model="core",
35
+ language="en",
36
+ )
37
+
38
+ result = wait_for_job(client, job["id"], timeout_sec=300)
39
+ print(result["transcript"])
40
+ ```
41
+
42
+ For `jobs.create`, URL input, cancel, and other job operations, see the [API reference](https://speechweave.com/docs/api).
43
+
44
+ ## Async
45
+
46
+ ```python
47
+ import asyncio
48
+ from speechweave import AsyncSpeechWeave, async_wait_for_job
49
+
50
+ async def main():
51
+ async with AsyncSpeechWeave() as client:
52
+ with open("audio.wav", "rb") as f:
53
+ job = await client.transcribe_file(
54
+ f,
55
+ filename="audio.wav",
56
+ model="core",
57
+ )
58
+
59
+ result = await async_wait_for_job(client, job["id"])
60
+ print(result["transcript"])
61
+
62
+ asyncio.run(main())
63
+ ```
64
+
65
+ ## Webhooks
66
+
67
+ ```python
68
+ from speechweave import verify_webhook
69
+
70
+ result = verify_webhook(
71
+ secret=WEBHOOK_SECRET,
72
+ raw_body=raw_body,
73
+ signature_header=signature_header,
74
+ )
75
+ ```
76
+
77
+ See the [docs](https://speechweave.com/docs) for a full FastAPI example.
78
+
79
+ ## Errors
80
+
81
+ ```python
82
+ from speechweave import SpeechWeave, SpeechWeaveError
83
+
84
+ try:
85
+ client = SpeechWeave(api_key="bad_key")
86
+ client.get_job("job_123")
87
+ except SpeechWeaveError as e:
88
+ print(e.status)
89
+ print(e.code)
90
+ ```
91
+
92
+ ## Configuration
93
+
94
+ - `api_key` — or set `SPEECHWEAVE_API_KEY`
95
+ - `base_url` — defaults to `https://api.speechweave.com/v1`
96
+ - `timeout` — httpx timeout in seconds (default `120`)
97
+
98
+ ## Compatibility & Migration
99
+
100
+ If you are building a new application, use the native SDK above for full feature support. If you have an existing OpenAI, Deepgram, or AssemblyAI codebase, use the options below to switch with minimal changes.
101
+
102
+ ### Drop-in usage
103
+
104
+ Convenience helpers if you want OpenAI/Deepgram/AssemblyAI response shapes without adding another package. They use presigned uploads like the native API.
105
+
106
+ ```python
107
+ from speechweave import SpeechWeave
108
+
109
+ client = SpeechWeave()
110
+
111
+ with open("clip.mp3", "rb") as f:
112
+ result = client.audio.transcriptions.create(
113
+ file=f,
114
+ filename="clip.mp3",
115
+ model="core",
116
+ )
117
+
118
+ print(result["text"])
119
+ ```
120
+
121
+ More examples: [OpenAI](https://speechweave.com/docs/migration/openai) · [Deepgram](https://speechweave.com/docs/migration/deepgram) · [AssemblyAI](https://speechweave.com/docs/migration/assemblyai)
122
+
123
+ ### Migrating from OpenAI
124
+
125
+ You don't need this SDK for a quick swap — use the official `openai` package and point it at SpeechWeave:
126
+
127
+ ```python
128
+ from openai import OpenAI
129
+
130
+ client = OpenAI(
131
+ api_key="sk_live_...",
132
+ base_url="https://api.speechweave.com/v1",
133
+ )
134
+
135
+ with open("clip.mp3", "rb") as f:
136
+ result = client.audio.transcriptions.create(model="core", file=f)
137
+
138
+ print(result.text)
139
+ ```
140
+
141
+ OpenAI model names like `whisper-1` are aliased to `core` on our backend. See the [OpenAI migration guide](https://speechweave.com/docs/migration/openai).
@@ -0,0 +1,54 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "speechweave"
7
+ dynamic = ["version"]
8
+ description = "Official SpeechWeave Python SDK"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "David Rae", email = "david@speechweave.com" }
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 5 - Production/Stable",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ ]
25
+ dependencies = [
26
+ "httpx>=0.24.0",
27
+ ]
28
+
29
+ [project.optional-dependencies]
30
+ dev = [
31
+ "pytest>=7.0",
32
+ "pytest-asyncio>=0.21",
33
+ "ruff>=0.8",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/speechweave/speechweave-python"
38
+ Documentation = "https://speechweave.com/docs"
39
+ Issues = "https://github.com/speechweave/speechweave-python/issues"
40
+
41
+ [tool.hatch.version]
42
+ path = "src/speechweave/version.py"
43
+
44
+ [tool.pytest.ini_options]
45
+ asyncio_mode = "auto"
46
+ testpaths = ["tests"]
47
+
48
+ [tool.ruff]
49
+ # Relax the line length for better readability (default is 88)
50
+ line-length = 120
51
+
52
+ [tool.ruff.format]
53
+ indent-style = "tab"
54
+ quote-style = "double"
@@ -0,0 +1,65 @@
1
+ from speechweave.version import __version__
2
+ from speechweave.async_client import AsyncSpeechWeaveClient
3
+ from speechweave.client import SpeechWeaveClient
4
+ from speechweave.errors import SpeechWeaveError
5
+ from speechweave.namespaces.assembly_compat import AssemblyTranscripts, AsyncAssemblyTranscripts
6
+ from speechweave.namespaces.deepgram_compat import AsyncDeepgramListen, DeepgramListen
7
+ from speechweave.namespaces.jobs import AsyncJobs, Jobs
8
+ from speechweave.namespaces.openai_compat import AsyncOpenAiAudio, OpenAiAudio
9
+ from speechweave.polling import async_wait_for_job, wait_for_job
10
+ from speechweave.webhooks import verify_webhook
11
+
12
+
13
+ class SpeechWeave(SpeechWeaveClient):
14
+ def __init__(
15
+ self,
16
+ *args,
17
+ **kwargs,
18
+ ):
19
+
20
+ super().__init__(
21
+ *args,
22
+ **kwargs,
23
+ )
24
+ self.audio = OpenAiAudio(self)
25
+ self.listen = DeepgramListen(self)
26
+ self.transcripts = AssemblyTranscripts(self)
27
+ self.jobs = Jobs(self)
28
+
29
+
30
+ class AsyncSpeechWeave(AsyncSpeechWeaveClient):
31
+ def __init__(
32
+ self,
33
+ *args,
34
+ **kwargs,
35
+ ):
36
+
37
+ super().__init__(
38
+ *args,
39
+ **kwargs,
40
+ )
41
+ self.audio = AsyncOpenAiAudio(self)
42
+ self.listen = AsyncDeepgramListen(self)
43
+ self.transcripts = AsyncAssemblyTranscripts(self)
44
+ self.jobs = AsyncJobs(self)
45
+
46
+
47
+ __all__ = [
48
+ "AsyncAssemblyTranscripts",
49
+ "AsyncDeepgramListen",
50
+ "AsyncJobs",
51
+ "AsyncOpenAiAudio",
52
+ "AsyncSpeechWeave",
53
+ "AsyncSpeechWeaveClient",
54
+ "AssemblyTranscripts",
55
+ "DeepgramListen",
56
+ "Jobs",
57
+ "OpenAiAudio",
58
+ "SpeechWeave",
59
+ "SpeechWeaveClient",
60
+ "SpeechWeaveError",
61
+ "__version__",
62
+ "async_wait_for_job",
63
+ "verify_webhook",
64
+ "wait_for_job",
65
+ ]