git clone git@github.com:OpenWSGR/AutoWSGR.git
cd AutoWSGR
uv sync
pre-commit install激活虚拟环境后可直接运行命令(无需 uv run 前缀):
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
pytest
pre-commit run --all-files- Python 版本:3.12+
- 格式化与 lint:Ruff(已覆盖 isort / black 功能),配置见
pyproject.toml - 目标行宽 100,单引号字符串
- 禁止相对导入(
ban-relative-imports = all) - 英语拼写检查:codespell,忽略词表见
docs/spelling_wordlist.txt
提交前务必运行:
pre-commit run --all-files- 单元测试:
pytest(测试目录testing/) - 功能测试:运行
examples/目录中的脚本进行端到端验证
pytest提交信息格式:
<type>(<scope>): <简短描述>
<正文>
常用类型:
feat:新功能fix:修复build:构建系统或依赖变更docs:文档style:不影响代码逻辑的格式调整refactor:重构test:测试
示例:
build: migrate from setuptools to hatchling
- Replace setuptools with hatchling as build backend
- Remove obsolete MANIFEST.in
- Build backend:hatchling
- 包数据(图片、YAML、JAR 等)位于
autowsgr/data/,由 hatchling 自动包含,无需MANIFEST.in
uv build- 用户文档地址:https://docs-autowsgr.notion.site
- 代码变更后同步更新文档,并鼓励在代码中编写注释和文档字符串。