[project]
name = "buzz-captions"
# Change also in Makefile and buzz/__version__.py
version = "1.4.4"
description = ""
authors = [{ name = "Chidi Williams", email = "williamschidi1@gmail.com" }]
requires-python = ">=3.12,<3.13"
readme = "README.md"
# License format change to remove warning in PyPI will cause snap not to build
license = { text = "MIT" }
dependencies = [
    "sounddevice>=0.5.3,<0.6",
    "humanize>=4.4.0,<5",
    "PyQt6==6.9.1",
    "PyQt6-Qt6==6.9.1",
    "PyQt6-sip==13.10.2",
    "openai>=1.14.2,<2",
    "keyring>=25.0.0,<26",
    "platformdirs>=4.2.1,<5",
    "dataclasses-json>=0.6.4,<0.7",
    "numpy>=1.21.2,<2",
    "requests>=2.31.0,<3",
    "yt-dlp>=2026.2.21",
    "stable-ts>=2.19.1,<3",
    "faster-whisper>=1.2.1,<2",
    "openai-whisper==20250625",
    "transformers>=4.53,<5",
    "accelerate>=1.12.0,<2",
    "peft>=0.14.0,<1",
    # Overriden in uv.tool section below to ensure CUDA 12.9 compatibility
    # Skip on Intel Macs (x86_64), use 0.49.0 on ARM Macs, 0.45.0+ elsewhere
    "bitsandbytes>=0.45.0; sys_platform != 'darwin' or platform_machine != 'x86_64'",
    "polib>=1.2.0,<2",
    "srt-equalizer>=0.1.10,<0.2",
    # For Intel macOS (x86_64) - use older versions that support Intel
    "torch==2.2.2; sys_platform == 'darwin' and platform_machine == 'x86_64'",
    "torchaudio==2.2.2; sys_platform == 'darwin' and platform_machine == 'x86_64'",
    "ctranslate2==4.3.1; sys_platform == 'darwin' and platform_machine == 'x86_64'",
    # For ARM macOS (arm64) - use latest CPU-only versions from PyPI
    "torch==2.8.0; sys_platform == 'darwin' and platform_machine == 'arm64'",
    "torchaudio==2.8.0; sys_platform == 'darwin' and platform_machine == 'arm64'",
    "ctranslate2>=4.6.2,<5; sys_platform == 'darwin' and platform_machine == 'arm64'",
    # For Linux/Windows - use CUDA versions from pytorch index
    "torch==2.8.0; sys_platform != 'darwin'",
    "torchaudio==2.8.0; sys_platform != 'darwin'",
    "ctranslate2>=4.6.2,<5; sys_platform != 'darwin'",
    # faster whisper need cudnn 9
    "nvidia-cudnn-cu12>=9,<10; sys_platform != 'darwin'",
    # CUDA runtime libraries are provided by torch dependencies, no need to specify explicitly
    "darkdetect>=0.8.0,<0.9",
    "dora-search>=0.1.12,<0.2",
    "diffq>=0.2.4,<0.3",
    "einops>=0.8.1,<0.9",
    "flake8>=7.1.2,<8",
    "hydra-colorlog>=1.2.0,<2",
    "hydra-core>=1.3.2,<2",
    "julius>=0.2.7,<0.3",
    "lameenc>=1.8.1,<2",
    "museval>=0.4.1,<0.5",
    "mypy>=1.15.0,<2",
    "openunmix>=1.3.0,<2",
    "pyyaml>=6.0.2,<7",
    "submitit>=1.5.2,<2",
    "tqdm>=4.67.1,<5",
    "treetable>=0.2.5,<0.3",
    "soundfile>=0.13.1,<0.14",
    "urllib3>=2.6.0,<3",
    "posthog>=3.23.0,<4",
    # This version works, newer have issues on Windows
    "onnxruntime==1.18.1",
    "onnx>=1.20.0",  # Required for nemo-toolkit, ensures ml-dtypes is installed
    "vulkan>=1.3.275.1,<2",
    "hf-xet>=1.1.5,<2",
    "hatchling>=1.28.0",
    "cmake>=4.2.0,<5",
    # 2.5.3 is last versions with cuda 12
    "nemo-toolkit[asr]==2.5.3; sys_platform != 'darwin' or platform_machine != 'x86_64'",
    "nltk>=3.9.2",
    "uroman>=1.3.1.1",
    "lhotse==1.32.1",
    "coverage==7.12.0",
    # demucs is bundled directly in the wheel from demucs_repo/, not installed as a dependency
    "certifi==2025.11.12",
    "torchcodec>=0.9.0; sys_platform != 'darwin' or platform_machine != 'x86_64'",
    "torch>=2.2.2",
    "torchaudio>=2.2.2",
    "datasets>=4.4.1",
]
repository = "https://github.com/chidiwilliams/buzz"
documentation = "https://chidiwilliams.github.io/buzz/docs"

