cookiecutter
2.6.0
使用此命令行实用程序从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
使用 Cookiecutter 作为命令行实用程序的推荐方法是使用pipx
运行它,可以使用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
提示自定义项目。了解更多
cookiecutter.json
轻松定义模板变量。了解更多
在 GitHub 上发现各种即用型模板。
加入社区、做出贡献或寻求帮助。
我们重视您的反馈。建设性地分享您的批评或投诉,以帮助我们改进。
在项目生态系统的所有交互过程中遵守 PyPA 行为准则。
由 Audrey Roy Greenfeld 创建和领导,并得到专门的维护者和贡献者团队的支持。