# Office MCP Server - Python Project Configuration
# 符合 PEP 518 和 PEP 621 标准
[project]
name = "office-mcp-server"
version = "1.0.0"
description = "AI-Powered Office Automation - MCP Server for Word, Excel, PowerPoint"
readme = "README.md"
requires-python = ">=3.10"
license = {text = "MIT"}
authors = [
{name = "Office MCP Team", email = "team@example.com"}
]
maintainers = [
{name = "Office MCP Team", email = "team@example.com"}
]
keywords = [
"mcp",
"office",
"word",
"excel",
"powerpoint",
"automation",
"ai",
"claude",
"cursor"
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business",
"Topic :: Software Development :: Libraries :: Python Modules",
]
# 核心依赖
dependencies = [
"fastmcp>=0.1.0",
"python-docx>=1.1.0",
"openpyxl>=3.1.0",
"python-pptx>=0.6.23",
"reportlab>=4.0.0",
"Pillow>=10.0.0",
"python-dotenv>=1.0.0",
"pydantic>=2.0.0",
"loguru>=0.7.0",
]
# 可选依赖组
[project.optional-dependencies]
# 开发依赖
dev = [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"pytest-asyncio>=0.21.0",
"black>=23.0.0",
"ruff>=0.1.0",
"mypy>=1.0.0",
]
# PDF 增强支持
pdf = [
"python-docx2pdf>=0.1.8",
"pypdf>=3.0.0",
]
# Excel 高级功能
excel-advanced = [
"xlsxwriter>=3.1.0",
"pandas>=2.0.0",
]
# 文档模板支持
templates = [
"python-docx-template>=0.16.0",
]
# 完整功能(包含所有可选依赖)
full = [
"office-mcp-server[dev,pdf,excel-advanced,templates]",
]
# 项目 URL
[project.urls]
Homepage = "https://github.com/your-username/office-mcp-server"
Documentation = "https://github.com/your-username/office-mcp-server/blob/main/README.md"
Repository = "https://github.com/your-username/office-mcp-server"
Issues = "https://github.com/your-username/office-mcp-server/issues"
Changelog = "https://github.com/your-username/office-mcp-server/blob/main/CHANGELOG.md"
# 命令行入口点
[project.scripts]
office-mcp = "office_mcp_server.main:main"
office-mcp-server = "office_mcp_server.main:main"
# ============================================
# 构建系统配置
# ============================================
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
# ============================================
# Setuptools 配置
# ============================================
[tool.setuptools]
packages = ["office_mcp_server"]
package-dir = {"" = "src"}
[tool.setuptools.package-data]
office_mcp_server = ["py.typed"]
# ============================================
# Black - 代码格式化工具
# ============================================
[tool.black]
line-length = 100
target-version = ['py310', 'py311', 'py312']
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.venv
| venv
| \.eggs
| \.tox
| build
| dist
)/
'''
# ============================================
# Ruff - 代码检查工具
# ============================================
[tool.ruff]
line-length = 100
target-version = "py310"
# 启用的规则
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
]
# 忽略的规则
ignore = [
"E501", # line too long (由 black 处理)
"B008", # do not perform function calls in argument defaults
"C901", # too complex
]
# 排除的文件
exclude = [
".git",
".venv",
"venv",
"__pycache__",
"build",
"dist",
"*.egg-info",
]
# ============================================
# MyPy - 类型检查工具
# ============================================
[tool.mypy]
python_version = "3.10"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = false
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
follow_imports = "normal"
ignore_missing_imports = true
# 排除的模块
[[tool.mypy.overrides]]
module = [
"docx.*",
"openpyxl.*",
"pptx.*",
"reportlab.*",
]
ignore_missing_imports = true
# ============================================
# Pytest - 测试框架
# ============================================
[tool.pytest.ini_options]
minversion = "7.0"
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"-ra",
"--strict-markers",
"--strict-config",
"--cov=src",
"--cov-report=term-missing",
"--cov-report=html",
]
# 测试标记
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"unit: marks tests as unit tests",
]
# ============================================
# Coverage - 测试覆盖率
# ============================================
[tool.coverage.run]
source = ["src"]
omit = [
"*/tests/*",
"*/test_*.py",
"*/__pycache__/*",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"@abstractmethod",
]
# ============================================
# isort - 导入排序工具
# ============================================
[tool.isort]
profile = "black"
line_length = 100
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
# ============================================
# Bandit - 安全检查工具
# ============================================
[tool.bandit]
exclude_dirs = ["tests", "venv", ".venv"]
skips = ["B101", "B601"]