2026-03-29 23:47:20 +08:00

193 lines
4.8 KiB
TOML

[project]
# 项目名称
name = "causal-inference-agent"
# 项目版本(遵循语义化版本控制)
version = "0.1.0"
# 项目描述
description = "Causal Inference Agent System"
# 项目作者
authors = [
{ name = "Causal Inference Team", email = "team@example.com" }
]
# 项目许可证(可选)
license = "MIT"
# 项目 readme 文件
readme = "README.md"
# 项目关键词
keywords = ["causal-inference", "agent", "data-science", "statistics"]
# 项目分类
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Mathematics",
]
# Python 版本要求
# 最低支持 Python 3.11
requires-python = ">=3.11"
# 项目运行时依赖
dependencies = [
"pandas>=2.0.0", # 数据处理和分析
"openpyxl>=3.1.0", # Excel 文件读写支持
"numpy>=1.24.0", # 数值计算基础库
"scipy>=1.10.0", # 科学计算和统计功能
"pydantic>=2.0.0", # 数据验证和设置管理(用于 JSON 输出)
"requests>=2.31.0", # HTTP 请求库(用于 LLM API 调用)
"networkx>=3.0", # 图论与因果图构建
"scikit-learn>=1.3.0", # 机器学习与因果效应估计
]
# 可选依赖(额外功能)
[project.optional-dependencies]
# 开发依赖
dev = [
"pytest>=7.4.0", # 测试框架
"pytest-cov>=4.1.0", # 代码覆盖率
"black>=23.0.0", # 代码格式化
"ruff>=0.1.0", # 代码 linting
"mypy>=1.5.0", # 类型检查
"pre-commit>=3.4.0", # Git 预提交钩子
]
# 文档依赖
docs = [
"sphinx>=7.0.0", # 文档生成工具
"sphinx-rtd-theme>=1.3.0", # Sphinx 主题
"myst-parser>=2.0.0", # Markdown 解析器
]
# 测试依赖
test = [
"pytest>=7.4.0",
"pytest-cov>=4.1.0",
"pytest-xdist>=3.3.0", # 并行测试
]
# 完整依赖(包含所有可选依赖)
all = [
"causal-inference-agent[dev,docs,test]",
]
# 包配置
[tool.setuptools.packages.find]
include = ["causal_agent*", "input_processor*", "data*"]
[project.scripts]
# 命令行入口点
causal-agent = "causal_agent.cli:main"
[project.urls]
# 项目相关链接
Homepage = "https://github.com/example/causal-inference-agent"
Repository = "https://github.com/example/causal-inference-agent"
"Bug Tracker" = "https://github.com/example/causal-inference-agent/issues"
"Documentation" = "https://causal-inference-agent.readthedocs.io"
"Changelog" = "https://github.com/example/causal-inference-agent/blob/main/CHANGELOG.md"
# ==================== uv 配置 ====================
# uv 索引配置
[tool.uv]
# 使用 PyPI 作为默认索引
index-url = "https://pypi.org/simple"
# 额外索引(可选)
extra-index-url = []
# 依赖解析策略
resolution = "lowest-direct"
# ==================== 开发工具配置 ====================
# Black 代码格式化配置
[tool.black]
line-length = 88
target-version = ['py39', 'py310', 'py311', 'py312']
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
# Ruff 代码 linting 配置
[tool.ruff]
line-length = 88
target-version = "py39"
# 启用的 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
]
[tool.ruff.per-file-ignores]
"__init__.py" = ["F401"] # unused imports in __init__.py
# MyPy 类型检查配置
[tool.mypy]
python_version = "3.11"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
ignore_missing_imports = true
# Pytest 测试配置
[tool.pytest.ini_options]
testpaths = ["tests", "input_processor"]
python_files = ["test_*.py"]
python_functions = ["test_*"]
addopts = [
"-v",
"--strict-markers",
"--strict-config",
]
markers = [
"slow: marks tests as slow",
"integration: marks tests as integration tests",
]
# 代码覆盖率配置
[tool.coverage.run]
source = ["."]
omit = [
"*/tests/*",
"*/__init__.py",
"*/conftest.py",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
]
# 预提交钩子配置
[tool.pre-commit]
# 默认钩子
default_stages = ["commit", "push", "manual"]