[project]
name = "insurance-premium-risk"
version = "0.1.0"
description = "DTS304TC Coursework 1 - 健康保险保费风险预测"
requires-python = ">=3.10"
dependencies = [
    # 基础科学计算
    "numpy>=2.2.6",
    "pandas>=2.3.3",
    "scipy>=1.15.3",

    # 机器学习核心
    "scikit-learn>=1.7.2",
    "xgboost>=3.2.0",

    # 超参数优化
    "optuna>=4.8.0",

    # 可视化
    "matplotlib>=3.10.8",
    "seaborn>=0.13.2",

    # 数据预处理
    "imbalanced-learn>=0.14.1",
    "shap>=0.49.1",

    # 实用工具
    "joblib>=1.5.3",
    "tqdm>=4.67.1",
]

# 开发依赖
[project.optional-dependencies]
dev = ["pytest>=7.4.0", "black>=23.7.0", "ruff>=0.0.290", "mypy>=1.5.0"]
docs = ["sphinx>=7.1.0", "nbsphinx>=0.9.0", "sphinx-rtd-theme>=1.3.0"]

[tool.uv]
# Python 环境设置 - 使用 Anaconda 的 my_env 环境
python-version = "3.10"

# 显式指定 Python 路径（确保使用 anaconda my_env）
python-path = "D:\\ProgramData\\anaconda3\\envs\\my_env\\python.exe"

# 包索引配置（使用清华镜像源加速下载）
index-url = "https://pypi.tuna.tsinghua.edu.cn/simple"

# 备用索引源（按优先级排列）
extra-index-url = [
    "https://pypi.org/simple",
    "https://mirrors.aliyun.com/pypi/simple/",
]

# 并行安装（加快安装速度）
parallel = true

# 不自动管理 Python 版本（使用已有的 anaconda 环境）
managed = false

# 不允许自动下载 Python
python-downloads = false

# 预发布版本（如果需要测试最新功能）
# prerelease = false

# 排除特定包（如果有兼容性问题）
# exclude-newer = "2025-01-01T00:00:00Z"

# 环境变量
[tool.uv.env]
# 设置网络超时（秒）
UV_HTTP_TIMEOUT = "300"

# 设置并发下载数
UV_CONCURRENT_DOWNLOADS = "8"

[tool.black]
line-length = 100
target-version = ['py310']
include = '\.pyi?$'
exclude = '''
/(
    \.git
  | \.venv
  | build
  | dist
  | __pycache__
)/
'''

[tool.ruff]
line-length = 100
target-version = "py310"

[tool.ruff.lint]
select = [
    "E",  # pycodestyle errors
    "W",  # pycodestyle warnings
    "F",  # pyflakes
    "I",  # isort
    "B",  # flake8-bugbear
    "C4", # flake8-comprehensions
    "UP", # pyupgrade
]
ignore = [
    "E501", # line too long (handled by black)
    "B008", # do not perform function calls in argument defaults
    "C901", # too complex
]

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = "-v --tb=short"

[tool.mypy]
python_version = "3.10"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false
ignore_missing_imports = true

[tool.jupyter]
# Jupyter 相关配置
kernel_name = "my_env"

[tool.jupyter.lab]
# JupyterLab 相关配置
autoreload = true

[tool.lazy-logs]
# 日志配置
level = "INFO"

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