Using and Mastering Cookiecutter Transcripts
Chapter: Welcome to the course
Lecture: What you will learn
Login or
purchase this course
to watch this video and the rest of the course contents.
0:02
The course is broken into three major sections. It's going to start out with just what it takes to consume Cookiecutter.
0:10
You know, if I am somebody and I see a Cookiecutter template out there and I want to create a project on it, how do I do that,
0:16
what are the intricacies, and sort of advanced features there. If I am like a project lead, or I run some kind of software development team,
0:23
or maybe I own an open source project, there is a different set of things that I might care about around creating templates, and so on,
0:31
and if I want to contribute back to Cookiecutter, make it better, make it match my workflow better, there is some edge care
0:38
that I need to bring in as a feature, we'll talk about how to do that. So in the consuming Cookiecutter part,
0:43
we're going to talk about what you need to just run and use Cookiecutter as a program, we're going to install Cookiecutter,
0:49
we're going to learn and talk about the command line interface for Cookicutter, we're going to survey the pantry full of cookies,
0:58
which is the official set of Cookiecutter templates listed in the Cookiecutter documentation, there are many more
1:03
that people didn't bother to get back into the listing, but there is quite a few interesting ones there
1:09
and you will understand the power of Cookiecutter as you go through them.
1:12
We'll talk about local versus remote templates, do you need internet connection, how do these two things connect, we'll about profile defaults
1:20
Cokiecutter ask you lots of questions, what's your name, what's your email address, things like that, all the time,
1:27
and we'll see that you don't always have to answer those, you can set up defaults for them, how to use Cookiecutter
1:31
within virtual environments, replaying project creation as in answering the exact questions, the exact same way
1:37
over and over again, in a reliable way, and things like that. Now, if you're a project lead, you might want to create Cookiecutter templates
1:46
for your project, for your company or for your team, and so we're going to talk about how do we create Cookiecutter templates,
1:52
what are the basics, we'll see that there is a Cookiecutter json file and there is a certain project structure, that we use,
1:59
and that will form the template, we'll see how you can prompt the user, there is a lot of choices on user input
2:05
and what the types of questions you can ask are, and we'll see that there is this concept of choice prompts
2:12
so if I want to ask the user hey, pick a web framework template for this, do you want Jinja, do you want Chameleon, do you want Mako,
2:20
you can give them a list like that, and we also see that you can have complex default values, one of the real powerful things
2:27
about Cookicutter are its pre and post generation hooks, this is arbitrary Python code that you write and ship with your template and it runs,
2:36
either right before the files are created and transformed, but after the information has been gathered from the users, or entirely afterwards.
2:44
As in the case of the post generation hook. We'll see that you might want to exclude certain files from transforms
2:50
if you want to ship a Cookiecutter template as part of your Cookiecutter template that turns out to be a problem,
2:56
so we'll see how to solve that problem, how you can conditionally include files and directories or maybe exclude them,
3:01
so in my case of the web template framework, if you choose Mako you don't want to include the Jinja or the Chameleon templates
3:07
so you might want to exclude them here. We'll do a little bit of a case study for various existing project templates,
3:14
some of the popular open source projects and companies and how they are using Cookiecutter,
3:20
and finally, once we've learned about how to create these templates, we'll see how you can get your template listed in the official documentation
3:27
for people to discover your project. Last but not least, as somebody who is creating Cookiecutter templates,
3:33
you may well want to use the programmatic interface, not the command line interface to Cookiecutter. So if you want to give your users an application
3:43
that they can run that will create projects, you can internally invisibly wrap up Cookiecutter in this application,
3:49
and you use whatever UI you want command line interface, GUI, web app, it doesn't really matter, you can gather
3:57
a bunch of information from the users and programmatically use Cookiecutter to actually do the project's creation.
4:03
Now finally, as a contributor, we're going to see how you can check out and build Cookiecutter locally,
4:08
how you locally register it as a package so that Python knows how to find the source and then you can test it and things like that,
4:15
we'll talk a bit about the contributor guidelines, we'll actually go through the process of adding a feature
4:20
or in this case really we're going to add a bug fix but we're going to modify Cookiecutter and push that back
4:25
to the open source project, so hopefully, by the time this course is done, there should be a feature that wasn't there at the beginning,
4:31
because we're going to do that as part of our demo. Alright, so this is what we're going to learn about Cookiecutter
4:37
so super cool project, there is a lot to cover and I hope you're excited to get started.