Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down
14 changes: 6 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }]
Expand All @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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]]
Expand Down
7 changes: 1 addition & 6 deletions stackvox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 4 additions & 9 deletions stackvox/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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()
Expand Down
10 changes: 5 additions & 5 deletions tests/test_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

import json
from datetime import datetime, timedelta, timezone
from datetime import UTC, datetime, timedelta

import pytest

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")

Expand All @@ -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")

Expand All @@ -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)

Expand Down
Loading