Files
voculinux/setup.py
T
Jatin K MalikandGitHub 1dc1d44665 feat: Alpha Launch v0.2.0 - Complete UX Overhaul 🚀🎤 (#39)
* feat: prepare for v0.2.0-alpha release

* feat: prepare for v0.2.0-alpha release

* chore: remove CHANGELOG.md, use GitHub Releases instead

* refactor: use existing About dialog instead of Settings section

* style: enhance About dialog UI readability

* style: fix formatting with black and isort

* feat: show VAD and silence timeout settings for Whisper engine

- Renamed 'VOSK Settings' to 'Recognition Settings'
- VAD Sensitivity and Silence Timeout now apply to both engines
- Added tooltips explaining each setting
- VOSK-specific model info only shown when VOSK selected

* fix: resolve overlapping UI elements in settings dialog

* fix: save VAD and silence timeout settings for both engines

Previously these settings were only saved when VOSK was selected.
Now they persist correctly for Whisper as well.

* fix: show download progress when selecting undownloaded model

Previously when auto-applying settings, models would download silently
in the background without showing the progress dialog. Now:
- Download progress dialog appears for undownloaded models
- Model icons update correctly after download completes

* feat: add download progress, speed, ETA and cancel button

- Show real download progress percentage for VOSK models
- Display download speed (MB/s) and estimated time remaining
- Add Cancel button to abort downloads
- Update status during extraction phase
- Whisper downloads still pulse (uses internal downloader)

* fix: defer model download until needed, don't block startup

- App now starts instantly even if models aren't downloaded
- Models are downloaded on-demand when selected in Settings
- If user tries to dictate without a model, plays error sound
- Added model_ready property to check if engine is usable

* fix: improve first-run UX without downloaded models

- Settings dialog now defaults to smallest available model, not saved config
- Only show saved model if it's actually downloaded
- Add desktop notification when trying to dictate without a model
- Prevents auto-downloading large models on first launch

* feat: add download progress tracking for Whisper models

- Implement custom Whisper model download with progress/speed/ETA
- Uses OpenAI's CDN URLs directly instead of whisper.load_model()
- Progress callback works the same as VOSK downloads
- Supports cancellation during download

* fix: enable download progress callback for Whisper models

Progress callback was only being set for VOSK downloads, not Whisper.
Now both engines show real-time progress, speed, and ETA.

* fix: update tests for defer_download and config manager mocking

- test_main: Mock ConfigManager to prevent saved config from overriding test values
- test_settings_dialog: Mock ModelDownloadDialog to prevent GTK init errors
- test_speech_recognition: Use proper MockVoskModule class instead of MagicMock, pass defer_download=False for download test
- test_whisper_support: Pass defer_download=False to trigger model loading in test

* fix: resolve test failures for CI

- test_main: Fix ConfigManager patch path to use source module
- test_settings_dialog: Mock _is_vosk_model_downloaded and _is_whisper_model_downloaded to skip download flow, add missing dialog attributes
- test_speech_recognition: Replace recognizer with properly configured mock that returns valid JSON, fixing test isolation issues when running all tests together

* fix: mock _download_whisper_model in whisper test to avoid requests exception handling issue

* fix: add gir1.2-girepository-2.0 dep for PyGObject on Ubuntu 24.04

- Add missing girepository-2.0 package for newer Ubuntu runners
- Use --no-build-isolation for PyGObject to use system packages

* fix: skip PyGObject pip install, use system python3-gi package

- Use --no-deps for editable install to skip PyGObject
- Install other deps explicitly without PyGObject
- Add python3-gi-cairo for complete GTK support
- Removes problematic girepository-2.0 build requirement

* fix: install PyGObject via pip with proper build deps

- Remove python3-gi/python3-gi-cairo (doesn't work with setup-python)
- Install PyGObject from pip after installing build dependencies
- Simplify venv setup without --system-site-packages hack

* Fix GObject

* fix: set GI_TYPELIB_PATH for pip-installed PyGObject to find AppIndicator3
2025-12-28 15:29:51 -08:00

159 lines
4.8 KiB
Python

#!/usr/bin/env python3
"""
Vocalinux - A seamless voice dictation system for Linux
This setup.py is maintained for backwards compatibility with older pip versions
and editable installs. The primary configuration is in pyproject.toml.
"""
import os
import sys
from setuptools import find_packages, setup
# Check Python version
MIN_PYTHON_VERSION = (3, 8)
if sys.version_info < MIN_PYTHON_VERSION:
sys.exit(
f"Error: Vocalinux requires Python {MIN_PYTHON_VERSION[0]}.{MIN_PYTHON_VERSION[1]} or higher"
)
def get_version():
"""Get version from version.py file."""
version = "0.2.0-alpha"
version_file = os.path.join(
os.path.dirname(__file__), "src", "vocalinux", "version.py"
)
if os.path.exists(version_file):
with open(version_file, "r", encoding="utf-8") as f:
for line in f:
if line.startswith("__version__"):
version = line.split("=")[1].strip().strip('"').strip("'")
break
return version
def get_long_description():
"""Get long description from README."""
readme_path = os.path.join(os.path.dirname(__file__), "README.md")
if os.path.exists(readme_path):
with open(readme_path, "r", encoding="utf-8") as f:
return f.read()
return ""
# Core dependencies
INSTALL_REQUIRES = [
"vosk>=0.3.45",
"pydub>=0.25.1",
"pynput>=1.7.6",
"requests>=2.28.0",
"tqdm>=4.64.0",
"numpy>=1.22.0",
"pyaudio>=0.2.13",
"python-xlib",
"PyGObject",
]
# Optional dependencies
EXTRAS_REQUIRE = {
"whisper": [
"openai-whisper>=20231117",
"torch>=2.0.0",
"torchaudio>=2.0.0",
],
"dev": [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"pytest-mock>=3.10.0",
"black>=23.0.0",
"isort>=5.12.0",
"flake8>=6.0.0",
"pre-commit>=3.0.0",
"mypy>=1.0.0",
],
"docs": [
"sphinx>=6.0.0",
"sphinx-rtd-theme>=1.2.0",
],
}
setup(
name="vocalinux",
version=get_version(),
description="A seamless voice dictation system for Linux",
long_description=get_long_description(),
long_description_content_type="text/markdown",
author="Jatin K Malik",
author_email="jatinkrmalik@gmail.com",
url="https://github.com/jatinkrmalik/vocalinux",
project_urls={
"Bug Tracker": "https://github.com/jatinkrmalik/vocalinux/issues",
"Documentation": "https://github.com/jatinkrmalik/vocalinux/tree/main/docs",
"Source Code": "https://github.com/jatinkrmalik/vocalinux",
"Changelog": "https://github.com/jatinkrmalik/vocalinux/releases",
},
packages=find_packages(where="src"),
package_dir={"": "src"},
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
entry_points={
"console_scripts": [
"vocalinux=vocalinux.main:main",
],
"gui_scripts": [
"vocalinux-gui=vocalinux.main:main",
],
},
data_files=[
(
"share/icons/hicolor/scalable/apps",
[
"resources/icons/scalable/vocalinux.svg",
"resources/icons/scalable/vocalinux-microphone.svg",
"resources/icons/scalable/vocalinux-microphone-off.svg",
"resources/icons/scalable/vocalinux-microphone-process.svg",
],
),
("share/applications", ["vocalinux.desktop"]),
(
"share/vocalinux/resources/icons/scalable",
[
"resources/icons/scalable/vocalinux.svg",
"resources/icons/scalable/vocalinux-microphone.svg",
"resources/icons/scalable/vocalinux-microphone-off.svg",
"resources/icons/scalable/vocalinux-microphone-process.svg",
],
),
(
"share/vocalinux/resources/sounds",
[
"resources/sounds/start_recording.wav",
"resources/sounds/stop_recording.wav",
"resources/sounds/error.wav",
],
),
],
include_package_data=True,
classifiers=[
"Development Status :: 3 - Alpha",
"Environment :: X11 Applications :: GTK",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Desktop Environment :: Gnome",
"Topic :: Multimedia :: Sound/Audio :: Speech",
"Topic :: Text Processing",
"Topic :: Utilities",
],
python_requires=">=3.8",
zip_safe=False,
)