[project]
name = "XnneHangLab"
version = "0.0.4"
description = ""
readme = "README.md"
requires-python = ">=3.11,<3.12"
dependencies = [
    "funasr==1.2.6",
    "modelscope>=1.23.1",
    "numpy==1.26.4",
    "torch==2.2.0",
    "torchaudio==2.2.0",
    "tomli_w==1.2.0",
    "pydantic>=2.10.6",
    "setuptools==76.0.0",
    "streamlit==1.43.2",
    "streamlit-antd-components==0.3.2",
    "pandas==2.2.3",

    # special for yutto-uiya , 因为似乎不会自动检查 workspace 的成员并且安装依赖
    "yutto",
    # "yutto==2.0.3",
    "httpx[http2,socks]>=0.28.1",
    "pexpect==4.9.0;sys_platform!='win32'",
    "wexpect-uv==0.0.4;sys_platform=='win32'",
    # "wexpect-uv;sys_platform=='win32'",
    "natsort>=8.4.0",
]
authors = [{ name = "MrXnneHang", email = "XnneHang@gmail.com" }]
keywords = []
license = { text = "MIT" }
classifiers = [
  "Operating System :: OS Independent",
  "License :: OSI Approved :: MIT License",
  "Typing :: Typed",
  "Programming Language :: Python",
  "Programming Language :: Python :: 3",
  "Programming Language :: Python :: 3.11",
  "Programming Language :: Python :: Implementation :: CPython",
]

[project.urls]
Homepage = "https://github.com/XnneHangLab/XnneHangLab"
Documentation = "https://github.com/XnneHangLab/XnneHangLab"
Repository = "https://github.com/XnneHangLab/XnneHangLab"
Issues = "https://github.com/XnneHangLab/XnneHangLab/issues"

[project.scripts]
test = "lab.test:main"
acgo = "lab.cli:main"
lab = "lab.ui:main"
get_root = "lab.utils.get_root:main"

[dependency-groups]
dev = [
  "pyright>=1.1.391",
  "ruff>=0.9.3",
  "pytest>=8.3.4",
  "pytest-rerunfailures>=15.0",
]


[tool.uv.workspace]
members = ["packages/yutto-uiya","packages/todo/"]

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

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

[tool.uv.sources]
torch = [
  { index = "pytorch-cu118", marker = "sys_platform == 'win32'" }, # sys_platform : 'win32' , 'linux' , 'Darwin'
  { index = "pytorch-cpu", marker = "sys_platform != 'win32'"}
]
torchaudio = [
  { index = "pytorch-cu118", marker = "sys_platform == 'win32'" },
  { index = "pytorch-cpu", marker = "sys_platform != 'win32'"}
]

# 这个源要与 yutto-uiya 保持一致, 要改, 得同时改
yutto = { git = "https://github.com/MrXnneHang/yutto.git", rev = "parse" }
# yutto = { path = "./packages/yutto/dist/yutto-2.0.3-py3-none-any.whl"}
# wexpect-uv = {path="./packages/wexpect-uv/dist/wexpect_uv-0.0.4-py3-none-any.whl"}

[tool.pyright]
include = ["src/lab","tests"]
pythonVersion = "3.11"
typeCheckingMode = "strict"
reportMissingTypeStubs = false

[tool.ruff]
line-length = 120
target-version = "py311"

[tool.ruff.lint]
select = [
  # Pyflakes
  "F",
  # Pycodestyle
  "E",
  "W",
  # Isort
  "I",
  # Comprehensions
  "C4",
  # Debugger
  "T100",
  # Pyupgrade
  "UP",
  # Flake8-pyi
  "PYI",
  # Bugbear
  "B",
  # Pylint
  "PLE",
  # Flake8-simplify
  "SIM101",
  # Flake8-use-pathlib
  "PTH",
  # Pygrep-hooks
  "PGH004",
  # Flake8-type-checking
  "TC",
  # Flake8-raise
  "RSE",
  # Refurb
  "FURB",
  # Flake8-future-annotations
  "FA",
  # Yesqa
  "RUF100",
]
ignore = [
  "E501", # line too long, duplicate with ruff fmt
  "F401", # imported but unused, duplicate with pyright
  "F841", # local variable is assigned to but never used, duplicate with pyright
]

[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]
known-first-party = ["lab"]
combine-as-imports = true

[tool.ruff.lint.flake8-type-checking]
runtime-evaluated-base-classes = ["pydantic.BaseModel"]


[tool.hatch.build.targets.wheel]
packages = ["src/lab","packages/todo/src/todo","packages/yutto-uiya/src/uiya"]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

# 选取的该版本 Pytorch 仅仅支持 310 311.
# < 3.11 需要额外安装 tomlilib 
# < 3.11 不支持 *tuple 的解包。(_dataclass.py 中涉及)
# 于是，该项目只能在 3.11 运行，3.12 及以上需要考虑手动升级 pytorch。
