Using and Mastering Cookiecutter Transcripts
Chapter: Creating Cookiecutter templates
Lecture: The meta template
Login or
purchase this course
to watch this video and the rest of the course contents.
0:01
Now you know how to create these Cookiecutter templates
0:03
and I feel like I've shown you something of the hard way.
0:06
And I did that on purpose, not to torture you
0:09
but because I want you to really see and understand all the moving parts,
0:12
but, if I was going to go create a new Cookiecutter template,
0:15
there is a very good chance I would use a Cookiecutter template to do that.
0:19
That's kind of circular, isn't it, but there is a template called cookiecutter-template,
0:24
and its goal is to ask you the questions to generate
0:28
the basic project structure for creating a Cookiecutter template.
0:32
So you can get it from this URL here, let's go and run it.
0:35
Alright, my name is Michael Kennedy, remember that comes from my default file,
0:39
similarly my email, my GitHub user name all these things,
0:42
the name of the project, let's suppose we want to do something
0:45
with race cars simulations, so I'll call this Race Sim,
0:49
something like that, and notice, it uses that dependent thing
0:56
to generate the right naming structure, it's going to put cookiecutter-
1:01
which is the convention for naming these templates,
1:05
it's not required but it's the convention, and it slugifies, if you will,
1:08
it creates the lower case no spaces version of the name,
1:13
so perfect, let's just go with that, short description,
1:16
this will be the starter template for creating race car simulations.
1:22
Okay, again, today is the day we are going to do it;
1:29
yes, we want to copy hooks.
1:33
Boom it's done, okay, let's see what we got, it should be in cookiecutter-race-sim
1:37
and there it is so let's open it up, alright, now in here,
1:41
notice, we've got a Cookiecutter template, it has a cookiecutter.json
1:47
and it has a directory that has got a name in there and it's going to have
1:51
basically the project slug name put there when you run it, it also has a CHANGELOG,
1:55
it has hooks, a post generation hook with some code already built for us,
2:01
so we can use that to start, no pre gen hook but that's okay,
2:05
it has a license, a README and so on.
2:08
This is really nice and if you're going to get started,
2:11
just make sure, you don't want to make any mistakes,
2:13
so might as well just say cookiecutter cookiecutter-template
2:15
And get started that way.