motivation
General framework has scaffolding tools, but does not make everyone satisfied.
Brief introduction
cookiecutter
1 is a command-line tool implemented in Python, you can build the project through project templates.
Its features include:
- Cross-platform support
- Support python2.7 + / python3.4 + / pypy (but you do not know python can also be used)
- Project templates can be turned into any language project, or support any markup format
-
Simple command line usage
For example, a github repo can be used directly as project templates:
$ cookiecutter gh:audreyr/cookiecutter-pypackage
You can also use a local project template
$ cookiecutter cookiecutter-pypackage/
Or run python code
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('https://github.com/audreyr/cookiecutter-pypackage.git') -
Directory names and file names can use a template placeholder
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}.py
-
It supports unlimited number of layers of nested directories
-
Use templates to support jinja2
-
Your template variables can be defined in the json file, cookiecutter.json
{ "full_name": "Audrey Roy",
"email": "[email protected]",
"project_name": "Complexity",
"repo_name": "complexity",
"project_short_description": "Refreshingly simple static site generator.",
"release_date": "2013-07-10",
"year": "2013",
"version": "0.1.1"
} -
The user will be prompted to select the input variables:
- Prompted to enter the field is
cookiecutter.json
the key - The default value is the
cookiecutter.json
value - Tips will be installed sequentially output
- Prompted to enter the field is
-
You can put your own scripts on the hook before and after the command to run
Individual scores
Types of | score |
---|---|
Practicality | ⭐️⭐️⭐️⭐️⭐️ |
Ease of use | ⭐️⭐️⭐️⭐️ |
Fun of | ⭐️⭐️⭐️⭐️ |