一个命令行工具,可以从项目模板创建项目,例如,从Python包模板创建Python包项目。
项目描述
Cookiecutter
使用此命令行工具从 cookiecutter(项目模板)快速创建项目。非常适合生成Python软件包项目等。
安装
使用pip包管理器安装cookiecutter
# pipx is strongly recommended.
pipx install cookiecutter
# If pipx is not an option,
# you can install cookiecutter in your Python user directory.
python -m pip install --user cookiecutter
特性
- 跨平台: 支持 Windows、Mac 和 Linux。
- 用户友好: 无需Python知识。
- 通用: 兼容Python 3.7至3.12。
- 多语言支持: 使用任何语言或标记格式中的模板。
对于用户
快速入门
推荐使用pipx运行Cookiecutter作为命令行工具,pipx可以用pip安装,命令为pip install pipx
。但如果您打算将Cookiecutter作为程序使用,请运行pip install cookiecutter
。
使用GitHub模板
# You'll be prompted to enter values.
# Then it'll create your Python package in the current working directory,
# based on those values.
# For the sake of brevity, repos on GitHub can just use the 'gh' prefix
$ pipx run cookiecutter gh:audreyfeldroy/cookiecutter-pypackage
使用本地模板
$ pipx run cookiecutter cookiecutter-pypackage/
在Python中使用
from cookiecutter.main import cookiecutter
# Create project from the cookiecutter-pypackage/ template
cookiecutter('cookiecutter-pypackage/')
# Create project from the cookiecutter-pypackage.git repo template
cookiecutter('gh:audreyfeldroy//cookiecutter-pypackage.git')
详细用法
- 从本地或远程模板生成项目。
- 使用
cookiecutter.json
提示自定义项目。 - 使用预提示、预生成和后生成钩子。
对于模板创建者
- 利用无限目录嵌套。
- 使用Jinja2满足所有模板需求。
- 使用
cookiecutter.json
轻松定义模板变量。
可用模板
在GitHub上发现各种现成的模板。
特殊模板
社区
加入社区,贡献或寻求帮助。
支持
- 在GitHub上关注我们。
- 敬请期待即将推出的支持选项。
反馈
我们重视您的反馈。请建设性地分享您的批评或投诉,以帮助我们改进。
等待回复?
- 请耐心,并考虑向社区寻求帮助。
- 对于紧急事项,请联系@audreyfeldroy进行咨询或定制开发。
行为准则
在整个项目生态系统的所有互动中遵守PyPA行为准则。
致谢
由Audrey Roy Greenfeld创建并领导,由一支专门的维护者和贡献者团队支持。
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源代码分发
cookiecutter-2.6.0.tar.gz (158.8 kB 查看哈希值)
构建分发
cookiecutter-2.6.0-py3-none-any.whl (39.2 kB 查看哈希值)
关闭
cookiecutter-2.6.0.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | db21f8169ea4f4fdc2408d48ca44859349de2647fbe494a9d6c3edfc0542c21c |
|
MD5 | bb7cf1dc80c9e42d18c3fc7ce459f07e |
|
BLAKE2b-256 | 52179f2cd228eb949a91915acd38d3eecdc9d8893dde353b603f0db7e9f6be55 |
关闭
cookiecutter-2.6.0-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | a54a8e37995e4ed963b3e82831072d1ad4b005af736bb17b99c2cbd9d41b6e2d |
|
MD5 | f444f8695cf15c65c99ec5a18497ecde |
|
BLAKE2b-256 | b6d90137658a353168ffa9d0fc14b812d3834772040858ddd1cb6eeaf09f7a44 |