From 67a26df77f17a7f93903560dcdda267bc27c0f0b Mon Sep 17 00:00:00 2001 From: James Ding Date: Tue, 16 Dec 2025 18:27:39 -0600 Subject: [PATCH 1/7] chore(deps): add ty package version 0.0.2 to dependencies --- pyproject.toml | 1 + uv.lock | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 8d2691f..e43fdb5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,7 @@ dev = [ "pytest-rerunfailures>=16.0.1", "python-dotenv>=1.0.1", "ruff>=0.14.3", + "ty>=0.0.2", ] [[tool.pydoc-markdown.loaders]] diff --git a/uv.lock b/uv.lock index b802282..5601e7e 100644 --- a/uv.lock +++ b/uv.lock @@ -680,6 +680,7 @@ dev = [ { name = "pytest-rerunfailures", version = "16.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, { name = "python-dotenv" }, { name = "ruff" }, + { name = "ty" }, ] [package.metadata] @@ -703,6 +704,7 @@ dev = [ { name = "pytest-rerunfailures", specifier = ">=16.0.1" }, { name = "python-dotenv", specifier = ">=1.0.1" }, { name = "ruff", specifier = ">=0.14.3" }, + { name = "ty", specifier = ">=0.0.2" }, ] [[package]] @@ -1899,6 +1901,31 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/c7/18/c86eb8e0202e32dd3df50d43d7ff9854f8e0603945ff398974c1d91ac1ef/tomli_w-1.2.0-py3-none-any.whl", hash = "sha256:188306098d013b691fcadc011abd66727d3c414c571bb01b1a174ba8c983cf90", size = 6675, upload-time = "2025-01-15T12:07:22.074Z" }, ] +[[package]] +name = "ty" +version = "0.0.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/47/e5/15b6aceefcd64b53997fe2002b6fa055f0b1afd23ff6fc3f55f3da944530/ty-0.0.2.tar.gz", hash = "sha256:e02dc50b65dc58d6cb8e8b0d563833f81bf03ed8a7d0b15c6396d486489a7e1d", size = 4762024, upload-time = "2025-12-16T20:13:41.07Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/6b/86/65d4826677d966cf226662767a4a597ebb4b02c432f413673c8d5d3d1ce8/ty-0.0.2-py3-none-linux_armv6l.whl", hash = "sha256:0954a0e0b6f7e06229dd1da3a9989ee9b881a26047139a88eb7c134c585ad22e", size = 9771409, upload-time = "2025-12-16T20:13:28.964Z" }, + { url = "https://files.pythonhosted.org/packages/d4/bc/6ab06b7c109cec608c24ea182cc8b4714e746a132f70149b759817092665/ty-0.0.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:d6044b491d66933547033cecc87cb7eb599ba026a3ef347285add6b21107a648", size = 9580025, upload-time = "2025-12-16T20:13:34.507Z" }, + { url = "https://files.pythonhosted.org/packages/54/de/d826804e304b2430f17bb27ae15bcf02380e7f67f38b5033047e3d2523e6/ty-0.0.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:fbca7f08e671a35229f6f400d73da92e2dc0a440fba53a74fe8233079a504358", size = 9098660, upload-time = "2025-12-16T20:13:01.278Z" }, + { url = "https://files.pythonhosted.org/packages/b7/8e/5cd87944ceee02bb0826f19ced54e30c6bb971e985a22768f6be6b1a042f/ty-0.0.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3abd61153dac0b93b284d305e6f96085013a25c3a7ab44e988d24f0a5fcce729", size = 9567693, upload-time = "2025-12-16T20:13:12.559Z" }, + { url = "https://files.pythonhosted.org/packages/c6/b1/062aab2c62c5ae01c05d27b97ba022d9ff66f14a3cb9030c5ad1dca797ec/ty-0.0.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:21a9f28caafb5742e7d594104e2fe2ebd64590da31aed4745ae8bc5be67a7b85", size = 9556471, upload-time = "2025-12-16T20:13:07.771Z" }, + { url = "https://files.pythonhosted.org/packages/0e/07/856f6647a9dd6e36560d182d35d3b5fb21eae98a8bfb516cd879d0e509f3/ty-0.0.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d3ec63fd23ab48e0f838fb54a47ec362a972ee80979169a7edfa6f5c5034849d", size = 9971914, upload-time = "2025-12-16T20:13:18.852Z" }, + { url = "https://files.pythonhosted.org/packages/2e/82/c2e3957dbf33a23f793a9239cfd8bd04b6defd999bd0f6e74d6a5afb9f42/ty-0.0.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:e5e2e0293a259c9a53f668c9c13153cc2f1403cb0fe2b886ca054be4ac76517c", size = 10840905, upload-time = "2025-12-16T20:13:37.098Z" }, + { url = "https://files.pythonhosted.org/packages/3b/17/49bd74e3d577e6c88b8074581b7382f532a9d40552cc7c48ceaa83f1d950/ty-0.0.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fd2511ac02a83d0dc45d4570c7e21ec0c919be7a7263bad9914800d0cde47817", size = 10570251, upload-time = "2025-12-16T20:13:10.319Z" }, + { url = "https://files.pythonhosted.org/packages/2b/9b/26741834069722033a1a0963fcbb63ea45925c6697357e64e361753c6166/ty-0.0.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c482bfbfb8ad18b2e62427d02a0c934ac510c414188a3cf00e16b8acc35482f0", size = 10369078, upload-time = "2025-12-16T20:13:20.851Z" }, + { url = "https://files.pythonhosted.org/packages/94/fc/1d34ec891900d9337169ff9f8252fcaa633ae5c4d36b67effd849ed4f9ac/ty-0.0.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eb514711eed3f56d7a130d4885f4b5d8e490fdcd2adac098e5cf175573a0dda3", size = 10121064, upload-time = "2025-12-16T20:13:23.095Z" }, + { url = "https://files.pythonhosted.org/packages/e5/02/e640325956172355ef8deb9b08d991f229230bf9d07f1dbda8c6665a3a43/ty-0.0.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b2c37fa26c39e9fbed7c73645ba721968ab44f28b2bfe2f79a4e15965a1c426f", size = 9553817, upload-time = "2025-12-16T20:13:27.057Z" }, + { url = "https://files.pythonhosted.org/packages/35/13/c93d579ece84895da9b0aae5d34d84100bbff63ad9f60c906a533a087175/ty-0.0.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:13b264833ac5f3b214693fca38e380e78ee7327e09beaa5ff2e47d75fcab9692", size = 9577512, upload-time = "2025-12-16T20:13:16.956Z" }, + { url = "https://files.pythonhosted.org/packages/85/53/93ab1570adc799cd9120ea187d5b4c00d821e86eca069943b179fe0d3e83/ty-0.0.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:08658d6dbbf8bdef80c0a77eda56a22ab6737002ba129301b7bbd36bcb7acd75", size = 9692726, upload-time = "2025-12-16T20:13:31.169Z" }, + { url = "https://files.pythonhosted.org/packages/9a/07/5fff5335858a14196776207d231c32e23e48a5c912a7d52c80e7a3fa6f8f/ty-0.0.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:4a21b5b012061cb13d47edfff6be70052694308dba633b4c819b70f840e6c158", size = 10213996, upload-time = "2025-12-16T20:13:14.606Z" }, + { url = "https://files.pythonhosted.org/packages/a0/d3/896b1439ab765c57a8d732f73c105ec41142c417a582600638385c2bee85/ty-0.0.2-py3-none-win32.whl", hash = "sha256:d773fdad5d2b30f26313204e6b191cdd2f41ab440a6c241fdb444f8c6593c288", size = 9204906, upload-time = "2025-12-16T20:13:25.099Z" }, + { url = "https://files.pythonhosted.org/packages/5d/0a/f30981e7d637f78e3d08e77d63b818752d23db1bc4b66f9e82e2cb3d34f8/ty-0.0.2-py3-none-win_amd64.whl", hash = "sha256:d1c9ac78a8aa60d0ce89acdccf56c3cc0fcb2de07f1ecf313754d83518e8e8c5", size = 10066640, upload-time = "2025-12-16T20:13:04.045Z" }, + { url = "https://files.pythonhosted.org/packages/5a/c4/97958503cf62bfb7908d2a77b03b91a20499a7ff405f5a098c4989589f34/ty-0.0.2-py3-none-win_arm64.whl", hash = "sha256:fbdef644ade0cd4420c4ec14b604b7894cefe77bfd8659686ac2f6aba9d1a306", size = 9572022, upload-time = "2025-12-16T20:13:39.189Z" }, +] + [[package]] name = "typeapi" version = "2.3.0" From a7635c9282c9b299a44ffa3e899a36109434e6e1 Mon Sep 17 00:00:00 2001 From: James Ding Date: Tue, 16 Dec 2025 19:08:00 -0600 Subject: [PATCH 2/7] chore: update type hints and add typing-extensions dependency --- pyproject.toml | 5 +++++ src/fish_audio_sdk/io.py | 4 ++-- src/fishaudio/utils/play.py | 4 ++-- src/fishaudio/utils/save.py | 2 +- uv.lock | 4 ++++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e43fdb5..965a282 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,7 @@ dependencies = [ "ormsgpack>=1.5.0", "pydantic>=2.9.1", "httpx-ws>=0.6.2", + "typing-extensions>=4.15.0", ] requires-python = ">=3.9" readme = "README.md" @@ -55,6 +56,7 @@ asyncio_mode = "auto" [dependency-groups] dev = [ + "fish-audio-sdk[utils]", "mypy>=1.14.1", "pydoc-markdown>=4.8.2", "pytest>=8.3.5", @@ -81,3 +83,6 @@ pages = [ {title = "Utils", name="fishaudio/utils", contents = ["fishaudio.utils.*"] }, {title = "Exceptions", name="fishaudio/exceptions", contents = ["fishaudio.exceptions.*"] }, ] + +[tool.uv.sources] +fish-audio-sdk = { workspace = true } diff --git a/src/fish_audio_sdk/io.py b/src/fish_audio_sdk/io.py index f03f60d..5000ff3 100644 --- a/src/fish_audio_sdk/io.py +++ b/src/fish_audio_sdk/io.py @@ -6,13 +6,13 @@ AsyncGenerator, Awaitable, Callable, - Concatenate, Generator, Generic, - ParamSpec, TypeVar, ) +from typing_extensions import Concatenate, ParamSpec + import httpx import httpx._client import httpx._types diff --git a/src/fishaudio/utils/play.py b/src/fishaudio/utils/play.py index 685918b..5ab1403 100644 --- a/src/fishaudio/utils/play.py +++ b/src/fishaudio/utils/play.py @@ -51,13 +51,13 @@ def play( ``` """ # Consolidate iterator to bytes - if isinstance(audio, Iterator): + if not isinstance(audio, bytes): audio = b"".join(audio) # Notebook mode if notebook: try: - from IPython.display import Audio, display + from IPython.display import Audio, display # ty: ignore[unresolved-import] display(Audio(audio, rate=44100, autoplay=True)) return diff --git a/src/fishaudio/utils/save.py b/src/fishaudio/utils/save.py index 29d309d..2a206f4 100644 --- a/src/fishaudio/utils/save.py +++ b/src/fishaudio/utils/save.py @@ -27,7 +27,7 @@ def save(audio: Union[bytes, Iterator[bytes]], filename: str) -> None: ``` """ # Consolidate iterator to bytes if needed - if isinstance(audio, Iterator): + if not isinstance(audio, bytes): audio = b"".join(audio) # Write to file diff --git a/uv.lock b/uv.lock index 5601e7e..0ede183 100644 --- a/uv.lock +++ b/uv.lock @@ -661,6 +661,7 @@ dependencies = [ { name = "ormsgpack", version = "1.11.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, { name = "ormsgpack", version = "1.12.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, { name = "pydantic" }, + { name = "typing-extensions" }, ] [package.optional-dependencies] @@ -671,6 +672,7 @@ utils = [ [package.dev-dependencies] dev = [ + { name = "fish-audio-sdk", extra = ["utils"] }, { name = "mypy" }, { name = "pydoc-markdown" }, { name = "pytest" }, @@ -691,11 +693,13 @@ requires-dist = [ { name = "pydantic", specifier = ">=2.9.1" }, { name = "sounddevice", marker = "extra == 'utils'", specifier = ">=0.4.6" }, { name = "soundfile", marker = "extra == 'utils'", specifier = ">=0.12.1" }, + { name = "typing-extensions", specifier = ">=4.15.0" }, ] provides-extras = ["utils"] [package.metadata.requires-dev] dev = [ + { name = "fish-audio-sdk", extras = ["utils"], editable = "." }, { name = "mypy", specifier = ">=1.14.1" }, { name = "pydoc-markdown", specifier = ">=4.8.2" }, { name = "pytest", specifier = ">=8.3.5" }, From eb7abc9b6eb3d729c217bf78e44b2f4513827b15 Mon Sep 17 00:00:00 2001 From: James Ding Date: Tue, 16 Dec 2025 19:19:42 -0600 Subject: [PATCH 3/7] chore: remove mypy dependency and update CI to use ty for type checking --- .github/workflows/python.yml | 4 +-- pyproject.toml | 1 - tests/unit/test_utils.py | 22 ++++++++++----- uv.lock | 53 ------------------------------------ 4 files changed, 17 insertions(+), 63 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index b6584a8..d351441 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -32,8 +32,8 @@ jobs: python-version: "3" - name: Install dependencies run: uv sync - - name: Run mypy - run: uv run mypy src/fishaudio --ignore-missing-imports + - name: Run ty + run: uv run ty check test: name: Test Python ${{ matrix.python-version }} diff --git a/pyproject.toml b/pyproject.toml index 965a282..593382d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,6 @@ asyncio_mode = "auto" [dependency-groups] dev = [ "fish-audio-sdk[utils]", - "mypy>=1.14.1", "pydoc-markdown>=4.8.2", "pytest>=8.3.5", "pytest-asyncio>=0.24.0", diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 2c0f30e..8effd61 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -62,16 +62,24 @@ def test_play_ffmpeg_not_installed(self): assert "ffplay" in str(exc_info.value) def test_play_sounddevice_mode(self): - """Test using sounddevice directly.""" - # Since we can't easily test sounddevice without installing it, - # just test that the error is raised when it's not available - with patch( - "subprocess.run", side_effect=[subprocess.CalledProcessError(1, "which")] - ): + """Test using sounddevice for playback.""" + mock_sd = Mock() + mock_sf = Mock() + mock_sf.read.return_value = ([0.1, 0.2], 44100) + + with patch.dict("sys.modules", {"sounddevice": mock_sd, "soundfile": mock_sf}): + play(b"audio", use_ffmpeg=False) + + mock_sf.read.assert_called_once() + mock_sd.play.assert_called_once() + mock_sd.wait.assert_called_once() + + def test_play_sounddevice_not_installed(self): + """Test error when sounddevice not installed.""" + with patch.dict("sys.modules", {"sounddevice": None, "soundfile": None}): with pytest.raises(DependencyError) as exc_info: play(b"audio", use_ffmpeg=False) - # Should mention sounddevice in the error assert "sounddevice" in str(exc_info.value) or "fishaudio[utils]" in str( exc_info.value ) diff --git a/uv.lock b/uv.lock index 0ede183..05a6430 100644 --- a/uv.lock +++ b/uv.lock @@ -673,7 +673,6 @@ utils = [ [package.dev-dependencies] dev = [ { name = "fish-audio-sdk", extra = ["utils"] }, - { name = "mypy" }, { name = "pydoc-markdown" }, { name = "pytest" }, { name = "pytest-asyncio" }, @@ -700,7 +699,6 @@ provides-extras = ["utils"] [package.metadata.requires-dev] dev = [ { name = "fish-audio-sdk", extras = ["utils"], editable = "." }, - { name = "mypy", specifier = ">=1.14.1" }, { name = "pydoc-markdown", specifier = ">=4.8.2" }, { name = "pytest", specifier = ">=8.3.5" }, { name = "pytest-asyncio", specifier = ">=0.24.0" }, @@ -927,57 +925,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/4e/d3/fe08482b5cd995033556d45041a4f4e76e7f0521112a9c9991d40d39825f/markupsafe-3.0.3-cp39-cp39-win_arm64.whl", hash = "sha256:38664109c14ffc9e7437e86b4dceb442b0096dfe3541d7864d9cbe1da4cf36c8", size = 13928, upload-time = "2025-09-27T18:37:39.037Z" }, ] -[[package]] -name = "mypy" -version = "1.18.2" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "mypy-extensions" }, - { name = "pathspec" }, - { name = "tomli", marker = "python_full_version < '3.11'" }, - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/c0/77/8f0d0001ffad290cef2f7f216f96c814866248a0b92a722365ed54648e7e/mypy-1.18.2.tar.gz", hash = "sha256:06a398102a5f203d7477b2923dda3634c36727fa5c237d8f859ef90c42a9924b", size = 3448846, upload-time = "2025-09-19T00:11:10.519Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/03/6f/657961a0743cff32e6c0611b63ff1c1970a0b482ace35b069203bf705187/mypy-1.18.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c1eab0cf6294dafe397c261a75f96dc2c31bffe3b944faa24db5def4e2b0f77c", size = 12807973, upload-time = "2025-09-19T00:10:35.282Z" }, - { url = "https://files.pythonhosted.org/packages/10/e9/420822d4f661f13ca8900f5fa239b40ee3be8b62b32f3357df9a3045a08b/mypy-1.18.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:7a780ca61fc239e4865968ebc5240bb3bf610ef59ac398de9a7421b54e4a207e", size = 11896527, upload-time = "2025-09-19T00:10:55.791Z" }, - { url = "https://files.pythonhosted.org/packages/aa/73/a05b2bbaa7005f4642fcfe40fb73f2b4fb6bb44229bd585b5878e9a87ef8/mypy-1.18.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:448acd386266989ef11662ce3c8011fd2a7b632e0ec7d61a98edd8e27472225b", size = 12507004, upload-time = "2025-09-19T00:11:05.411Z" }, - { url = "https://files.pythonhosted.org/packages/4f/01/f6e4b9f0d031c11ccbd6f17da26564f3a0f3c4155af344006434b0a05a9d/mypy-1.18.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f9e171c465ad3901dc652643ee4bffa8e9fef4d7d0eece23b428908c77a76a66", size = 13245947, upload-time = "2025-09-19T00:10:46.923Z" }, - { url = "https://files.pythonhosted.org/packages/d7/97/19727e7499bfa1ae0773d06afd30ac66a58ed7437d940c70548634b24185/mypy-1.18.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:592ec214750bc00741af1f80cbf96b5013d81486b7bb24cb052382c19e40b428", size = 13499217, upload-time = "2025-09-19T00:09:39.472Z" }, - { url = "https://files.pythonhosted.org/packages/9f/4f/90dc8c15c1441bf31cf0f9918bb077e452618708199e530f4cbd5cede6ff/mypy-1.18.2-cp310-cp310-win_amd64.whl", hash = "sha256:7fb95f97199ea11769ebe3638c29b550b5221e997c63b14ef93d2e971606ebed", size = 9766753, upload-time = "2025-09-19T00:10:49.161Z" }, - { url = "https://files.pythonhosted.org/packages/88/87/cafd3ae563f88f94eec33f35ff722d043e09832ea8530ef149ec1efbaf08/mypy-1.18.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:807d9315ab9d464125aa9fcf6d84fde6e1dc67da0b6f80e7405506b8ac72bc7f", size = 12731198, upload-time = "2025-09-19T00:09:44.857Z" }, - { url = "https://files.pythonhosted.org/packages/0f/e0/1e96c3d4266a06d4b0197ace5356d67d937d8358e2ee3ffac71faa843724/mypy-1.18.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:776bb00de1778caf4db739c6e83919c1d85a448f71979b6a0edd774ea8399341", size = 11817879, upload-time = "2025-09-19T00:09:47.131Z" }, - { url = "https://files.pythonhosted.org/packages/72/ef/0c9ba89eb03453e76bdac5a78b08260a848c7bfc5d6603634774d9cd9525/mypy-1.18.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1379451880512ffce14505493bd9fe469e0697543717298242574882cf8cdb8d", size = 12427292, upload-time = "2025-09-19T00:10:22.472Z" }, - { url = "https://files.pythonhosted.org/packages/1a/52/ec4a061dd599eb8179d5411d99775bec2a20542505988f40fc2fee781068/mypy-1.18.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1331eb7fd110d60c24999893320967594ff84c38ac6d19e0a76c5fd809a84c86", size = 13163750, upload-time = "2025-09-19T00:09:51.472Z" }, - { url = "https://files.pythonhosted.org/packages/c4/5f/2cf2ceb3b36372d51568f2208c021870fe7834cf3186b653ac6446511839/mypy-1.18.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:3ca30b50a51e7ba93b00422e486cbb124f1c56a535e20eff7b2d6ab72b3b2e37", size = 13351827, upload-time = "2025-09-19T00:09:58.311Z" }, - { url = "https://files.pythonhosted.org/packages/c8/7d/2697b930179e7277529eaaec1513f8de622818696857f689e4a5432e5e27/mypy-1.18.2-cp311-cp311-win_amd64.whl", hash = "sha256:664dc726e67fa54e14536f6e1224bcfce1d9e5ac02426d2326e2bb4e081d1ce8", size = 9757983, upload-time = "2025-09-19T00:10:09.071Z" }, - { url = "https://files.pythonhosted.org/packages/07/06/dfdd2bc60c66611dd8335f463818514733bc763e4760dee289dcc33df709/mypy-1.18.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:33eca32dd124b29400c31d7cf784e795b050ace0e1f91b8dc035672725617e34", size = 12908273, upload-time = "2025-09-19T00:10:58.321Z" }, - { url = "https://files.pythonhosted.org/packages/81/14/6a9de6d13a122d5608e1a04130724caf9170333ac5a924e10f670687d3eb/mypy-1.18.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a3c47adf30d65e89b2dcd2fa32f3aeb5e94ca970d2c15fcb25e297871c8e4764", size = 11920910, upload-time = "2025-09-19T00:10:20.043Z" }, - { url = "https://files.pythonhosted.org/packages/5f/a9/b29de53e42f18e8cc547e38daa9dfa132ffdc64f7250e353f5c8cdd44bee/mypy-1.18.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5d6c838e831a062f5f29d11c9057c6009f60cb294fea33a98422688181fe2893", size = 12465585, upload-time = "2025-09-19T00:10:33.005Z" }, - { url = "https://files.pythonhosted.org/packages/77/ae/6c3d2c7c61ff21f2bee938c917616c92ebf852f015fb55917fd6e2811db2/mypy-1.18.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:01199871b6110a2ce984bde85acd481232d17413868c9807e95c1b0739a58914", size = 13348562, upload-time = "2025-09-19T00:10:11.51Z" }, - { url = "https://files.pythonhosted.org/packages/4d/31/aec68ab3b4aebdf8f36d191b0685d99faa899ab990753ca0fee60fb99511/mypy-1.18.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a2afc0fa0b0e91b4599ddfe0f91e2c26c2b5a5ab263737e998d6817874c5f7c8", size = 13533296, upload-time = "2025-09-19T00:10:06.568Z" }, - { url = "https://files.pythonhosted.org/packages/9f/83/abcb3ad9478fca3ebeb6a5358bb0b22c95ea42b43b7789c7fb1297ca44f4/mypy-1.18.2-cp312-cp312-win_amd64.whl", hash = "sha256:d8068d0afe682c7c4897c0f7ce84ea77f6de953262b12d07038f4d296d547074", size = 9828828, upload-time = "2025-09-19T00:10:28.203Z" }, - { url = "https://files.pythonhosted.org/packages/5f/04/7f462e6fbba87a72bc8097b93f6842499c428a6ff0c81dd46948d175afe8/mypy-1.18.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:07b8b0f580ca6d289e69209ec9d3911b4a26e5abfde32228a288eb79df129fcc", size = 12898728, upload-time = "2025-09-19T00:10:01.33Z" }, - { url = "https://files.pythonhosted.org/packages/99/5b/61ed4efb64f1871b41fd0b82d29a64640f3516078f6c7905b68ab1ad8b13/mypy-1.18.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:ed4482847168439651d3feee5833ccedbf6657e964572706a2adb1f7fa4dfe2e", size = 11910758, upload-time = "2025-09-19T00:10:42.607Z" }, - { url = "https://files.pythonhosted.org/packages/3c/46/d297d4b683cc89a6e4108c4250a6a6b717f5fa96e1a30a7944a6da44da35/mypy-1.18.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c3ad2afadd1e9fea5cf99a45a822346971ede8685cc581ed9cd4d42eaf940986", size = 12475342, upload-time = "2025-09-19T00:11:00.371Z" }, - { url = "https://files.pythonhosted.org/packages/83/45/4798f4d00df13eae3bfdf726c9244bcb495ab5bd588c0eed93a2f2dd67f3/mypy-1.18.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a431a6f1ef14cf8c144c6b14793a23ec4eae3db28277c358136e79d7d062f62d", size = 13338709, upload-time = "2025-09-19T00:11:03.358Z" }, - { url = "https://files.pythonhosted.org/packages/d7/09/479f7358d9625172521a87a9271ddd2441e1dab16a09708f056e97007207/mypy-1.18.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:7ab28cc197f1dd77a67e1c6f35cd1f8e8b73ed2217e4fc005f9e6a504e46e7ba", size = 13529806, upload-time = "2025-09-19T00:10:26.073Z" }, - { url = "https://files.pythonhosted.org/packages/71/cf/ac0f2c7e9d0ea3c75cd99dff7aec1c9df4a1376537cb90e4c882267ee7e9/mypy-1.18.2-cp313-cp313-win_amd64.whl", hash = "sha256:0e2785a84b34a72ba55fb5daf079a1003a34c05b22238da94fcae2bbe46f3544", size = 9833262, upload-time = "2025-09-19T00:10:40.035Z" }, - { url = "https://files.pythonhosted.org/packages/5a/0c/7d5300883da16f0063ae53996358758b2a2df2a09c72a5061fa79a1f5006/mypy-1.18.2-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:62f0e1e988ad41c2a110edde6c398383a889d95b36b3e60bcf155f5164c4fdce", size = 12893775, upload-time = "2025-09-19T00:10:03.814Z" }, - { url = "https://files.pythonhosted.org/packages/50/df/2cffbf25737bdb236f60c973edf62e3e7b4ee1c25b6878629e88e2cde967/mypy-1.18.2-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:8795a039bab805ff0c1dfdb8cd3344642c2b99b8e439d057aba30850b8d3423d", size = 11936852, upload-time = "2025-09-19T00:10:51.631Z" }, - { url = "https://files.pythonhosted.org/packages/be/50/34059de13dd269227fb4a03be1faee6e2a4b04a2051c82ac0a0b5a773c9a/mypy-1.18.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6ca1e64b24a700ab5ce10133f7ccd956a04715463d30498e64ea8715236f9c9c", size = 12480242, upload-time = "2025-09-19T00:11:07.955Z" }, - { url = "https://files.pythonhosted.org/packages/5b/11/040983fad5132d85914c874a2836252bbc57832065548885b5bb5b0d4359/mypy-1.18.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d924eef3795cc89fecf6bedc6ed32b33ac13e8321344f6ddbf8ee89f706c05cb", size = 13326683, upload-time = "2025-09-19T00:09:55.572Z" }, - { url = "https://files.pythonhosted.org/packages/e9/ba/89b2901dd77414dd7a8c8729985832a5735053be15b744c18e4586e506ef/mypy-1.18.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:20c02215a080e3a2be3aa50506c67242df1c151eaba0dcbc1e4e557922a26075", size = 13514749, upload-time = "2025-09-19T00:10:44.827Z" }, - { url = "https://files.pythonhosted.org/packages/25/bc/cc98767cffd6b2928ba680f3e5bc969c4152bf7c2d83f92f5a504b92b0eb/mypy-1.18.2-cp314-cp314-win_amd64.whl", hash = "sha256:749b5f83198f1ca64345603118a6f01a4e99ad4bf9d103ddc5a3200cc4614adf", size = 9982959, upload-time = "2025-09-19T00:10:37.344Z" }, - { url = "https://files.pythonhosted.org/packages/3f/a6/490ff491d8ecddf8ab91762d4f67635040202f76a44171420bcbe38ceee5/mypy-1.18.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:25a9c8fb67b00599f839cf472713f54249a62efd53a54b565eb61956a7e3296b", size = 12807230, upload-time = "2025-09-19T00:09:49.471Z" }, - { url = "https://files.pythonhosted.org/packages/eb/2e/60076fc829645d167ece9e80db9e8375648d210dab44cc98beb5b322a826/mypy-1.18.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c2b9c7e284ee20e7598d6f42e13ca40b4928e6957ed6813d1ab6348aa3f47133", size = 11895666, upload-time = "2025-09-19T00:10:53.678Z" }, - { url = "https://files.pythonhosted.org/packages/97/4a/1e2880a2a5dda4dc8d9ecd1a7e7606bc0b0e14813637eeda40c38624e037/mypy-1.18.2-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d6985ed057513e344e43a26cc1cd815c7a94602fb6a3130a34798625bc2f07b6", size = 12499608, upload-time = "2025-09-19T00:09:36.204Z" }, - { url = "https://files.pythonhosted.org/packages/00/81/a117f1b73a3015b076b20246b1f341c34a578ebd9662848c6b80ad5c4138/mypy-1.18.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:22f27105f1525ec024b5c630c0b9f36d5c1cc4d447d61fe51ff4bd60633f47ac", size = 13244551, upload-time = "2025-09-19T00:10:17.531Z" }, - { url = "https://files.pythonhosted.org/packages/9b/61/b9f48e1714ce87c7bf0358eb93f60663740ebb08f9ea886ffc670cea7933/mypy-1.18.2-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:030c52d0ea8144e721e49b1f68391e39553d7451f0c3f8a7565b59e19fcb608b", size = 13491552, upload-time = "2025-09-19T00:10:13.753Z" }, - { url = "https://files.pythonhosted.org/packages/c9/66/b2c0af3b684fa80d1b27501a8bdd3d2daa467ea3992a8aa612f5ca17c2db/mypy-1.18.2-cp39-cp39-win_amd64.whl", hash = "sha256:aa5e07ac1a60a253445797e42b8b2963c9675563a94f11291ab40718b016a7a0", size = 9765635, upload-time = "2025-09-19T00:10:30.993Z" }, - { url = "https://files.pythonhosted.org/packages/87/e3/be76d87158ebafa0309946c4a73831974d4d6ab4f4ef40c3b53a385a66fd/mypy-1.18.2-py3-none-any.whl", hash = "sha256:22a1748707dd62b58d2ae53562ffc4d7f8bcc727e8ac7cbc69c053ddc874d47e", size = 2352367, upload-time = "2025-09-19T00:10:15.489Z" }, -] - [[package]] name = "mypy-extensions" version = "1.1.0" From 5240b457f31867180645db1aad27a33109f67c7c Mon Sep 17 00:00:00 2001 From: James Ding Date: Tue, 16 Dec 2025 20:00:22 -0600 Subject: [PATCH 4/7] refactor: update type hints to use Iterable instead of Iterator for audio parameters --- src/fishaudio/utils/play.py | 6 +++--- src/fishaudio/utils/save.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/fishaudio/utils/play.py b/src/fishaudio/utils/play.py index 5ab1403..90a6390 100644 --- a/src/fishaudio/utils/play.py +++ b/src/fishaudio/utils/play.py @@ -2,7 +2,7 @@ import io import subprocess -from typing import Iterator, Union +from typing import Iterable, Union from ..exceptions import DependencyError @@ -17,7 +17,7 @@ def _is_installed(command: str) -> bool: def play( - audio: Union[bytes, Iterator[bytes]], + audio: Union[bytes, Iterable[bytes]], *, notebook: bool = False, use_ffmpeg: bool = True, @@ -26,7 +26,7 @@ def play( Play audio using various playback methods. Args: - audio: Audio bytes or iterator of bytes + audio: Audio bytes or iterable of bytes notebook: Use Jupyter notebook playback (IPython.display.Audio) use_ffmpeg: Use ffplay for playback (default, falls back to sounddevice) diff --git a/src/fishaudio/utils/save.py b/src/fishaudio/utils/save.py index 2a206f4..0801520 100644 --- a/src/fishaudio/utils/save.py +++ b/src/fishaudio/utils/save.py @@ -1,14 +1,14 @@ """Audio saving utility.""" -from typing import Iterator, Union +from typing import Iterable, Union -def save(audio: Union[bytes, Iterator[bytes]], filename: str) -> None: +def save(audio: Union[bytes, Iterable[bytes]], filename: str) -> None: """ Save audio to a file. Args: - audio: Audio bytes or iterator of bytes + audio: Audio bytes or iterable of bytes filename: Path to save the audio file Examples: From 4fbcb78c5f7b247278daef2e3120da24c9dd7c4b Mon Sep 17 00:00:00 2001 From: James Ding Date: Tue, 16 Dec 2025 20:20:14 -0600 Subject: [PATCH 5/7] feat: add example ipynb --- examples/getting_started.ipynb | 241 +++++++++++++++++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 examples/getting_started.ipynb diff --git a/examples/getting_started.ipynb b/examples/getting_started.ipynb new file mode 100644 index 0000000..e2fb3d9 --- /dev/null +++ b/examples/getting_started.ipynb @@ -0,0 +1,241 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Fish Audio SDK - Getting Started\n", + "\n", + "This notebook demonstrates the basic usage of the Fish Audio Python SDK:\n", + "- Initialize the client\n", + "- Convert text to speech\n", + "- Save and play audio\n", + "- Use different voices" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Setup\n", + "\n", + "First, install the SDK and set your API key:\n", + "\n", + "```bash\n", + "pip install fishaudio\n", + "export FISH_API_KEY=\"your_api_key\"\n", + "```\n", + "\n", + "Or create a `.env` file with `FISH_API_KEY=your_api_key`" + ] + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-12-17T02:19:01.713412Z", + "start_time": "2025-12-17T02:19:01.692232Z" + } + }, + "source": [ + "from dotenv import load_dotenv\n", + "from fishaudio import FishAudio\n", + "from fishaudio.utils import play, save\n", + "\n", + "load_dotenv()\n", + "\n", + "client = FishAudio()" + ], + "outputs": [], + "execution_count": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Simple Text-to-Speech\n", + "\n", + "Convert text to speech and play it directly in the notebook." + ] + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-12-17T02:19:02.811072Z", + "start_time": "2025-12-17T02:19:01.715025Z" + } + }, + "source": [ + "audio = client.tts.convert(text=\"Hello! Welcome to Fish Audio.\")\n", + "\n", + "play(audio, notebook=True)" + ], + "outputs": [ + { + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "\n", + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data", + "jetTransient": { + "display_id": null + } + } + ], + "execution_count": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Save Audio to File\n", + "\n", + "Save the generated audio to an MP3 file." + ] + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-12-17T02:19:02.822441Z", + "start_time": "2025-12-17T02:19:02.818578Z" + } + }, + "source": [ + "# audio = client.tts.convert(text=\"This audio will be saved to a file.\")\n", + "# save(audio, \"output.mp3\")" + ], + "outputs": [], + "execution_count": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Using a Specific Voice\n", + "\n", + "Use `reference_id` to specify a voice model from your Fish Audio account." + ] + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-12-17T02:19:02.826568Z", + "start_time": "2025-12-17T02:19:02.822894Z" + } + }, + "source": [ + "# Replace with your voice model ID\n", + "# audio = client.tts.convert(\n", + "# text=\"Hello from a custom voice!\",\n", + "# reference_id=\"your-voice-model-id\"\n", + "# )\n", + "# play(audio, notebook=True)" + ], + "outputs": [], + "execution_count": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Streaming Audio\n", + "\n", + "For longer text, use `stream()` to process audio chunks as they arrive." + ] + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-12-17T02:19:03.824681Z", + "start_time": "2025-12-17T02:19:02.826991Z" + } + }, + "source": [ + "stream = client.tts.stream(text=\"This is a longer piece of text that will be streamed.\")\n", + "audio = stream.collect()\n", + "\n", + "play(audio, notebook=True)" + ], + "outputs": [ + { + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "\n", + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data", + "jetTransient": { + "display_id": null + } + } + ], + "execution_count": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Check Account Credits" + ] + }, + { + "cell_type": "code", + "metadata": { + "ExecuteTime": { + "end_time": "2025-12-17T02:19:03.897563Z", + "start_time": "2025-12-17T02:19:03.833734Z" + } + }, + "source": [ + "credits = client.account.get_credits()\n", + "print(f\"Remaining credits: {credits.credit}\")" + ], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Remaining credits: 1390.907180\n" + ] + } + ], + "execution_count": 12 + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python", + "version": "3.11.0" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} From bf1658e217f9b537661760b8ed3f5e4320c920dd Mon Sep 17 00:00:00 2001 From: James Ding Date: Tue, 16 Dec 2025 20:25:23 -0600 Subject: [PATCH 6/7] fix: lint with import clarification --- examples/getting_started.ipynb | 86 +++++++++++++++------------------- 1 file changed, 39 insertions(+), 47 deletions(-) diff --git a/examples/getting_started.ipynb b/examples/getting_started.ipynb index e2fb3d9..ec6e6ee 100644 --- a/examples/getting_started.ipynb +++ b/examples/getting_started.ipynb @@ -31,23 +31,15 @@ }, { "cell_type": "code", + "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2025-12-17T02:19:01.713412Z", "start_time": "2025-12-17T02:19:01.692232Z" } }, - "source": [ - "from dotenv import load_dotenv\n", - "from fishaudio import FishAudio\n", - "from fishaudio.utils import play, save\n", - "\n", - "load_dotenv()\n", - "\n", - "client = FishAudio()" - ], "outputs": [], - "execution_count": 7 + "source": "from dotenv import load_dotenv\nfrom fishaudio import FishAudio\nfrom fishaudio.utils import play\n# from fishaudio.utils import save # Uncomment if saving audio to file\n\nload_dotenv()\n\nclient = FishAudio()" }, { "cell_type": "markdown", @@ -60,23 +52,16 @@ }, { "cell_type": "code", + "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2025-12-17T02:19:02.811072Z", "start_time": "2025-12-17T02:19:01.715025Z" } }, - "source": [ - "audio = client.tts.convert(text=\"Hello! Welcome to Fish Audio.\")\n", - "\n", - "play(audio, notebook=True)" - ], "outputs": [ { "data": { - "text/plain": [ - "" - ], "text/html": [ "\n", " \n", " " + ], + "text/plain": [ + "" ] }, - "metadata": {}, - "output_type": "display_data", "jetTransient": { "display_id": null - } + }, + "metadata": {}, + "output_type": "display_data" } ], - "execution_count": 8 + "source": [ + "audio = client.tts.convert(text=\"Hello! Welcome to Fish Audio.\")\n", + "\n", + "play(audio, notebook=True)" + ] }, { "cell_type": "markdown", @@ -106,18 +98,18 @@ }, { "cell_type": "code", + "execution_count": 9, "metadata": { "ExecuteTime": { "end_time": "2025-12-17T02:19:02.822441Z", "start_time": "2025-12-17T02:19:02.818578Z" } }, + "outputs": [], "source": [ "# audio = client.tts.convert(text=\"This audio will be saved to a file.\")\n", "# save(audio, \"output.mp3\")" - ], - "outputs": [], - "execution_count": 9 + ] }, { "cell_type": "markdown", @@ -130,12 +122,14 @@ }, { "cell_type": "code", + "execution_count": 10, "metadata": { "ExecuteTime": { "end_time": "2025-12-17T02:19:02.826568Z", "start_time": "2025-12-17T02:19:02.822894Z" } }, + "outputs": [], "source": [ "# Replace with your voice model ID\n", "# audio = client.tts.convert(\n", @@ -143,9 +137,7 @@ "# reference_id=\"your-voice-model-id\"\n", "# )\n", "# play(audio, notebook=True)" - ], - "outputs": [], - "execution_count": 10 + ] }, { "cell_type": "markdown", @@ -158,24 +150,16 @@ }, { "cell_type": "code", + "execution_count": 11, "metadata": { "ExecuteTime": { "end_time": "2025-12-17T02:19:03.824681Z", "start_time": "2025-12-17T02:19:02.826991Z" } }, - "source": [ - "stream = client.tts.stream(text=\"This is a longer piece of text that will be streamed.\")\n", - "audio = stream.collect()\n", - "\n", - "play(audio, notebook=True)" - ], "outputs": [ { "data": { - "text/plain": [ - "" - ], "text/html": [ "\n", " \n", " " + ], + "text/plain": [ + "" ] }, - "metadata": {}, - "output_type": "display_data", "jetTransient": { "display_id": null - } + }, + "metadata": {}, + "output_type": "display_data" } ], - "execution_count": 11 + "source": [ + "stream = client.tts.stream(text=\"This is a longer piece of text that will be streamed.\")\n", + "audio = stream.collect()\n", + "\n", + "play(audio, notebook=True)" + ] }, { "cell_type": "markdown", @@ -203,16 +195,13 @@ }, { "cell_type": "code", + "execution_count": 12, "metadata": { "ExecuteTime": { "end_time": "2025-12-17T02:19:03.897563Z", "start_time": "2025-12-17T02:19:03.833734Z" } }, - "source": [ - "credits = client.account.get_credits()\n", - "print(f\"Remaining credits: {credits.credit}\")" - ], "outputs": [ { "name": "stdout", @@ -222,7 +211,10 @@ ] } ], - "execution_count": 12 + "source": [ + "credits = client.account.get_credits()\n", + "print(f\"Remaining credits: {credits.credit}\")" + ] } ], "metadata": { @@ -238,4 +230,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file From b0e094bef5f71147598eab41cf9aa42bfb9419de Mon Sep 17 00:00:00 2001 From: James Ding Date: Tue, 16 Dec 2025 20:27:26 -0600 Subject: [PATCH 7/7] fix: clear ipynb --- examples/getting_started.ipynb | 66 +++++----------------------------- 1 file changed, 8 insertions(+), 58 deletions(-) diff --git a/examples/getting_started.ipynb b/examples/getting_started.ipynb index ec6e6ee..3951e24 100644 --- a/examples/getting_started.ipynb +++ b/examples/getting_started.ipynb @@ -52,35 +52,14 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2025-12-17T02:19:02.811072Z", "start_time": "2025-12-17T02:19:01.715025Z" } }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "jetTransient": { - "display_id": null - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "audio = client.tts.convert(text=\"Hello! Welcome to Fish Audio.\")\n", "\n", @@ -98,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2025-12-17T02:19:02.822441Z", @@ -122,7 +101,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2025-12-17T02:19:02.826568Z", @@ -150,35 +129,14 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2025-12-17T02:19:03.824681Z", "start_time": "2025-12-17T02:19:02.826991Z" } }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "jetTransient": { - "display_id": null - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "stream = client.tts.stream(text=\"This is a longer piece of text that will be streamed.\")\n", "audio = stream.collect()\n", @@ -195,22 +153,14 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2025-12-17T02:19:03.897563Z", "start_time": "2025-12-17T02:19:03.833734Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Remaining credits: 1390.907180\n" - ] - } - ], + "outputs": [], "source": [ "credits = client.account.get_credits()\n", "print(f\"Remaining credits: {credits.credit}\")"