diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index fa23cf4..16b3b34 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -28,7 +28,7 @@ jobs: - name: Generate API documentation working-directory: sdk - run: uv run pydoc-markdown + run: uv run poe docs - name: Checkout docs uses: actions/checkout@v6 diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index b1037d9..b670db1 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -16,10 +16,10 @@ jobs: uses: astral-sh/setup-uv@v7 - name: Check formatting - run: uv run ruff format --check . + run: uv run poe format - name: Lint code - run: uv run ruff check . + run: uv run poe lint type-check: name: Type Check @@ -33,7 +33,7 @@ jobs: - name: Install dependencies run: uv sync - name: Run ty - run: uv run ty check + run: uv run poe typecheck test: name: Test Python ${{ matrix.python-version }} @@ -50,7 +50,7 @@ jobs: - name: Install dependencies run: uv sync - name: Run tests with coverage - run: uv run pytest tests/unit/ -v --cov=src/fishaudio --cov-report=xml --cov-report=term + run: uv run poe test - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 if: matrix.python-version == '3' @@ -74,7 +74,7 @@ jobs: run: uv sync - name: Run integration tests - run: uv run pytest tests/integration/ -v + run: uv run poe test-integration env: FISH_API_KEY: ${{ secrets.FISH_API_KEY }} @@ -94,7 +94,7 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v7 - name: Build package - run: uv build + run: uv run poe build - name: Check package run: uv run python -c "import fishaudio; print(f'fishaudio v{fishaudio.__version__}')" - name: Upload build artifacts diff --git a/pyproject.toml b/pyproject.toml index f0a2602..4224dfc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,6 +57,7 @@ asyncio_mode = "auto" [dependency-groups] dev = [ "fish-audio-sdk[utils]", + "poethepoet>=0.32.0", "pydoc-markdown>=4.8.2", "pytest>=8.3.5", "pytest-asyncio>=0.24.0", @@ -112,5 +113,24 @@ runtime-evaluated-base-classes = ["pydantic.BaseModel"] [tool.ruff.lint.pyupgrade] keep-runtime-typing = true +[tool.poe.tasks] +lint = "ruff check ." +format = "ruff format --check ." +typecheck = "ty check" +check = ["lint", "format", "typecheck"] + +lint-fix = "ruff check --fix ." +format-fix = "ruff format ." +fix = ["lint-fix", "format-fix"] + +test = "pytest tests/unit/ -v --cov=src/fishaudio --cov-report=xml --cov-report=term" +test-integration = "pytest tests/integration/ -v" + +docs = "pydoc-markdown" + +[tool.poe.tasks.build] +cmd = "uv build" +executor = {type = "simple"} + [tool.uv.sources] fish-audio-sdk = { workspace = true } diff --git a/uv.lock b/uv.lock index 39ceaa0..e0a4ee6 100644 --- a/uv.lock +++ b/uv.lock @@ -673,6 +673,8 @@ utils = [ [package.dev-dependencies] dev = [ { name = "fish-audio-sdk", extra = ["utils"] }, + { name = "poethepoet", version = "0.37.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, + { name = "poethepoet", version = "0.41.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, { name = "pydoc-markdown" }, { name = "pytest" }, { name = "pytest-asyncio" }, @@ -699,6 +701,7 @@ provides-extras = ["utils"] [package.metadata.requires-dev] dev = [ { name = "fish-audio-sdk", extras = ["utils"], editable = "." }, + { name = "poethepoet", specifier = ">=0.32.0" }, { name = "pydoc-markdown", specifier = ">=4.8.2" }, { name = "pytest", specifier = ">=8.3.5" }, { name = "pytest-asyncio", specifier = ">=0.24.0" }, @@ -1303,6 +1306,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469, upload-time = "2025-04-19T11:48:57.875Z" }, ] +[[package]] +name = "pastel" +version = "0.2.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/76/f1/4594f5e0fcddb6953e5b8fe00da8c317b8b41b547e2b3ae2da7512943c62/pastel-0.2.1.tar.gz", hash = "sha256:e6581ac04e973cac858828c6202c1e1e81fee1dc7de7683f3e1ffe0bfd8a573d", size = 7555, upload-time = "2020-09-16T19:21:12.43Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/aa/18/a8444036c6dd65ba3624c63b734d3ba95ba63ace513078e1580590075d21/pastel-0.2.1-py2.py3-none-any.whl", hash = "sha256:4349225fcdf6c2bb34d483e523475de5bb04a5c10ef711263452cb37d7dd4364", size = 5955, upload-time = "2020-09-16T19:21:11.409Z" }, +] + [[package]] name = "pathspec" version = "0.12.1" @@ -1346,6 +1358,41 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" }, ] +[[package]] +name = "poethepoet" +version = "0.37.0" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version < '3.10'", +] +dependencies = [ + { name = "pastel", marker = "python_full_version < '3.10'" }, + { name = "pyyaml", marker = "python_full_version < '3.10'" }, + { name = "tomli", marker = "python_full_version < '3.10'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a5/f2/273fe54a78dc5c6c8dd63db71f5a6ceb95e4648516b5aeaeff4bde804e44/poethepoet-0.37.0.tar.gz", hash = "sha256:73edf458707c674a079baa46802e21455bda3a7f82a408e58c31b9f4fe8e933d", size = 68570, upload-time = "2025-08-11T18:00:29.103Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/92/1b/5337af1a6a478d25a3e3c56b9b4b42b0a160314e02f4a0498d5322c8dac4/poethepoet-0.37.0-py3-none-any.whl", hash = "sha256:861790276315abcc8df1b4bd60e28c3d48a06db273edd3092f3c94e1a46e5e22", size = 90062, upload-time = "2025-08-11T18:00:27.595Z" }, +] + +[[package]] +name = "poethepoet" +version = "0.41.0" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.11'", + "python_full_version == '3.10.*'", +] +dependencies = [ + { name = "pastel", marker = "python_full_version >= '3.10'" }, + { name = "pyyaml", marker = "python_full_version >= '3.10'" }, + { name = "tomli", marker = "python_full_version == '3.10.*'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a8/b9/fa92286560f70eaa40d473ea48376d20c6c21f63627d33c6bb1c5e385175/poethepoet-0.41.0.tar.gz", hash = "sha256:dcaad621dc061f6a90b17d091bebb9ca043d67bfe9bd6aa4185aea3ebf7ff3e6", size = 87780, upload-time = "2026-02-08T20:45:36.061Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/5d/5e/0b83e0222ce5921b3f9081eeca8c6fb3e1cfd5ca0d06338adf93b28ce061/poethepoet-0.41.0-py3-none-any.whl", hash = "sha256:4bab9fd8271664c5d21407e8f12827daeb6aa484dc6cc7620f0c3b4e62b42ee4", size = 113590, upload-time = "2026-02-08T20:45:34.697Z" }, +] + [[package]] name = "pycparser" version = "2.23"