Alternatives and related projects¶
This document presents other projects that provide similar or complementary functionalities. It focuses on differences with diecutter.
Note
This document reflects diecutter‘s authors point of view, which is, inherently, a partial one. Contact authors if you feel something is wrong.
diecutter ecosystem¶
diecutter is part of an ecosystem:
- piecutter [1] is the core Python API. It provides stuff like template engines or template loaders.
- diecutter implements a WSGI application and REST interface on top of piecutter.
- diecutter-index is a proof-of-concept project for an online template registry.
- http://diecutter.io is the SAAS platform running diecutter ecosystem.
- diecutter organization on Github has been created to manage every related projects in a single place.
paster create¶
PasteScript [2] provides a paster create
command to generate files from
templates.
diecutter‘s authors tried PasteScript, and found it too complicated for most use cases. They felt that the more they generated files with PasteScript, the more they spent time on PasteScript‘s specific stuff. With diecutter, they tried to focus on using templates to generate files.
Let’s highlight some differences between PasteScript and diecutter:
PasteScript | diecutter |
---|---|
paster create is a command.
Runs on local machine.
You need PasteScript installed on
every computer (or project) where
you use templates. |
Diecutter is a web service. You can use a shared diecutter server, but it is also easy to deploy on a local machine. |
You have to register templates:
|
You PUT files just like in a filesystem. |
You distribute templates in Python packages. | You carry templates (folders and files) as you like. No packaging. |
Can collect input data via interactive shell prompts. | No builtin client (that’s part of the Vision). Listing variables isn’t implemented yet (that’s part of the plans). |
You declare sets of templates. You can’t render only some part of it, you have to render the whole set. | You can render a directory as a set, but you can also render any single part of it, individually. |
Templates are Python classes. That allows developers to implement various tasks in hooks. | Uses only templates. Even to dynamically generate folders. |
Asks you whether to ovewrite files in output directory, and even shows you the diff! | That’s not a job for diecutter. You can do that (better) with Git, Mercurial and many other tools. |
Uses Cheetah [3] template engine. | Supports several template engines, such as Jinja [4] and Django [5]. Cheetah [3] is in the plans. |
Not only about generating files. PasteScript is a big project that does several things. | Focuses on generating files. |
collective.generic.webbuilder¶
collective.generic.webbuilder [6] is a file generation service, built on top of
paster create. It is a web interface to paster create
.
Thus, some differences are directly related to paster create, such as you define sets of templates, or have to register templates (collective.generic.webbuilder uses ZCML [7]).
Collective.generic.webbuilder inspired diecutter.
Diecutter’s authors felt that collective.generic.webbuilder is a tool made by paster users, for paster users. Mostly developers. With diecutter, they tried to make things easy for most users, but flexible for users who have specific needs.
Cookiecutter¶
cookiecutter [8] provides command line tools to generate files using templates.
Here are some differences with diecutter:
cookiecutter | diecutter |
---|---|
Provides command line interface. | Provides WSGI application and REST
API. Use things like curl if you
like a CLI. |
You need it installed on your machine. | You just need a web client. |
Easily develop templates on your machine. | To develop templates, you need to install and run a local diecutter. |
Reads templates from Github. | Reads templates from Github, anywhere in the repository. |
One template per repository. Repository is dedicated to templates | Unlimited number of templates per repository. Templates are just files and directories in a filesystem. |
Supports Bitbucket too. | No support for Bitbucket at the moment. Help is welcome ;) |
A “cookiecutter” is a set of templates. Renders everything. | Renders directories or any part of it (sub-directories, single files). |
In templates, variables are like
{{ cookiecutter.YOUR_VARIABLE }}
so templates are tied to
cookiecutter. |
No prefix for variables. Works with templates not made for diecutter. |
Python API. | Python API lives in piecutter [1]. |
Shell is the user interface. | HTML forms provide a nice, human-readable and highly customizable user interface. |
Only Jinja2. No plans for other template engines. | Supports several template engines. Could support even non-Python engines. |
Voodoo¶
And...¶
See also projects listed as cookiecutter alternatives [9].
Puppet, Chef and other provisioners¶
Provisioning tools, such as Puppet, Chef or Salt (just to name a few), use templates to generate configuration. They also do many other things.
Diecutter only deals with templates and file generation.
Templates and file generation aren’t only a matter of provisioning. There are many situations where you need templates, and where provisioners would be overkill.
Diecutter also tries to make it easier to migrate from one provisioner to another. Provisioners are often tied to one template engine, one layout and one deployment process. Those items differ from one provisioner to another. With diecutter, which supports several template engines, you could easily use the same templates whatever the provisioner or deployment procedure.
References
[1] | (1, 2) https://pypi.python.org/pypi/piecutter/ |
[2] | https://pypi.python.org/pypi/PasteScript/ |
[3] | (1, 2) http://www.cheetahtemplate.org/ |
[4] | http://jinja.pocoo.org/ |
[5] | http://docs.djangoproject.com |
[6] | https://pypi.python.org/pypi/collective.generic.webbuilder/ |
[7] | http://docs.zope.org/zope.component/zcml.html |
[8] | https://pypi.python.org/pypi/cookiecutter |
[9] | http://cookiecutter.readthedocs.io/en/latest/readme.html#similar-projects |