[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "whisperlivekit"
version = "0.2.20"
description = "Real-time speech-to-text models"
readme = "README.md"
authors = [{ name = "Quentin Fuxa" }]
license = { file = "LICENSE" }
requires-python = ">=3.11, <3.14"
classifiers = [
    "Development Status :: 4 - Beta",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: MIT License",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Topic :: Scientific/Engineering :: Artificial Intelligence",
    "Topic :: Multimedia :: Sound/Audio :: Speech",
]
dependencies = [
    "fastapi",
    "librosa",
    "soundfile",
    "uvicorn",
    "websockets",
    "huggingface-hub>=0.25.0",
    "faster-whisper>=1.2.0",
    "torch>=2.0.0",
    "torchaudio>=2.0.0",
    "tqdm",
    "tiktoken",
]

[project.optional-dependencies]
test = ["pytest>=7.0", "pytest-asyncio>=0.21", "datasets>=2.14", "librosa"]
translation = ["nllw"]
sentence_tokenizer = ["mosestokenizer", "wtpsplit"]
mlx-whisper = [
    'mlx>=0.11.0; sys_platform == "darwin" and platform_machine == "arm64"',
    'mlx-whisper>=0.4.0; sys_platform == "darwin" and platform_machine == "arm64"',
]
voxtral-mlx = [
    'mlx>=0.11.0; sys_platform == "darwin" and platform_machine == "arm64"',
    'mlx-whisper>=0.4.0; sys_platform == "darwin" and platform_machine == "arm64"',
    "mistral-common[audio]",
]
voxtral-hf = [
    "transformers>=5.2.0; python_version >= '3.10'",
    "mistral-common[audio]",
    "accelerate>=0.12",
]
listen = ["sounddevice>=0.4.6"]
cpu = ["torch>=2.0.0", "torchaudio>=2.0.0"]
cu129 = [
    "torch>=2.0.0",
    "torchaudio>=2.0.0",
    'triton>=2.0.0; platform_machine == "x86_64" and (sys_platform == "linux" or sys_platform == "linux2")',
]
diarization-sortformer = [
    "nemo-toolkit[asr]>2.4; python_version >= '3.10' and python_version < '3.13'",
]
diarization-diart = [
    "diart",
    "torch<2.9.0",
    "torchaudio<2.9.0",
    "torchvision<0.24.0",
]

[dependency-groups]
dev = ["rich>=14.3.3"]

[tool.uv]
conflicts = [
    [
        { extra = "cpu" },
        { extra = "cu129" },
    ],
    [
        { extra = "diarization-diart" },
        { extra = "cu129" },
    ],
    [
        { extra = "voxtral-hf" },
        { extra = "diarization-sortformer" },
    ],
]

[tool.uv.sources]
torch = [
    { index = "pytorch-cpu", extra = "cpu", marker = "platform_system != 'Darwin'" },
    { index = "pytorch-cpu", extra = "diarization-diart", marker = "platform_system != 'Darwin'" },
    { index = "pytorch-cu129", extra = "cu129", marker = "platform_system == 'Linux' and platform_machine == 'x86_64'" },
]
torchaudio = [
    { index = "pytorch-cpu", extra = "cpu", marker = "platform_system != 'Darwin'" },
    { index = "pytorch-cpu", extra = "diarization-diart", marker = "platform_system != 'Darwin'" },
    { index = "pytorch-cu129", extra = "cu129", marker = "platform_system == 'Linux' and platform_machine == 'x86_64'" },
]
torchvision = [
    { index = "pytorch-cpu", extra = "diarization-diart", marker = "platform_system != 'Darwin'" },
]

[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

[[tool.uv.index]]
name = "pytorch-cu129"
url = "https://download.pytorch.org/whl/cu129"
explicit = true

[project.urls]
Homepage = "https://github.com/QuentinFuxa/WhisperLiveKit"

[project.scripts]
whisperlivekit-server = "whisperlivekit.basic_server:main"
wlk = "whisperlivekit.cli:main"
wlk-test = "whisperlivekit.test_client:main"

[tool.ruff]
target-version = "py311"
line-length = 120
exclude = [".git", "__pycache__", "build", "dist", ".eggs", ".claude", "scripts", "run_benchmark.py"]

[tool.ruff.lint]
select = ["E", "F", "W", "I"]
ignore = ["E501", "E741"]
per-file-ignores = {"whisperlivekit/whisper/*" = ["F401", "F841", "E731", "W"], "whisperlivekit/simul_whisper/mlx/*" = ["F401", "E731", "W"], "whisperlivekit/simul_whisper/mlx_encoder.py" = ["E731", "F821"], "whisperlivekit/silero_vad_iterator.py" = ["F401"]}

[tool.setuptools]
packages = [
    "whisperlivekit",
    "whisperlivekit.diarization",
    "whisperlivekit.simul_whisper",
    "whisperlivekit.simul_whisper.mlx",
    "whisperlivekit.whisper",
    "whisperlivekit.whisper.assets",
    "whisperlivekit.whisper.normalizers",
    "whisperlivekit.web",
    "whisperlivekit.local_agreement",
    "whisperlivekit.voxtral_mlx",
    "whisperlivekit.silero_vad_models",
    "whisperlivekit.benchmark",
]

[tool.setuptools.package-data]
whisperlivekit = ["web/*.html", "web/*.css", "web/*.js", "web/src/*.svg"]
"whisperlivekit.whisper.assets" = ["*.tiktoken", "*.npz"]
"whisperlivekit.whisper.normalizers" = ["*.json"]
"whisperlivekit.silero_vad_models" = ["*.jit", "*.onnx"]
