open-nudge/opentemplate
GitHub: open-nudge/opentemplate
一个开箱即用的 Python 项目模板,集成包管理、测试、文档、安全扫描和 CI/CD 流水线,通过单个命令即可完成开发环境配置。
Stars: 41 | Forks: 1
一体化 Python 模板。一键启动。应有尽有。





✨ 功能特性 🚀 快速开始 📚 文档 🤝 贡献 👍 采用者 📜 法律信息
## 功能特性 __opentemplate__ 是一个 Python 模板,具有以下特点: - [__真正的开源__](https://open-nudge.github.io/opentemplate/template/about/philosophy): 无令牌、无费用、无高级计划,纯开源软件 - [__易于使用__](https://open-nudge.github.io/opentemplate/template/quickstart/usage): 克隆模板仓库,运行 `pdm setup`,然后__专注于你的代码__ - [__业界领先__](https://open-nudge.github.io/opentemplate/template/details): 最佳检查工具,涵盖 Python、YAML、Markdown、散文等,统一配置 - [__安全可靠__](https://open-nudge.github.io/opentemplate/template/details/security): [SLSA 3 级](https://slsa.dev/spec/v1.0-rc1/levels)、[SBOM](https://www.cisa.gov/sbom)、 [证明文件](https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds)、 [安全出口](https://github.com/step-security/harden-runner)、 [OSSF 最佳实践](https://github.com/ossf/scorecard) - [__一致性强__](https://open-nudge.github.io/opentemplate/template/configuration/basic): 所有流水线(`GitHub Actions`、`prek`) 共享同一份 `pyproject.toml` 配置 - [__性能优异__](https://open-nudge.github.io/opentemplate/template/details/github-actions): 并行检查、构建,最小化的缓存和检出 ### 代码质量(以 Python 为重点) - __包管理器:__ [`pdm`](https://pdm-project.org/en/latest/) 只需一个 `pdm setup` 即可管理一切! (参见 [为什么选择 pdm](https://open-nudge.github.io/opentemplate/latest/template/about/faq/#why-use-pdm-instead-of-uv)) - __测试:__ [`pytest`](https://docs.pytest.org/en/stable/) (配合 [`coverage`](https://coverage.readthedocs.io/en/7.9.1/) 和 [`hypothesis`](https://hypothesis.readthedocs.io/en/latest/) 进行模糊测试);__跨所有 Python 版本测试 无需使用 [`tox`](https://tox.wiki/en/4.27.0/) 或 [`nox`](https://nox.thea.codes/en/stable/)__(由 `pdm` 直接管理!) - __文档:__ [`mkdocs`](https://www.mkdocs.org/) - __一次编写,到处可用(GitHub 和托管文档统一外观)__, [语义化版本控制](https://semver.org/) (通过 [`mike`](https://github.com/jimporter/mike)), 自动从 [覆盖率](https://github.com/econchick/interrogate)、 [死链检查](https://github.com/AlexanderDokuchaev/md-dead-link-check) 和[拼写检查](https://github.com/codespell-project/codespell) 的文档字符串生成, 每次 GitHub 发布后自动部署,采用简洁的 [Material Design 外观](https://github.com/squidfunk/mkdocs-material) - __代码格式化和检查:__ [`ruff`](https://github.com/astral-sh/ruff) (精心挑选的检查规则,确保最佳质量和易用性;大部分已启用), [`basedpyright`](https://github.com/DetachHead/basedpyright) 用于类型检查,[`FawltyDeps`](https://github.com/tweag/FawltyDeps) 用于静态依赖分析 - __每个文件都包含你的 git 信息作为版权声明__ - 版权信息由 `prek` 自动添加, 参见 [REUSE](https://reuse.readthedocs.io/en/stable/) 和 [SPDX 许可](https://spdx.dev/learn/handling-license-info/) 了解更多信息 - __自动更新 Python 版本__:`pyproject.toml` (以及必要的 GitHub Actions 流水线) 会自动更新以始终使用__最新的 3 个 Python 版本__(通过 [`cogeol`](https://pypi.org/project/cogeol/)) 遵循 [Scientific Python SPEC0](https://scientific-python.org/specs/spec-0000/) 弃用和生命周期结束策略 - __其他代码检查__:检查 `YAML`、`Markdown`、`INI`、`JSON`、散文、 所有配置文件、`shell`、`GitHub Actions` - __全部归类为 `check-手动运行检查器或修复工具(点击我)
``` > pdm check-调整模板(点击我)
  对 `pyproject.toml` 的常见更改: - 在 `[dependency-groups]` 下添加开发依赖 (所有依赖都命名为 `dev-禁用某些 prek 检查(点击我)
  `prek` 检查定义在 `prek.toml` 中。 使用 `SKIP` 环境变量禁用检查: ``` SKIP="禁用 GitHub Actions 检查(点击我)
  提交时可以添加以下字符串之一到提交信息中: - `[skip ci]` - `[ci skip]` - `[no ci]` - `[skip actions]` - `[actions skip]`标签:Python开发, Python模板, Python项目, SOC Prime, 一站式解决方案, 二进制发布, 代码模板, 安全规则引擎, 开发工具, 开发框架, 开源工具, 快速启动, 数据管道, 脚手架工具, 软件工程, 逆向工具, 项目生成器, 项目脚手架