[project.scripts]
buzz = "buzz.buzz:main"

[dependency-groups]
dev = [
    "autopep8>=2.3.2,<3",
    "pyinstaller>=6.12.0,<7",
    "pyinstaller-hooks-contrib~=2025.1",
    "six>=1.16.0,<2",
    "pytest>=7.1.3,<8",
    "pytest-cov>=4.0.0,<5",
    "pytest-qt>=4.1.0,<5",
    "pytest-xvfb>=2.0.0,<3",
    "pytest-mock>=3.12.0,<4",
    "pytest-timeout>=2.4.0,<3",
    "pylint>=2.15.5,<3",
    "pre-commit>=2.20.0,<3",
    "pytest-benchmark>=4.0.0,<5",
    "ruff>=0.1.3,<0.2",
]
build = [
    "cmake>=4.2.0,<5",
    "polib>=1.2.0,<2",
]

[tool.uv]
index-strategy = "unsafe-best-match"
default-groups = [
    "dev",
    "build",
]

# Should be removed after nemo-toolkit update to 2.6.0
# Forcing a CUDA 12.9 compatable bitsandbytes version
# ARM Macs use 0.49.0, others use 0.47.0 (Intel Macs skip entirely via marker)
override-dependencies = [
  "bitsandbytes==0.49.0; sys_platform == 'darwin' and platform_machine == 'arm64'",
  "bitsandbytes==0.47.0; sys_platform != 'darwin'",
]

[tool.uv.sources]
torch = [
    { index = "PyPI", marker = "sys_platform == 'darwin'" },
    { index = "pytorch-cu129", marker = "sys_platform != 'darwin'" },
]
torchaudio = [
    { index = "PyPI", marker = "sys_platform == 'darwin'" },
    { index = "pytorch-cu129", marker = "sys_platform != 'darwin'" },
]

[[tool.uv.index]]
name = "nvidia"
url = "https://pypi.ngc.nvidia.com/"

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

[[tool.uv.index]]
name = "PyPI"
url = "https://pypi.org/simple/"
default = true

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.sdist]
include = [
    "buzz",
    "buzz/whisper_cpp/*",
    "buzz/locale/*/LC_MESSAGES/buzz.mo",
    "demucs_repo",
    "whisper_diarization",
    "deepmultilingualpunctuation",
    "ctc_forced_aligner",
]

[tool.hatch.build.targets.wheel]
include = [
    "buzz",
    "buzz/whisper_cpp/*",
    "buzz/locale/*/LC_MESSAGES/buzz.mo",
    "whisper_diarization",
    "deepmultilingualpunctuation",
    "ctc_forced_aligner",
]
# Map demucs_repo/demucs to top-level demucs/ so 'import demucs' works
sources = {"demucs_repo/demucs" = "demucs"}

[tool.hatch.build.hooks.custom]

[build-system]
requires = ["hatchling", "cmake>=4.2.0,<5", "polib>=1.2.0,<2", "pybind11", "setuptools>=80.9.0"]
build-backend = "hatchling.build"

[tool.coverage.report]
exclude_also = [
    "if sys.platform == \"win32\":",
    "if platform.system\\(\\) == \"Windows\":",
    "if platform.system\\(\\) == \"Linux\":",
    "if platform.system\\(\\) == \"Darwin\":",
]

[tool.ruff]
exclude = [
    "**/whisper.cpp",
]
