diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f733ba..767920f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: strategy: fail-fast: false matrix: - python: ["3.10", "3.11", "3.12", "3.13"] + python: ["3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9362c9c..c70fe0c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,7 +29,7 @@ ruff format . # auto-format ruff format --check . # verify formatting without changing files ``` -The tests mock out `Stackvox` so they don't download the 340 MB model — CI runs them across Python 3.10–3.13 on Ubuntu. Please keep that property: any new test that wants to touch real synthesis should be marked and skipped by default. +The tests mock out `Stackvox` so they don't download the 340 MB model — CI runs them across Python 3.11–3.14 on Ubuntu. Please keep that property: any new test that wants to touch real synthesis should be marked and skipped by default. ## Commit and branch style diff --git a/README.md b/README.md index 3022a93..ad6168c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![ci](https://github.com/StackOneHQ/stackvox/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/StackOneHQ/stackvox/actions/workflows/ci.yml) [![coverage](https://codecov.io/gh/StackOneHQ/stackvox/branch/main/graph/badge.svg)](https://codecov.io/gh/StackOneHQ/stackvox) -[![python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/downloads/) +[![python](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/downloads/) [![license](https://img.shields.io/badge/license-Apache%202.0-blue)](./LICENSE) Offline TTS using [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) via [kokoro-onnx](https://github.com/thewh1teagle/kokoro-onnx). Apache 2.0 model, ~340MB, CPU real-time, plays straight to system audio. Designed to be importable as a Python library, drivable as a CLI, or poked via a unix socket for ~13ms speech requests from shell scripts. @@ -368,7 +368,7 @@ Before each utterance the daemon resets PortAudio so it picks up the current sys ## Requirements -- Python 3.10+ +- Python 3.11+ - macOS or Linux - `nc` (BSD netcat — default on macOS, `netcat-openbsd` on Linux) for the bash helper diff --git a/pyproject.toml b/pyproject.toml index 4a6700a..d4be2eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "stackvox" version = "0.16.2" description = "Offline TTS library using Kokoro-82M" readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.11" license = "Apache-2.0" license-files = ["LICENSE", "NOTICE"] authors = [{ name = "StackOne Technologies Ltd.", email = "support@stackone.com" }] @@ -25,7 +25,6 @@ dependencies = [ "soundfile>=0.12.1", "sounddevice>=0.4.6", "numpy>=1.24", - "tomli>=2.0;python_version<'3.11'", ] [project.optional-dependencies] @@ -65,7 +64,7 @@ stackvox = ["py.typed", "data/stackvox-say"] [tool.ruff] line-length = 110 -target-version = "py310" +target-version = "py311" [tool.ruff.format] # Ruff 0.16 began formatting Python code blocks inside Markdown. Ours are @@ -116,8 +115,8 @@ skip_covered = false [tool.mypy] # Matches the interpreter CI runs mypy under, and must be >= 3.12: numpy's # bundled stubs use PEP 695 `type` aliases, which mypy rejects as a syntax -# error when told to target an older Python. Runtime support for 3.10+ is -# still verified by the pytest matrix (py3.10–3.13). +# error when told to target an older Python. Runtime support for 3.11+ is +# still verified by the pytest matrix (py3.11–3.14). python_version = "3.12" files = ["stackvox", "tests"] warn_unused_ignores = true @@ -128,9 +127,8 @@ no_implicit_optional = true disallow_untyped_defs = true [[tool.mypy.overrides]] -# Third-party deps without inline type stubs (or, for `tomli`, a 3.10-only -# fallback that's not installed on the typechecker's Python). -module = ["kokoro_onnx", "mlx.*", "mlx_audio.*", "onnxruntime", "sounddevice", "soundfile", "tomli"] +# Third-party deps without inline type stubs. +module = ["kokoro_onnx", "mlx.*", "mlx_audio.*", "onnxruntime", "sounddevice", "soundfile"] ignore_missing_imports = true [[tool.mypy.overrides]] diff --git a/stackvox/config.py b/stackvox/config.py index 74a1ee8..0cfcb15 100644 --- a/stackvox/config.py +++ b/stackvox/config.py @@ -38,17 +38,12 @@ import logging import os -import sys +import tomllib from collections.abc import Callable from dataclasses import dataclass, field from pathlib import Path from typing import Any -if sys.version_info >= (3, 11): - import tomllib -else: # pragma: no cover - covered by 3.10 CI - import tomli as tomllib - from stackvox.engine import BACKENDS, DEFAULT_LANG, DEFAULT_SPEED, DEFAULT_VOICE, REFERENCE_PAIR from stackvox.voices import BUILTIN_VOICES, VoiceMix diff --git a/stackvox/updates.py b/stackvox/updates.py index 5a8fecf..a5c6004 100644 --- a/stackvox/updates.py +++ b/stackvox/updates.py @@ -18,20 +18,15 @@ import json import logging import os -import sys +import tomllib import urllib.error import urllib.request from dataclasses import dataclass -from datetime import datetime, timedelta, timezone +from datetime import UTC, datetime, timedelta from importlib.metadata import PackageNotFoundError from importlib.metadata import version as _pkg_version from pathlib import Path -if sys.version_info >= (3, 11): - import tomllib -else: # pragma: no cover - covered by 3.10 CI - import tomli as tomllib - from stackvox.paths import cache_dir logger = logging.getLogger(__name__) @@ -155,7 +150,7 @@ def write_cache(latest: str, *, now: datetime | None = None) -> None: path = cache_path() path.parent.mkdir(parents=True, exist_ok=True) payload = { - "checked_at": (now or datetime.now(timezone.utc)).isoformat(), + "checked_at": (now or datetime.now(UTC)).isoformat(), "latest": latest, } path.write_text(json.dumps(payload), encoding="utf-8") @@ -199,7 +194,7 @@ def check_for_update(*, now: datetime | None = None) -> UpdateInfo | None: """ if is_disabled(): return None - now = now or datetime.now(timezone.utc) + now = now or datetime.now(UTC) entry = read_cache() if entry is None or (now - entry[0]) > CACHE_TTL: latest = fetch_latest_version() diff --git a/tests/test_updates.py b/tests/test_updates.py index 43cb497..8996d33 100644 --- a/tests/test_updates.py +++ b/tests/test_updates.py @@ -3,7 +3,7 @@ from __future__ import annotations import json -from datetime import datetime, timedelta, timezone +from datetime import UTC, datetime, timedelta import pytest @@ -76,7 +76,7 @@ def test_read_returns_none_when_file_absent(self): assert updates.read_cache() is None def test_round_trip(self): - when = datetime(2026, 4, 30, 12, 0, tzinfo=timezone.utc) + when = datetime(2026, 4, 30, 12, 0, tzinfo=UTC) updates.write_cache("0.5.0", now=when) entry = updates.read_cache() assert entry is not None @@ -166,7 +166,7 @@ class TestCheckForUpdate: def test_uses_cache_when_fresh(self, mocker): mocker.patch.object(updates, "_current_version", return_value="0.3.1") # Cache from 1 hour ago — well within the 24h TTL. - when = datetime.now(timezone.utc) - timedelta(hours=1) + when = datetime.now(UTC) - timedelta(hours=1) updates.write_cache("0.5.0", now=when) fetch = mocker.patch.object(updates, "fetch_latest_version") @@ -179,7 +179,7 @@ def test_uses_cache_when_fresh(self, mocker): def test_refetches_when_cache_stale(self, mocker): mocker.patch.object(updates, "_current_version", return_value="0.3.1") - when = datetime.now(timezone.utc) - timedelta(days=2) + when = datetime.now(UTC) - timedelta(days=2) updates.write_cache("0.4.0", now=when) fetch = mocker.patch.object(updates, "fetch_latest_version", return_value="0.5.0") @@ -191,7 +191,7 @@ def test_refetches_when_cache_stale(self, mocker): def test_falls_back_to_stale_cache_on_fetch_failure(self, mocker): mocker.patch.object(updates, "_current_version", return_value="0.3.1") - when = datetime.now(timezone.utc) - timedelta(days=2) + when = datetime.now(UTC) - timedelta(days=2) updates.write_cache("0.4.0", now=when) mocker.patch.object(updates, "fetch_latest_version", return_value=None)