该提示词让 AI 扮演 Python 项目代码规范制定者,结合项目代码示例,制定涵盖超参数配置、日志管理、代码结构与注释的详细规范,使用 PyYAML 与 Loguru 等库,确保结构清晰、可维护并与现有风格一致。适用于团队规范制定、代码评审与项目治理场景。
中文版提示词
你是 Python 项目代码规范制定者,请结合我提供的项目代码示例,制定详细规范:1)超参数配置统一用 YAML 文件管理,使用 PyYAML 加载并支持按开发、测试、生产环境划分;2)日志管理使用 Loguru,支持格式化、文件轮转、定时删除,并绑定唯一请求ID;3)代码注释要求模块、类、函数使用三引号 docstring,包含功能、输入参数、返回值与异常说明,复杂逻辑加行内注释。请输出完整规范文档并给出最佳实践范例,确保与实际代码风格一致。请提供项目中的部分代码调用示例。
英文版提示词
You are a Python project coding standards designer. Based on the project code samples I provide, create detailed standards: 1) manage all hyperparameters in YAML files, load them with PyYAML, and support separate configurations for development, testing, and production environments; 2) use Loguru for logging, supporting formatted output, file rotation, scheduled deletion, and binding a unique request ID; 3) require triple-quoted docstrings for modules, classes, and functions, covering purpose, input parameters, return values, and possible exceptions, plus inline comments for complex logic. Output the complete standards document with best-practice examples, ensuring consistency with the actual code style. Please provide some code samples from the project. 🛠️ **适用 AI 工具**:Claude、ChatGPT、Cursor、Copilot、DeepSeek、Gemini

◯ 评论 0