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
43 changes: 43 additions & 0 deletions .github/workflows/tests-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Tests (macOS)

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

jobs:
test:
runs-on: macos-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
shell: bash

- name: Configure Git for private repos
run: |
git config --global url."https://x-access-token:${{ secrets.PRIVATE_REPO_TOKEN }}@github.com/".insteadOf "https://github.com/"

- name: Install dependencies
run: |
uv sync

- name: Run tests
run: |
make run-tests
41 changes: 17 additions & 24 deletions .github/workflows/tests.yml → .github/workflows/tests-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Tests (Ubuntu)

on:
push:
Expand All @@ -13,48 +13,41 @@ permissions:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.11']

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: '3.11'

- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
shell: bash

- name: Configure Git for private repos
run: |
git config --global url."https://x-access-token:${{ secrets.PRIVATE_REPO_TOKEN }}@github.com/".insteadOf "https://github.com/"

- name: Install dependencies
run: |
uv sync

- name: Run tests
run: |
uv run pytest src/voxkit/storage/test/ -v --tb=short

- name: Run linting (Ubuntu only)
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
make run-tests

- name: Run linting
run: |
uv run ruff check src/
make lint-check
continue-on-error: true

- name: Run type checking (Ubuntu only)
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'

- name: Run type checking
run: |
uv run mypy src/
make mypy-check
continue-on-error: true
43 changes: 43 additions & 0 deletions .github/workflows/tests-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Tests (Windows)

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

jobs:
test:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
shell: bash

- name: Configure Git for private repos
run: |
git config --global url."https://x-access-token:${{ secrets.PRIVATE_REPO_TOKEN }}@github.com/".insteadOf "https://github.com/"

- name: Install dependencies
run: |
uv sync

- name: Run tests
run: |
make run-tests
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
</p>

<p align="center">
<a href="https://github.com/BrainBehaviorAnalyticsLab/PyPLLR_GUI/actions/workflows/tests.yml"><img src="https://img.shields.io/github/actions/workflow/status/BrainBehaviorAnalyticsLab/PyPLLR_GUI/tests.yml?branch=main&label=Tests&style=flat-square" alt="Tests"></a>
<a href="https://github.com/BrainBehaviorAnalyticsLab/PyPLLR_GUI/actions/workflows/tests-ubuntu.yml"><img src="https://img.shields.io/github/actions/workflow/status/BrainBehaviorAnalyticsLab/PyPLLR_GUI/tests-ubuntu.yml?branch=main&label=Ubuntu&logo=ubuntu&style=flat-square" alt="Ubuntu Tests"></a>
<a href="https://github.com/BrainBehaviorAnalyticsLab/PyPLLR_GUI/actions/workflows/tests-macos.yml"><img src="https://img.shields.io/github/actions/workflow/status/BrainBehaviorAnalyticsLab/PyPLLR_GUI/tests-macos.yml?branch=main&label=macOS&logo=apple&style=flat-square" alt="macOS Tests"></a>
<a href="https://github.com/BrainBehaviorAnalyticsLab/PyPLLR_GUI/actions/workflows/tests-windows.yml"><img src="https://img.shields.io/github/actions/workflow/status/BrainBehaviorAnalyticsLab/PyPLLR_GUI/tests-windows.yml?branch=main&label=Windows&logo=windows&style=flat-square" alt="Windows Tests"></a>
<a href="https://github.com/BrainBehaviorAnalyticsLab/PyPLLR_GUI/actions/workflows/code-quality.yml"><img src="https://img.shields.io/github/actions/workflow/status/BrainBehaviorAnalyticsLab/PyPLLR_GUI/code-quality.yml?branch=main&label=Code%20Quality&style=flat-square" alt="Code Quality"></a>
<a href="https://voxkit.atlassian.net/jira/software/projects/VOX/boards/2/"><img src="https://img.shields.io/badge/Project-Jira-0052CC?logo=jira&style=flat-square" alt="Jira"></a>
</p>
Expand Down
12 changes: 6 additions & 6 deletions _frozen_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
if getattr(sys, "frozen", False):
# We're running in a PyInstaller bundle
print("[PATCH] Applying frozen app patches...")

# Patch 1: Disable typeguard runtime checking
try:
import typeguard

# Replace typechecked decorator with a no-op
def _noop_decorator(func=None, **kwargs):
"""No-op decorator that just returns the function unchanged"""
Expand All @@ -20,12 +20,12 @@ def _noop_decorator(func=None, **kwargs):
return lambda f: f
# Called without arguments: @typechecked
return func
typeguard.typechecked = _noop_decorator

typeguard.typechecked = _noop_decorator # type: ignore[assignment]
print("[PATCH] Disabled typeguard runtime checking")
except ImportError:
pass

# Patch 2: Fix inspect.getsource to not fail in frozen apps
import inspect

Expand Down Expand Up @@ -70,7 +70,7 @@ def _patched_getsourcefile(object):
try:
result = _original_getsourcefile(object)
# Check if the file actually exists
if result and not __import__('os').path.exists(result):
if result and not __import__("os").path.exists(result):
return None
return result
except (OSError, TypeError):
Expand Down
4 changes: 2 additions & 2 deletions hooks/hook-nltk.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

# Don't collect any NLTK data files - they will be downloaded at runtime
datas = []
datas: list[tuple[str, str, str]] = []

# Exclude data collection
excludedimports = []
excludedimports: list[str] = []
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dev = [
"pre-commit>=4.3.0",
"ruff>=0.14.0",
"mypy>=1.18.2",
"types-PyYAML>=6.0.0",
"genbadge[coverage]>=1.1.3",
]
docs = [
Expand Down Expand Up @@ -109,11 +110,15 @@ indent-style = "space"
[tool.mypy]
python_version = "3.11"
ignore_missing_imports = true
check_untyped_defs = false
warn_return_any = true
warn_unused_configs = true
exclude = [
"main.py",
"build.py",
"example_startup_script.py",
"test_imports.py"
"test_imports.py",
"tests/"
]


Expand Down
3 changes: 3 additions & 0 deletions src/voxkit/analyzers/default_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def paintEvent(self, event):

color = QColor("#3498db")
h, s, lightness, a = color.getHsl()
assert (
h is not None and s is not None and lightness is not None and a is not None
)
ratio = count / max_count
new_l = int(lightness + (220 - lightness) * (1 - ratio))
color.setHsl(h, s, min(new_l, 240), a)
Expand Down
5 changes: 2 additions & 3 deletions src/voxkit/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from voxkit.services.mfa import download_acoustic_model
from voxkit.storage import models
from voxkit.storage.config import MODELS_ROOT
from voxkit.storage.models import download_and_copy_huggingface_model
from voxkit.storage.utils import get_storage_root

AppName = "VoxKit"
Expand Down Expand Up @@ -94,10 +93,10 @@ def startup_routine():
# else:
# print("[STARTUP] Failed to download W2TG model.")


try:
import nltk
nltk.download('averaged_perceptron_tagger_eng')

nltk.download("averaged_perceptron_tagger_eng")

except Exception as e:
print(f"[STARTUP] Failed to download NLTK resources. Error: {e}")
Expand Down
6 changes: 4 additions & 2 deletions src/voxkit/config/startup_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def startup_routine():
if not success:
print(f"[STARTUP] Failed to create model metadata for {model}. {metadata}")
continue
assert not isinstance(metadata, str)
model_dest = metadata.get("model_path")
if not model_dest:
print(f"[STARTUP] Model path not found in metadata for {model}.")
Expand Down Expand Up @@ -81,6 +82,7 @@ def startup_routine():
if not success:
print(f"[STARTUP] Failed to create model metadata. {metadata}")
return
assert not isinstance(metadata, str)
model_dest = metadata.get("model_path")
if not model_dest:
print("[STARTUP] Model path not found in metadata.")
Expand All @@ -94,10 +96,10 @@ def startup_routine():
else:
print("[STARTUP] Failed to download W2TG model.")


try:
import nltk
nltk.download('averaged_perceptron_tagger_eng')

nltk.download("averaged_perceptron_tagger_eng")

except Exception as e:
print(f"[STARTUP] Failed to download NLTK resources. Error: {e}")
Expand Down
2 changes: 1 addition & 1 deletion src/voxkit/engines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def get_tool_providers(self, tool: ToolType) -> dict[str, AlignmentEngine]:
w2tg = W2TGEngine(id="W2TGENGINE")
mfa = MFAEngine(id="MFAENGINE")
faster_whisper = FasterWhisperEngine(id="FASTERWHISPERENGINE")
engines = EngineManager({ mfa.id: mfa, faster_whisper.id: faster_whisper, w2tg.id: w2tg })
engines = EngineManager({mfa.id: mfa, faster_whisper.id: faster_whisper, w2tg.id: w2tg})

__all__ = [
"engines",
Expand Down
3 changes: 2 additions & 1 deletion src/voxkit/engines/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ def _load_json(self, path: Path | str) -> dict:
return {}

with open(path, "r", encoding="utf-8") as f:
return json.load(f)
result: dict = json.load(f)
return result

def _get_default_settings(self, cfg: Any) -> dict:
"""
Expand Down
Loading
Loading